﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #161008;
  --bg2: #26170d;
  --surface: rgba(42, 27, 15, 0.86);
  --surface-strong: rgba(55, 35, 20, 0.95);
  --surface-soft: rgba(255, 229, 183, 0.06);
  --border: rgba(173, 123, 66, 0.42);
  --border-strong: rgba(222, 180, 104, 0.62);
  --accent: #d7b46a;
  --accent-strong: #b7853b;
  --accent-alt: #8d4a2a;
  --text: #f5e6c8;
  --muted: #d2bc95;
  --muted-soft: #a78961;
  --red: #c97858;
  --gold: #e0b35a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --radius: 20px;
}

html { color-scheme: dark; }

body {
  min-height: 100vh;
  color: var(--text);
  font: 14px/1.45 "Cinzel Decorative", Georgia, serif;
  overflow: hidden;
  background:
    linear-gradient(rgba(22, 14, 8, 0.58), rgba(22, 14, 8, 0.78)),
    url("site-bg.png.png"),
    radial-gradient(circle at top left, rgba(224, 179, 90, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(114, 62, 27, 0.2), transparent 28%),
    linear-gradient(160deg, var(--bg) 0%, #20140b 55%, var(--bg2) 100%);
  background-size: cover, cover, auto, auto, auto;
  background-position: center center, center center, 0 0, 0 0, 0 0;
  background-attachment: fixed, fixed, scroll, scroll, scroll;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 222, 165, 0.07), transparent 58%),
    linear-gradient(rgba(68, 44, 23, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 44, 23, 0.06) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 92%);
}

.header {
  position: static;
  padding: 0 24px 0;
  background: transparent;
  overflow: visible;
}

.header-inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px;
  height: 123px;
  border: 1px solid rgba(185, 137, 77, 0.45);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(108, 73, 41, 0.32), rgba(47, 29, 16, 0.68)),
    linear-gradient(135deg, rgba(224, 179, 90, 0.08), rgba(84, 48, 21, 0.08));
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3);
  overflow: visible;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 540px;
  height: 113px;
  justify-content: center;
  overflow: visible;
}

.build-badge {
  margin-top: 2px;
  margin-left: -120px;
  color: rgba(240, 217, 166, 0.72);
  font-family: "Cinzel", Georgia, serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-logo-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.brand-fire-gif {
  width: 113px;
  height: 113px;
  flex-shrink: 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  transform: translateX(-11px);
}

.brand-kicker,
.main-intro-kicker {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.32em;
  line-height: 1.35;
  text-transform: uppercase;
  color: #e7c98e;
}

.brand-logo-image {
  display: block;
  width: clamp(134px, 17.9vw, 257px);
  height: auto;
  image-rendering: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
  transform: translate(-60px, 12px);
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}


.stat-pill {
  min-width: 158px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(160, 113, 63, 0.5);
  background: linear-gradient(180deg, rgba(72, 47, 25, 0.72), rgba(40, 25, 14, 0.7));
}

.stat-pill--accent {
  border-color: rgba(208, 164, 92, 0.5);
  background: linear-gradient(180deg, rgba(115, 80, 42, 0.78), rgba(59, 37, 20, 0.78));
}

.stat-pill-label {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.22em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.participant-count,
.stat-pill-value {
  font-size: 15px;
  font-weight: 700;
}

.layout {
  max-width: 1560px;
  margin: 0 auto;
  padding: 10px 24px 14px;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr) 250px;
  gap: 14px;
  height: calc(100vh - 150px);
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(153, 107, 62, 0.18), rgba(56, 34, 18, 0.06) 24%, transparent 40%),
    linear-gradient(180deg, rgba(55, 34, 18, 0.95), rgba(33, 21, 12, 0.95));
  box-shadow:
    var(--shadow);
}

.panel--participants {
  max-height: calc(100vh - 140px);
}

.panel--history {
  max-height: calc(100vh - 150px);
}


.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(168, 121, 68, 0.24);
}

.panel-header h2 {
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f0d9a6;
  text-shadow: 0 1px 0 rgba(58, 30, 12, 0.75);
}

