@font-face {
  font-family: "SystemCondensed";
  src: local("Arial Narrow"), local("Impact");
  font-display: swap;
}

:root {
  --bg: #050505;
  --line: rgba(235,235,235,.82);
  --line-strong: rgba(255,255,255,.96);
  --white: #f4f4f4;
  --muted: #9a9a9a;
  --red: #ff1738;
  --yellow: #ffdf28;
  --panel: #0c0c0e;
  --panel-2: #141416;
  --blue: #5ab7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

.display-body {
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.07), transparent 28%),
    linear-gradient(180deg, #000 0%, #070707 55%, #000 100%);
  color: var(--white);
  overflow: hidden;
  font-family: Impact, "Arial Narrow", "SystemCondensed", Arial, sans-serif;
}

.stage {
  width: min(96vw, 1240px);
  height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2vw, 28px);
}

.draw-board {
  width: min(95vw, 920px);
  background: rgba(0,0,0,.94);
  border: 3px solid var(--line-strong);
  border-radius: 12px;
  padding: clamp(16px, 2.3vw, 28px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.25),
    0 0 22px rgba(255,255,255,.42),
    inset 0 0 36px rgba(255,255,255,.03);
}

.draw-board-detail {
  max-width: 700px;
}

.draw-board-simple {
  max-width: 790px;
}

.hidden {
  display: none !important;
}

.top-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin-bottom: 16px;
}

.simple-top {
  grid-template-columns: 1fr 230px;
  gap: 12px;
  margin-bottom: 28px;
}

.live-title,
.yellow-box,
.section-title {
  min-height: 64px;
  border: 3px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(24px, 3.2vw, 42px);
  letter-spacing: -.04em;
  line-height: 1;
  text-shadow:
    2px 2px 0 rgba(0,115,255,.42),
    -2px 0 0 rgba(255,0,0,.25),
    0 0 11px rgba(255,255,255,.25);
}

.draw-board-detail .live-title,
.draw-board-detail .yellow-box {
  min-height: 62px;
  font-size: clamp(21px, 2.2vw, 32px);
}

.red {
  color: var(--red);
  text-shadow:
    0 0 12px rgba(255,23,56,.55),
    2px 1px 0 rgba(255,255,255,.28);
}

.yellow-box {
  color: var(--yellow);
  text-shadow:
    0 0 13px rgba(255,223,40,.42),
    2px 2px 0 rgba(255,0,0,.18);
}

.rank-grid {
  display: grid;
  border: 2px solid var(--line);
}

.detail-rank {
  grid-template-columns: 45% 55%;
  grid-template-rows: repeat(3, 86px);
}

.simple-rank {
  grid-template-columns: 45% 55%;
  grid-template-rows: repeat(3, 160px);
}

.rank-label,
.result-cell {
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  min-width: 0;
}

.rank-label {
  font-size: clamp(30px, 4.5vw, 58px);
  text-shadow:
    2px 2px 0 rgba(0,125,255,.42),
    -2px 0 0 rgba(255,0,0,.28),
    0 0 10px rgba(255,255,255,.4);
}

.result-cell {
  position: relative;
  overflow: hidden;
  font-size: clamp(30px, 4.8vw, 62px);
  line-height: 1;
  letter-spacing: .08em;
  text-shadow:
    2px 2px 0 rgba(0,125,255,.45),
    -2px 0 0 rgba(255,0,0,.3),
    0 0 15px rgba(255,255,255,.28);
}

.result-cell.flash {
  animation: cellFlash .55s ease both;
}

.result-cell.animating {
  box-shadow:
    inset 0 0 35px rgba(255,255,255,.09),
    0 0 22px rgba(255,255,255,.34);
}

.section-title {
  margin: 8px 0 7px;
  min-height: 62px;
  font-size: clamp(30px, 3vw, 44px);
}

.mini-grid {
  display: grid;
  gap: 0;
}

.like-grid {
  grid-template-columns: repeat(4, 1fr);
}

.subscribe-grid {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 58px);
}

.result-cell.mini {
  min-height: 54px;
  font-size: clamp(22px, 2.4vw, 34px);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 6px solid rgba(255,255,255,.20);
  border-top-color: rgba(255,255,255,.9);
  border-radius: 50%;
  animation: spin .72s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.55));
}

.result-digits {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .16em;
  max-width: 100%;
  flex-wrap: nowrap;
}

.result-digit {
  display: inline-block;
  min-width: .55em;
  transform-origin: center;
}

