@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;800&family=Orbitron:wght@600;700;800&family=Rajdhani:wght@500;700&display=swap');

:root {
  --bg: #06111f;
  --bg-deep: #030811;
  --surface: rgba(7, 20, 37, 0.78);
  --surface-strong: rgba(9, 25, 46, 0.95);
  --surface-soft: rgba(12, 28, 52, 0.62);
  --line: rgba(125, 173, 219, 0.22);
  --line-strong: rgba(125, 173, 219, 0.42);
  --text: #eaf5ff;
  --text-muted: #8aa3bd;
  --accent: #49d9ff;
  --accent-warm: #ffb05e;
  --accent-hot: #ff7068;
  --success: #8bf6c8;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  --card-shadow: 0 18px 40px rgba(4, 7, 16, 0.4);
  --panel-radius: 28px;
  --card-radius: 22px;
  --max-width: 1560px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: 'Noto Sans SC', sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(73, 217, 255, 0.2), transparent 28%),
    radial-gradient(circle at 87% 14%, rgba(255, 176, 94, 0.15), transparent 24%),
    radial-gradient(circle at 50% 110%, rgba(73, 217, 255, 0.14), transparent 36%),
    linear-gradient(160deg, #08101b 0%, #06111f 36%, #030811 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(100, 172, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 172, 255, 0.06) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), transparent 82%);
}

body::after {
  opacity: 0.26;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 0 1px, transparent 1.6px);
  background-size: 32px 32px;
}

.app-shell {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: linear-gradient(180deg, rgba(11, 24, 45, 0.92), rgba(6, 18, 32, 0.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(73, 217, 255, 0.14), transparent 22%),
    linear-gradient(315deg, rgba(255, 176, 94, 0.1), transparent 25%);
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.85fr);
  gap: 24px;
  padding: 30px;
  margin-bottom: 24px;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.panel-kicker,
.metric-label,
.status-label,
.history-meta,
.group-chip,
.group-stat,
.panel-note,
.status-subline {
  color: var(--text-muted);
}

.eyebrow,
.panel-kicker,
.metric-label,
.history-meta,
.group-chip,
.group-stat {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
}

.hero h1,
.panel h2,
.status-card h3 {
  margin: 0;
}

.hero h1 {
  margin-top: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  color: #cadcf0;
  font-size: 1.02rem;
  line-height: 1.75;
}

.hero-stats {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.metric-card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(11, 31, 56, 0.88), rgba(7, 20, 38, 0.82));
  backdrop-filter: blur(14px);
}

.metric-value {
  display: block;
  margin-top: 12px;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: #fff8ec;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(290px, 0.94fr) minmax(520px, 1.42fr) minmax(280px, 0.84fr);
  gap: 24px;
  align-items: start;
}

.groups-panel,
.stage-panel,
.history-panel {
  padding: 24px;
}

.panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-head h2 {
  margin-top: 6px;
  font-size: 1.6rem;
}

.panel-note,
.status-subline {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
}

.group-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.group-card {
  position: relative;
  padding: 18px 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, rgba(10, 24, 43, 0.94), rgba(7, 17, 31, 0.86));
  cursor: pointer;
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: rgba(73, 217, 255, 0.44);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.group-card.is-active {
  border-color: rgba(73, 217, 255, 0.66);
  background:
    linear-gradient(180deg, rgba(15, 38, 68, 0.98), rgba(8, 18, 34, 0.88)),
    linear-gradient(135deg, rgba(73, 217, 255, 0.12), transparent);
  box-shadow: 0 0 0 1px rgba(73, 217, 255, 0.22), 0 20px 38px rgba(0, 0, 0, 0.28);
}

.group-card.is-complete {
  border-color: rgba(139, 246, 200, 0.38);
}

.group-card-header,
.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.group-card h3 {
  margin: 6px 0 0;
  font-size: 1.08rem;
}

.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.group-index {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 176, 94, 0.34);
  background: rgba(255, 176, 94, 0.08);
  color: #ffe2bd;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.group-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(73, 217, 255, 0.3);
  background: rgba(73, 217, 255, 0.08);
  color: #dffaff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.member-tag {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(125, 173, 219, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #d7e7f8;
  font-size: 0.92rem;
  line-height: 1;
  transition:
    opacity 200ms ease,
    border-color 200ms ease,
    background 200ms ease;
}

.member-name {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
}

.member-id {
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  line-height: 1;
}

.member-tag.is-drawn {
  border-color: rgba(139, 246, 200, 0.22);
  background: rgba(139, 246, 200, 0.08);
  color: rgba(215, 231, 248, 0.58);
  text-decoration: line-through;
}