.panel-header-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn,
.btn-icon,
.mode-tab,
.duration-btn,
input,
textarea {
  appearance: none;
  font: inherit;
}

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(100, 66, 35, 0.92), rgba(58, 35, 18, 0.95));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(119, 79, 44, 0.95), rgba(69, 41, 22, 0.98));
}

.btn:active { transform: translateY(0); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-accent {
  color: #2b1609;
  border-color: rgba(224, 179, 90, 0.74);
  background: linear-gradient(180deg, #ecd39a, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(140, 84, 37, 0.28);
}

.btn-accent:hover {
  border-color: rgba(236, 211, 154, 0.86);
  background: linear-gradient(180deg, #f1deb5, #dcb56f, #b67e39);
}

.btn-soft {
  flex: 1;
  min-width: 0;
}

.btn-big {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.btn-icon {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(100, 66, 35, 0.92), rgba(58, 35, 18, 0.95));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.btn-icon:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(119, 79, 44, 0.95), rgba(69, 41, 22, 0.98));
}

.add-row,
.participant-tools,
.import-row,
.panel-status,
.history-helper {
  margin-inline: 16px;
}

.add-row {
  display: flex;
  gap: 8px;
  padding-top: 14px;
}

.add-row input,
.import-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  color: var(--text);
  background: rgba(32, 20, 11, 0.72);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.add-row input {
  min-width: 0;
  padding: 11px 14px;
}

.import-row textarea {
  min-height: 90px;
  padding: 12px 14px;
  resize: vertical;
  font-family: inherit;
}

.add-row input:focus,
.import-row textarea:focus {
  border-color: rgba(224, 179, 90, 0.5);
  box-shadow: 0 0 0 4px rgba(224, 179, 90, 0.1);
  background: rgba(39, 24, 13, 0.92);
}

.participant-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
}

.participant-tools .btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  text-align: center;
}

#btn-clear-all {
  grid-column: 1 / -1;
}

.import-row {
  padding-top: 10px;
}

.import-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-hint {
  color: var(--muted-soft);
  font-size: 12px;
}

.panel-status {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(185, 137, 77, 0.36);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(82, 51, 26, 0.48);
}

.panel-status.is-success {
  color: #f5e7c4;
  border-color: rgba(216, 177, 100, 0.38);
}

.panel-status.is-warn {
  color: #ffe9ca;
  border-color: rgba(244, 199, 106, 0.26);
  background: rgba(244, 199, 106, 0.08);
}

.participant-list,
.history-list,
.multi-results {
  min-height: 0;
  overflow: auto;
}

.participant-list,
.history-list {
  list-style: none;
  flex: 1;
  padding: 14px 12px 14px;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 244, 224, 0.03);
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.participant-item:hover {
  transform: translateX(2px);
  border-color: rgba(192, 142, 84, 0.22);
  background: rgba(111, 74, 41, 0.22);
}

.participant-item .idx {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  background: rgba(106, 69, 37, 0.5);
  flex-shrink: 0;
}

.participant-item .name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
}

.participant-item .btn-remove {
  border: none;
  background: transparent;
  color: var(--muted-soft);
  padding: 0 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.participant-item:hover .btn-remove { opacity: 1; }
.participant-item .btn-remove:hover { color: var(--red); }

.participant-item.highlight {
  border-color: rgba(224, 179, 90, 0.44);
  background: linear-gradient(90deg, rgba(168, 115, 56, 0.28), rgba(87, 52, 24, 0.08));
  box-shadow: inset 0 0 0 1px rgba(224, 179, 90, 0.14);
}

.list-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted-soft);
}

.panel--main {
  padding: 12px;
  gap: 10px;
}

.main-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 10px 8px;
  border-radius: 18px;
  border: 1px solid rgba(173, 123, 66, 0.24);
  background: linear-gradient(180deg, rgba(95, 62, 33, 0.22), rgba(44, 27, 15, 0.16));
}