.result-digit.pop {
  animation: digitPop .42s cubic-bezier(.17, .84, .44, 1.4) both;
}

.roulette-digit {
  display: inline-grid;
  place-items: center;
  min-width: .72em;
  min-height: 1em;
  color: var(--yellow);
  transform: scale(1.18);
  text-shadow:
    0 0 20px rgba(255,223,40,.78),
    2px 2px 0 rgba(0,125,255,.35),
    -2px 0 0 rgba(255,0,0,.3);
}

.watermark {
  position: fixed;
  right: 14px;
  bottom: 10px;
  color: rgba(255,255,255,.18);
  letter-spacing: .18em;
  font: 700 11px/1 Arial, sans-serif;
  pointer-events: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes digitPop {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(.45) rotateX(70deg);
    filter: blur(4px);
  }
  55% {
    opacity: 1;
    transform: translateY(-5px) scale(1.28) rotateX(0);
    filter: blur(0);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes cellFlash {
  0% { background: rgba(255,255,255,.03); }
  45% { background: rgba(255,255,255,.16); }
  100% { background: transparent; }
}

/* Admin */
.admin-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(90,183,255,.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255,223,40,.08), transparent 28%),
    #09090b;
  color: #f4f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.admin-header {
  background: rgba(17,17,20,.92);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
  border-radius: 22px;
}

.login-card {
  width: min(430px, 100%);
  padding: 28px;
}

.login-eyebrow {
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
  margin-bottom: 8px;
}

.login-card h1,
.admin-header h1,
.panel h2 {
  margin: 0 0 14px;
  letter-spacing: -.04em;
}

.login-card label,
.panel label {
  display: block;
  margin: 16px 0 7px;
  font-size: 13px;
  font-weight: 800;
  color: #d7dbe3;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: #09090b;
  color: #fff;
  padding: 0 14px;
  outline: none;
  font: 600 15px/1.2 Inter, system-ui, Arial, sans-serif;
}

input:focus,
select:focus {
  border-color: rgba(90,183,255,.8);
  box-shadow: 0 0 0 4px rgba(90,183,255,.14);
}

.big-input {
  min-height: 62px;
  font-size: 28px;
  letter-spacing: .08em;
  font-weight: 900;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover,
.target-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, #ffe25d, #ffb800);
  color: #080808;
}

.ghost-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
}

.danger-btn {
  background: #e02b3f;
  color: #fff;
}

.danger-link {
  color: #ff7281;
  font-weight: 800;
  text-decoration: none;
}

.alert {
  padding: 12px 14px;
  background: rgba(224,43,63,.16);
  border: 1px solid rgba(224,43,63,.35);
  border-radius: 14px;
  color: #ffd8dd;
  margin-bottom: 14px;
}

.muted,
.help-text {
  color: #9ea5b5;
  line-height: 1.5;
  font-size: 13px;
}

.admin-shell {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 28px 0 50px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  margin-bottom: 18px;
}

.admin-header p {
  max-width: 760px;
  color: #aeb5c4;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  padding: 22px;
}

.selected-target {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  margin-bottom: 14px;
  color: #b8c0d0;
}

.selected-target strong {
  color: #fff;
}

.admin-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.target-btn {
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 950;
  cursor: pointer;
}

.target-btn:nth-child(1),
.target-btn:nth-child(2),
.target-btn:nth-child(3) {
  grid-column: span 4;
  font-size: 18px;
}

.target-btn.small {
  min-height: 48px;
  font-size: 12px;
}

.target-btn.active {
  background: rgba(255,223,40,.16);
  border-color: rgba(255,223,40,.75);
  color: #ffea78;
  box-shadow: 0 0 0 4px rgba(255,223,40,.08);
}

.button-row,
.inline {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.inline input {
  flex: 1;
}

.status-box,
.display-link-box {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: #d9deea;
  line-height: 1.5;
  word-break: break-word;
}

.display-link-box {
  margin-top: 14px;
}

code {
  color: #ffe25d;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .stage {
    padding: 10px;
  }

  .draw-board {
    padding: 12px;
  }

  .top-row,
  .simple-top {
    grid-template-columns: 1fr;
  }

  .detail-rank,
  .simple-rank {
    grid-template-rows: repeat(3, 104px);
  }

  .like-grid,
  .subscribe-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-preview {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .target-btn:nth-child(1),
  .target-btn:nth-child(2),
  .target-btn:nth-child(3) {
    grid-column: span 2;
  }

  .button-row,
  .inline {
    flex-direction: column;
  }
}