.member-tag.is-excluded {
  border-style: dashed;
  border-color: rgba(255, 112, 104, 0.26);
  background: rgba(255, 112, 104, 0.08);
  color: #ffd5d1;
}

.member-tag.is-excluded .member-id {
  color: rgba(255, 219, 216, 0.74);
}

.group-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.stage-panel {
  min-height: 780px;
}

.stage-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(250px, 0.82fr);
  gap: 20px;
  align-items: stretch;
}

.draw-stage,
.status-stack {
  min-height: 640px;
}

.draw-stage {
  position: relative;
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(125, 173, 219, 0.14);
  background: linear-gradient(180deg, rgba(5, 16, 30, 0.94), rgba(4, 9, 17, 0.96));
  overflow: hidden;
}

.draw-scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 600px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 22%, rgba(73, 217, 255, 0.16), transparent 30%),
    radial-gradient(circle at 50% 78%, rgba(255, 176, 94, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(3, 10, 18, 0.96), rgba(6, 12, 22, 0.96));
  border: 1px solid rgba(125, 173, 219, 0.1);
  perspective: 1800px;
  perspective-origin: 50% 42%;
  overflow: hidden;
}

.scene-backlight {
  position: absolute;
  inset: auto 50% 12% auto;
  width: 420px;
  height: 420px;
  transform: translateX(50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(73, 217, 255, 0.34), rgba(73, 217, 255, 0.02) 60%, transparent 70%);
  filter: blur(22px);
}

.scene-floor {
  position: absolute;
  inset: auto 0 -10% 0;
  height: 46%;
  transform: rotateX(76deg) translateY(42px);
  transform-origin: center top;
  background:
    linear-gradient(rgba(73, 217, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 217, 255, 0.12) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent 86%);
  opacity: 0.66;
}

.energy-core {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 148px;
  height: 148px;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

.core-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(73, 217, 255, 0.18);
  box-shadow: inset 0 0 24px rgba(73, 217, 255, 0.12);
}

.ring-a {
  animation: slowSpin 18s linear infinite;
}

.ring-b {
  inset: 12px;
  border-color: rgba(255, 176, 94, 0.22);
  transform: rotateX(78deg);
  animation: reverseSpin 10s linear infinite;
}

.ring-c {
  inset: 22px;
  border-color: rgba(73, 217, 255, 0.32);
  transform: rotateY(76deg);
  animation: slowSpin 8s linear infinite;
}

.core-label {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.18em;
  color: #effcff;
}

.draw-beam {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 130px;
  height: 74%;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0),
    rgba(73, 217, 255, 0.08) 12%,
    rgba(73, 217, 255, 0.16) 54%,
    rgba(255, 176, 94, 0.18) 86%,
    rgba(255, 255, 255, 0)
  );
  filter: blur(18px);
  opacity: 0.5;
  transition:
    opacity 280ms ease,
    filter 280ms ease;
}

.draw-beam.is-active {
  opacity: 1;
  filter: blur(10px);
}

.draw-orbit {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 3400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.draw-orbit.is-drawing {
  filter: drop-shadow(0 0 36px rgba(73, 217, 255, 0.24));
}

.orbit-card {
  --card-width: 174px;
  --card-height: 226px;
  position: absolute;
  left: 50%;
  top: 48%;
  width: var(--card-width);
  height: var(--card-height);
  margin-left: calc(var(--card-width) * -0.5);
  margin-top: calc(var(--card-height) * -0.5);
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(125, 173, 219, 0.28);
  background:
    linear-gradient(180deg, rgba(13, 38, 68, 0.94), rgba(6, 18, 32, 0.9)),
    linear-gradient(135deg, rgba(73, 217, 255, 0.08), transparent 58%);
  box-shadow: var(--card-shadow);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  overflow: hidden;
  transition:
    opacity 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    filter 220ms ease;
}

.orbit-card::before {
  content: '';
  position: absolute;
  inset: 12px 12px auto 12px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(73, 217, 255, 0.18), rgba(255, 176, 94, 0.12));
  opacity: 0.86;
}

.orbit-card::after {
  content: '';
  position: absolute;
  inset: auto 24px 18px 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
}

.orbit-card.is-drawn {
  opacity: 0.42;
  filter: grayscale(0.28);
}

.orbit-card.is-target {
  border-color: rgba(255, 176, 94, 0.66);
  box-shadow:
    0 0 0 1px rgba(255, 176, 94, 0.2),
    0 18px 42px rgba(255, 176, 94, 0.18);
}