.mode-description {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  max-width: 34ch;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.main-intro--idle {
  min-height: 72px;
  justify-content: center;
  text-align: center;
}

.main-intro--idle > div {
  max-width: 760px;
}

.main-intro--idle .mode-description {
  max-width: 520px;
  font-size: 15px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mode-tab {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(88, 58, 31, 0.9), rgba(48, 30, 17, 0.94));
  color: var(--muted);
  border-radius: 14px;
  padding: 13px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.mode-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.mode-tab.active {
  color: #2b1609;
  border-color: rgba(236, 211, 154, 0.74);
  background: linear-gradient(180deg, #efddb1, #ddb96f, #b78343);
}

.mode-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(173, 123, 66, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(124, 80, 42, 0.16), rgba(49, 31, 18, 0.28));
}

.mode-panel.active { display: flex; }

.quick-stage,
.roulette-stage,
.wheel-stage {
  flex: 1;
  min-height: 0;
}

.quick-stage,
.roulette-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-winner {
  min-width: min(100%, 520px);
  padding: 22px 24px;
  border-radius: 28px;
  text-align: center;
  border: 1px solid rgba(176, 129, 73, 0.4);
  background:
    radial-gradient(circle at top, rgba(224, 179, 90, 0.12), transparent 45%),
    rgba(39, 24, 13, 0.88);
}

.quick-winner-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 11px;
}

.quick-winner-name {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.04em;
  word-break: break-word;
}

.quick-winner.win {
  border-color: rgba(224, 179, 90, 0.48);
  box-shadow: 0 0 0 1px rgba(224, 179, 90, 0.16), 0 24px 60px rgba(118, 75, 35, 0.18);
}

.quick-winner.win .quick-winner-name { color: var(--accent); }

.quick-winner--dramatic {
  animation: quick-winner-reveal 1.5s ease-out 1;
}

@keyframes quick-winner-reveal {
  0% {
    transform: scale(0.96);
    opacity: 0.78;
    box-shadow: 0 0 0 0 rgba(224, 179, 90, 0);
  }
  35% {
    transform: scale(1.04);
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(224, 179, 90, 0.24), 0 0 30px rgba(224, 179, 90, 0.34);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(224, 179, 90, 0.16), 0 18px 40px rgba(118, 75, 35, 0.16);
  }
}

.roulette-stage {
  flex-direction: column;
  gap: 12px;
}

.roulette-track-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(176, 129, 73, 0.34);
  border-radius: 20px;
  background: rgba(34, 22, 13, 0.92);
}

.roulette-track-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(34,22,13,0.95), transparent 12%, transparent 88%, rgba(34,22,13,0.95));
}

.roulette-center-marker {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 0;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}

.roulette-center-marker::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, 0) rotate(45deg);
  border: 2px solid rgba(87, 42, 14, 0.92);
  border-radius: 3px;
  background: linear-gradient(180deg, #fff0bf, #efc66c 55%, #a86631);
  box-shadow:
    0 0 0 1px rgba(255, 233, 177, 0.18) inset,
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.roulette-center-marker::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 226, 150, 0.95), rgba(203, 120, 52, 0.92));
  box-shadow:
    0 0 0 1px rgba(74, 36, 12, 0.75),
    0 0 16px rgba(255, 203, 107, 0.18);
}




.roulette-track {
  display: flex;
  gap: 8px;
  padding: 28px 16px 16px;
  white-space: nowrap;
  will-change: transform;
}

.roulette-item {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(166, 117, 66, 0.34);
  background: rgba(90, 57, 30, 0.45);
  font-weight: 700;
}

.roulette-item.selected {
  color: #2b1609;
  border-color: rgba(237, 208, 145, 0.72);
  background: linear-gradient(180deg, #f1ddb3, #ddb96f, #b78343);
}

.roulette-result,
.wheel-result {
  min-height: 32px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f0d08d;
}

.wheel-result--dramatic {
  animation: wheel-winner-pulse 1.4s ease-out 1;
}

@keyframes wheel-winner-pulse {
  0% {
    transform: scale(0.94);
    opacity: 0.72;
    text-shadow: 0 0 0 rgba(240, 208, 141, 0);
  }
  35% {
    transform: scale(1.08);
    opacity: 1;
    text-shadow: 0 0 18px rgba(240, 208, 141, 0.72);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    text-shadow: 0 0 10px rgba(240, 208, 141, 0.34);
  }
}

.wheel-result-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wheel-debug {
  display: flex;
  gap: 12px;
  font-family: "Cinzel", Georgia, serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(240, 217, 166, 0.62);
}

.wheel-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  border: none;
  background: transparent;
}

#wheel-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.wheel-focus-pointer {
  display: none;
}

body.wheel-focus .header,
body.wheel-focus .panel--participants,
body.wheel-focus .panel--history,
body.wheel-focus .main-intro,
body.wheel-focus .mode-tabs,
body.wheel-focus #mode-quick,
body.wheel-focus #mode-roulette,
body.wheel-focus #mode-multi,
body.wheel-focus #mode-battle {
  display: none !important;
}

body.wheel-focus .layout {
  max-width: none;
  min-height: 100vh;
  padding: 0;
  display: block;
}

body.wheel-focus .panel--main {
  position: fixed;
  inset: 0;
  z-index: 100;
  border: none;
  border-radius: 0;
  background:
    radial-gradient(circle at center, rgba(104, 70, 39, 0.18), transparent 52%),
    rgba(19, 12, 7, 0.96);
  box-shadow: none;
  padding: 22px 26px;
}

body.wheel-focus #mode-wheel {
  display: flex !important;
  min-height: calc(100vh - 44px);
  padding: 0;
  border: none;
  background: transparent;
}

body.wheel-focus .wheel-stage {
  flex: 1;
  min-height: 0;
}

body.wheel-focus #wheel-canvas {
  width: min(88vw, 88vh);
  height: min(88vw, 88vh);
  max-width: none;
}

body.wheel-focus .wheel-focus-pointer {
  position: absolute;
  left: max(18px, calc(50% - min(44vw, 44vh) - 8px));
  top: 50%;
  display: block;
  width: 72px;
  height: 46px;
  transform: translateY(-50%);
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
}

body.wheel-focus .wheel-focus-pointer::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 50%;
  border: 4px solid #f0c76e;
  background: #5c1713;
  box-shadow: 0 0 0 2px rgba(85, 22, 17, 0.75);
}

body.wheel-focus .wheel-focus-pointer::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 56px;
  height: 28px;
  transform: translateY(-50%);
  clip-path: polygon(0 28%, 52% 28%, 52% 12%, 100% 50%, 52% 88%, 52% 72%, 0 72%, 14% 50%);
  background: linear-gradient(90deg, #5f1714 0%, #9e241f 32%, #efc66c 72%, #fff1bf 100%);
  box-shadow:
    inset 0 0 0 3px #551611,
    inset 0 0 0 7px rgba(255, 214, 144, 0.12);
}

body.wheel-focus .wheel-controls {
  justify-content: center;
}

body.wheel-focus .wheel-right-controls,
body.wheel-focus #btn-wheel-spin {
  display: none;
}

body.wheel-focus .wheel-result {
  text-align: center;
  font-size: 28px;
}

body.wheel-focus .wheel-debug {
  justify-content: center;
  font-size: 12px;
}

body.battle-focus .header,
body.battle-focus .panel--participants,
body.battle-focus .panel--history,
body.battle-focus .main-intro,
body.battle-focus .mode-tabs,
body.battle-focus #mode-quick,
body.battle-focus #mode-roulette,
body.battle-focus #mode-multi,
body.battle-focus #mode-wheel {
  display: none !important;
}

body.battle-focus .layout {
  max-width: none;
  min-height: 100vh;
  padding: 10px 14px;
  display: block;
}

body.battle-focus .panel--main {
  position: relative;
  width: min(1540px, 100%);
  height: calc(100vh - 20px);
  margin: 0 auto;
  z-index: 100;
  border: none;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(104, 70, 39, 0.16), transparent 52%),
    rgba(19, 12, 7, 0.985);
}

body.battle-focus #mode-battle {
  display: block !important;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: none;
  background: transparent;
}

body.battle-focus .battle-embed-shell,
body.battle-focus .battle-prototype-frame {
  min-height: 100%;
  height: 100%;
  border: none;
  border-radius: 24px;
}