.orbit-card.is-winner {
  border-color: rgba(255, 255, 255, 0.66);
  box-shadow:
    0 0 0 1px rgba(73, 217, 255, 0.32),
    0 0 36px rgba(73, 217, 255, 0.3),
    0 24px 56px rgba(0, 0, 0, 0.38);
}

.orbit-card-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.orbit-card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  background: rgba(6, 11, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.orbit-card-status {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.76rem;
  color: #eef7ff;
  letter-spacing: 0.12em;
}

.orbit-card h4 {
  position: relative;
  z-index: 1;
  margin: 92px 0 0;
  font-size: 1.36rem;
  letter-spacing: 0.02em;
}

.orbit-card p {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #c7dbf0;
}

.status-stack {
  display: grid;
  gap: 16px;
}

.status-card {
  padding: 22px 22px 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 24, 43, 0.94), rgba(7, 17, 31, 0.88));
  min-height: 150px;
}

.status-card h3 {
  margin-top: 12px;
  font-size: 1.48rem;
}

.winner-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.winner-placeholder {
  margin-top: 16px;
  color: #d6e5f4;
  font-size: 0.98rem;
}

.winner-lockup {
  margin-top: 14px;
}

.winner-order {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 176, 94, 0.28);
  background: rgba(255, 176, 94, 0.08);
  color: #ffe1b6;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.12em;
}

.winner-name {
  margin: 18px 0 8px;
  font-size: 2rem;
  font-weight: 800;
}

.winner-group {
  margin: 0;
  color: #c7dbf0;
  font-size: 1rem;
}

.winner-id {
  margin-top: 8px;
  color: #fff0d8;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.02rem;
  letter-spacing: 0.14em;
}

.winner-time {
  margin-top: 14px;
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.16em;
}

.control-card {
  min-height: 0;
}

.control-bar {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.primary-button,
.secondary-button,
.ghost-button {
  position: relative;
  padding: 14px 18px;
  border-radius: 16px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
}

.primary-button {
  color: #04111f;
  font-weight: 800;
  background: linear-gradient(135deg, #49d9ff, #9af0ff);
  box-shadow: 0 16px 36px rgba(73, 217, 255, 0.2);
}

.secondary-button {
  color: #fff2e1;
  border: 1px solid rgba(255, 176, 94, 0.32);
  background: linear-gradient(135deg, rgba(255, 176, 94, 0.18), rgba(255, 176, 94, 0.08));
}

.ghost-button {
  color: #dbefff;
  border: 1px solid rgba(125, 173, 219, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.history-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid rgba(125, 173, 219, 0.14);
  background: linear-gradient(180deg, rgba(10, 24, 43, 0.9), rgba(6, 16, 30, 0.84));
}

.history-item strong {
  display: block;
  margin-top: 12px;
  font-size: 1.3rem;
}

.history-item p {
  margin: 10px 0 0;
  color: #c8dbef;
  font-size: 0.94rem;
}

.history-id {
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.12em;
}

.history-time {
  margin-top: 12px;
  font-family: 'Rajdhani', sans-serif;
  color: var(--text-muted);
  letter-spacing: 0.16em;
}

.history-empty {
  padding: 30px 20px;
  border-radius: 22px;
  border: 1px dashed rgba(125, 173, 219, 0.24);
  background: rgba(255, 255, 255, 0.02);
  color: #d3e4f6;
  text-align: center;
  line-height: 1.8;
}

@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes reverseSpin {
  from {
    transform: rotateX(78deg) rotate(0deg);
  }

  to {
    transform: rotateX(78deg) rotate(-360deg);
  }
}

@keyframes pulseFlash {
  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 1;
  }
}

.is-pulsing {
  animation: pulseFlash 820ms ease-in-out infinite;
}

@media (max-width: 1360px) {
  .dashboard {
    grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.18fr);
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1120px) {
  .hero,
  .stage-layout,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .draw-stage,
  .status-stack {
    min-height: 0;
  }

  .stage-panel {
    min-height: 0;
  }

  .draw-scene {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, var(--max-width));
    padding-top: 18px;
  }

  .hero,
  .groups-panel,
  .stage-panel,
  .history-panel {
    padding: 18px;
  }

  .panel-head {
    align-items: start;
    flex-direction: column;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .draw-stage {
    padding: 12px;
  }

  .draw-scene {
    min-height: 460px;
  }

  .orbit-card {
    --card-width: 142px;
    --card-height: 198px;
    padding: 16px;
  }

  .orbit-card h4 {
    margin-top: 78px;
    font-size: 1.1rem;
  }
}