.wheel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.battle-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.battle-embed-shell {
  position: relative;
  min-height: 430px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(176, 129, 73, 0.34);
  background:
    radial-gradient(circle at top center, rgba(247, 219, 160, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(45, 29, 16, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(39, 24, 13, 0.9), rgba(25, 16, 10, 0.96));
}

.battle-prototype-frame {
  display: block;
  width: 100%;
  min-height: 430px;
  border: 0;
  background: transparent;
}

.battlefield {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(176, 129, 73, 0.34);
  background:
    radial-gradient(circle at top center, rgba(247, 219, 160, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(45, 29, 16, 0.18), transparent 40%),
    linear-gradient(180deg, rgba(39, 24, 13, 0.9), rgba(25, 16, 10, 0.96));
}

.battlefield::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(112, 76, 40, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 76, 40, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.9), transparent 92%);
}

.battlefield-empty,
.battle-result {
  color: #f0d08d;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.battlefield-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.battle-fighter {
  position: absolute;
  width: 122px;
  padding: 10px 10px 8px;
  border-radius: 18px;
  border: 1px solid rgba(196, 154, 91, 0.24);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--fighter-tint) 18%, rgba(58, 35, 20, 0.88)), rgba(36, 22, 13, 0.94));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%);
  transition: transform 0.35s ease, opacity 0.35s ease, filter 0.35s ease, box-shadow 0.35s ease;
}

.battle-fighter-sprite {
  font-size: 32px;
  line-height: 1;
  text-align: center;
}

.battle-fighter-weapon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.battle-fighter-name {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 800;
  color: #f4e1b4;
  text-align: center;
}

.battle-fighter-role {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-soft);
  text-align: center;
}

.battle-fighter.is-targeted {
  transform: translate(-50%, -54%) scale(1.08);
  box-shadow: 0 0 0 1px rgba(224, 179, 90, 0.16), 0 0 28px rgba(224, 179, 90, 0.24);
}

.battle-fighter.is-eliminated {
  opacity: 0.18;
  filter: grayscale(1);
  transform: translate(-50%, -45%) scale(0.9);
}

.battle-fighter.is-winner {
  box-shadow: 0 0 0 1px rgba(237, 208, 145, 0.22), 0 0 36px rgba(224, 179, 90, 0.38);
  animation: battle-winner-pulse 1.6s ease-out infinite;
}

@keyframes battle-winner-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -53%) scale(1.06); }
}

.wheel-right-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.wheel-duration-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.game-duration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(166, 117, 66, 0.3);
  background: rgba(58, 36, 19, 0.35);
}

.wheel-duration-row label {
  color: var(--muted);
  font-size: 12px;
}

.game-duration-row label {
  color: var(--muted);
  font-size: 12px;
}

.duration-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-timer-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mode-timer {
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(214, 171, 101, 0.28);
  background: rgba(33, 21, 12, 0.55);
  color: #f2deb2;
  font-family: "Cinzel", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.08em;
}

.mode-timer[hidden] {
  display: none;
}

.timer-toggle {
  border: 1px solid rgba(166, 117, 66, 0.36);
  background: rgba(88, 56, 29, 0.42);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 11px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.timer-toggle:hover {
  color: var(--text);
  border-color: rgba(214, 171, 101, 0.34);
}

.duration-btn {
  border: 1px solid rgba(166, 117, 66, 0.36);
  background: rgba(88, 56, 29, 0.54);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.duration-btn:hover { color: var(--text); }

.duration-btn.active {
  color: #2b1609;
  border-color: rgba(237, 208, 145, 0.72);
  background: linear-gradient(180deg, #f1ddb3, #ddb96f, #b78343);
}

.winner-popup {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 10, 6, 0.48);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.winner-popup::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(620px, 90vw);
  height: min(260px, 44vw);
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(255, 203, 104, 0.34) 0%, rgba(255, 110, 88, 0.28) 38%, rgba(255, 70, 70, 0.16) 58%, transparent 78%);
  filter: blur(28px);
  opacity: 0.92;
  animation: winner-popup-backglow 1.7s ease-in-out infinite alternate;
  pointer-events: none;
}

.winner-popup[hidden] {
  display: none;
}

.winner-popup-card {
  position: relative;
  width: min(460px, 92vw);
  padding: 24px 24px 20px;
  border-radius: 18px;
  border: 1px solid rgba(224, 179, 90, 0.42);
  background:
    radial-gradient(circle at top, rgba(240, 225, 192, 0.12), transparent 45%),
    linear-gradient(180deg, rgba(73, 46, 25, 0.96), rgba(40, 24, 14, 0.98));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  text-align: center;
  animation: winner-popup-card-pulse 1.45s ease-in-out infinite alternate;
}

.winner-popup-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.winner-popup-confetti-piece {
  position: absolute;
  top: -12%;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(0.9);
  animation: confetti-fall 1.9s linear forwards;
  box-shadow: 0 0 10px rgba(255, 226, 158, 0.24);
}

.winner-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.winner-popup-kicker {
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd98f;
  text-shadow:
    0 0 12px rgba(255, 101, 101, 0.22),
    0 0 24px rgba(255, 207, 109, 0.26);
}

.winner-popup-title {
  margin-top: 8px;
  font-size: 28px;
  color: #f0d9a6;
}

.winner-popup-body {
  margin-top: 14px;
  font-family: "Cinzel", Georgia, serif;
  font-size: 34px;
  line-height: 1.35;
  font-weight: 700;
  color: #ffe5a4;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes winner-popup-backglow {
  0% {
    opacity: 0.72;
    filter: blur(24px);
    transform: translate(-50%, -50%) scale(0.96);
  }
  100% {
    opacity: 1;
    filter: blur(34px);
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes winner-popup-card-pulse {
  0% {
    transform: scale(0.975);
  }
  100% {
    transform: scale(1.02);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -4vh, 0) rotate(0deg) scale(0.9);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-x, 0), 122vh, 0) rotate(var(--confetti-rotate, 540deg)) scale(1);
  }
}

.multi-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(176, 129, 73, 0.36);
  border-radius: 18px;
  background: rgba(72, 45, 24, 0.54);
}

.multi-config label { color: var(--muted); }

.multi-count-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
}

.multi-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}


.multi-winner-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(176, 129, 73, 0.34);
  background: rgba(72, 45, 24, 0.38);
  animation: slideIn 0.24s ease;
}

.multi-winner-item .rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2b1609;
  background: linear-gradient(180deg, #efddb1, #ddb96f, #b78343);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.multi-winner-item:nth-child(1) .rank { background: var(--gold); }
.multi-winner-item:nth-child(2) .rank { background: #ccd6e4; }
.multi-winner-item:nth-child(3) .rank { background: #d58e60; }

.winner-name {
  font-size: 16px;
  font-weight: 700;
}

.history-helper {
  margin-top: 14px;
  margin-bottom: 2px;
  color: var(--muted-soft);
  font-size: 12px;
}

.history-item {
  margin-bottom: 8px;
  padding: 12px 13px;
  border-radius: 16px;
  border: 1px solid rgba(176, 129, 73, 0.34);
  background: rgba(72, 45, 24, 0.35);
}

.h-mode {
  color: var(--muted-soft);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.h-names {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.h-time {
  margin-top: 6px;
  color: var(--muted-soft);
  font-size: 11px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .panel--history {
    grid-column: 1 / -1;
    min-height: 240px;
  }
}

@media (max-width: 980px) {
  .header { padding: 14px 14px 6px; }

  .header-inner,
  .main-intro,
  .wheel-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .header-meta {
    justify-content: flex-start;
  }


  .layout {
    padding: 10px 14px 20px;
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel {
    min-height: 320px;
  }

  .panel--participants,
  .panel--history {
    max-height: 520px;
  }

  .mode-description {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .header-inner { padding: 18px; border-radius: 22px; }
  .logo { font-size: 32px; }
  .stat-pill { width: calc(50% - 5px); min-width: 0; }
  .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .participant-tools,
  .import-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .quick-winner { padding: 32px 24px; }
}





