@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@400;500;600;700;800&display=swap');

:root {
  --bg0: #07060f;
  --bg1: #0e0b1a;
  --pink: #ff2d6a;
  --pink2: #ff4f8b;
  --cyan: #2ef0ea;
  --text: #ffffff;
  --muted: rgba(255,255,255,.62);
  --seg-a: #9b1648;
  --seg-b: #5a0d2e;
  --seg-line: rgba(255,210,230,.55);
  --panel: rgba(18,12,28,.78);
  --glow-pink: 0 0 28px rgba(255,45,106,.55);
  --glow-cyan: 0 0 22px rgba(46,240,234,.35);
  --font: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
  --font-display: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font);
  font-weight: 400;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background-color: #07060f;
  background-image:
    linear-gradient(180deg, rgba(7,6,15,.35) 0%, rgba(7,6,15,.55) 100%),
    url('../assets/bg-cosmos.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255,45,106,.12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 18px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* —— Brand —— */
.brand { text-align: center; animation: fadeDown .65s ease both; }
.brand-title {
  display: block;
  width: min(340px, 78vw);
  height: auto;
  margin: 0 auto;
  background: transparent !important;
  /* ถ้ายังมีพิกเซลดำหลงเหลือ จะกลืนเข้ากับพื้นหลังมืด */
  mix-blend-mode: screen;
  filter: drop-shadow(0 6px 18px rgba(255,45,106,.35));
}
.brand p {
  margin-top: 8px;
  font-size: .95rem;
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.45;
  color: var(--muted);
}

/* —— User card —— */
.user-card {
  width: min(560px, 100%);
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(30,16,36,.9), rgba(14,10,22,.88));
  border: 1.5px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 1px rgba(255,45,106,.35),
    0 0 0 2px rgba(46,240,234,.18),
    0 14px 40px rgba(0,0,0,.4),
    inset 0 1px 0 rgba(255,255,255,.06);
  animation: fadeUp .65s .06s ease both;
}
.user-card label {
  display: block;
  font-family: var(--font-display);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0;
}
.user-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.spins-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(46,240,234,.14), rgba(255,45,106,.16));
  border: 1px solid rgba(46,240,234,.35);
  box-shadow: 0 0 18px rgba(46,240,234,.12);
  color: #fff;
  line-height: 1;
}
.spins-badge .spins-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
}
.spins-badge strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--cyan);
  min-width: 1.2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.spins-badge .spins-unit {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: rgba(255,255,255,.72);
}
.spins-badge.is-zero {
  border-color: rgba(255,143,173,.45);
  background: rgba(255,45,106,.12);
}
.spins-badge.is-zero strong { color: #ff8fad; }
.user-row { display: flex; gap: 10px; }
.user-row[hidden] { display: none !important; }
.login-gate {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 2px;
}
.login-gate-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.login-gate-text strong {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.login-gate-text span {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.4;
}
.login-gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #ff5a8c);
  color: #fff;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(255,45,106,.45);
}
.login-gate-btn:hover { filter: brightness(1.06); }
.login-gate-btn:active { transform: scale(.97); }
.input-wrap input[readonly] {
  opacity: .95;
  cursor: default;
}
.input-wrap {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.4);
}
.input-wrap:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,45,106,.18);
}
.input-ico { color: var(--pink2); display: flex; opacity: .9; }
.input-wrap input {
  flex: 1; min-width: 0;
  padding: 12px 0;
  border: none; outline: none;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
}
.user-row button {
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #ff5a8c);
  color: #fff;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(255,45,106,.45);
}
.user-row button:active { transform: scale(.97); }
.user-meta {
  margin-top: 10px;
  min-height: 20px;
  font-size: .88rem;
  color: var(--muted);
}
.user-meta strong { color: var(--cyan); }
.user-meta.err { color: #ff8fad; }

/* —— Play grid —— */
.play-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 20px;
  align-items: center;
  animation: fadeUp .7s .12s ease both;
}

.wheel-col { display: flex; justify-content: center; }

.wheel-stage {
  position: relative;
  width: min(400px, 88vw);
  aspect-ratio: 1;
}

.wheel-halo {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 56%, rgba(255,45,106,.4) 68%, rgba(46,240,234,.22) 76%, transparent 84%);
  filter: blur(1px);
  animation: spinSlow 18s linear infinite;
  pointer-events: none;
}

.wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.14), transparent 35%),
    linear-gradient(145deg, #2a1830, #0c0612);
  box-shadow:
    0 0 0 3px rgba(255,45,106,.75),
    0 0 0 7px rgba(12,6,18,.95),
    0 0 0 10px rgba(46,240,234,.4),
    0 0 40px rgba(255,45,106,.35),
    0 22px 50px rgba(0,0,0,.55),
    inset 0 0 40px rgba(0,0,0,.45);
}

.wheel-lights {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}
.wheel-lights span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  transform-origin: center center;
  /* รัศมีตั้งจาก JS ให้ตรงวงจริง — อย่าใส่ translateX หลัง rotate */
  animation: lightBlink 1.1s calc(var(--i) * .05s) ease-in-out infinite;
}
.wheel-lights span:nth-child(odd) {
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink), 0 0 16px rgba(255,45,106,.65);
}
.wheel-lights span:nth-child(even) {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan), 0 0 16px rgba(46,240,234,.55);
}

.wheel {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  overflow: hidden;
  transition: transform 4.8s cubic-bezier(.12, .72, .08, 1);
  background: conic-gradient(
    /* เริ่มที่เข็มด้านบน ให้กลางแผ่นตรงกับป้าย 1–9 */
    from 0deg,
    var(--seg-a) 0deg 39.2deg,
    var(--seg-line) 39.2deg 40deg,
    var(--seg-b) 40deg 79.2deg,
    var(--seg-line) 79.2deg 80deg,
    var(--seg-a) 80deg 119.2deg,
    var(--seg-line) 119.2deg 120deg,
    var(--seg-b) 120deg 159.2deg,
    var(--seg-line) 159.2deg 160deg,
    var(--seg-a) 160deg 199.2deg,
    var(--seg-line) 199.2deg 200deg,
    var(--seg-b) 200deg 239.2deg,
    var(--seg-line) 239.2deg 240deg,
    var(--seg-a) 240deg 279.2deg,
    var(--seg-line) 279.2deg 280deg,
    var(--seg-b) 280deg 319.2deg,
    var(--seg-line) 319.2deg 320deg,
    #7a123a 320deg 359.2deg,
    var(--seg-line) 359.2deg 360deg
  );
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
}
.wheel.spinning { pointer-events: none; }

#segLabels {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* แผ่นหมุนเต็มวง — หมุนรอบศูนย์กลางจริง แล้ววางป้ายชิดขอบนอกกลางช่อง */
.seg-label {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
}
.seg-label-inner {
  position: absolute;
  left: 50%;
  /* โซนขอบนอกกลางแผ่น — ใส่รูปรางวัล */
  top: 6.5%;
  width: 3.8rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  text-align: center;
  box-sizing: border-box;
}
.seg-box {
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  font-size: .6rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 8px rgba(0,0,0,.55);
}
.seg-box .seg-name {
  width: 100%;
  font-family: var(--font-display);
  font-size: .54rem;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg-box img,
.seg-box .seg-img {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.45);
  mix-blend-mode: normal;
}
.seg-img-ph {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1.5px dashed rgba(255,255,255,.28);
  box-shadow: none;
}

.pointer {
  position: absolute;
  top: -24px; left: 50%;
  width: 54px; height: 72px;
  transform: translateX(-50%);
  z-index: 5;
  background: transparent;
  filter: drop-shadow(0 8px 16px rgba(255,45,106,.6));
  animation: pointerBob 2.2s ease-in-out infinite;
  pointer-events: none;
}
.pointer img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: transparent;
}

.spin-btn {
  position: absolute;
  left: 50%; top: 50%;
  width: 96px; height: 96px;
  transform: translate(-50%, -50%);
  border: none; border-radius: 50%; padding: 0;
  cursor: pointer; z-index: 4;
  background:
    url('../assets/spin-btn.png') center/cover no-repeat,
    radial-gradient(circle at 35% 30%, #3a2438, #0a0610);
  box-shadow:
    0 0 0 4px rgba(255,45,106,.85),
    0 0 0 8px rgba(46,240,234,.3),
    0 10px 28px rgba(0,0,0,.55),
    var(--glow-pink);
  transition: transform .15s ease, filter .2s;
}
.spin-btn::after {
  content: 'SPIN';
  position: absolute;
  left: 50%; bottom: 15px;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.85);
}
.spin-btn:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.05);
  filter: brightness(1.08);
}
.spin-btn:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(.96);
}
.spin-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(.2) brightness(.8);
  opacity: .78;
}

/* —— Winners —— */
.winners-card {
  height: min(400px, 88vw);
  max-height: 400px;
  padding: 16px 14px;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(28,14,34,.92), rgba(12,8,20,.9));
  border: 1.5px solid transparent;
  box-shadow:
    0 0 0 1px rgba(255,45,106,.45),
    0 0 0 2px rgba(46,240,234,.2),
    0 16px 40px rgba(0,0,0,.4),
    inset 0 1px 0 rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.winners-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.winners-head .trophy { font-size: 1.15rem; filter: drop-shadow(0 0 8px rgba(255,45,106,.5)); }
.winners-head h2 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: linear-gradient(90deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.winners-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.winners-list::-webkit-scrollbar { width: 4px; }
.winners-list::-webkit-scrollbar-thumb { background: rgba(255,45,106,.4); border-radius: 4px; }

.winner-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.05);
}
.winner-rank {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,45,106,.15);
  border: 1px solid rgba(255,45,106,.35);
  font-size: .78rem;
  font-weight: 800;
  color: var(--pink2);
}
.winner-user {
  font-size: .88rem;
  font-weight: 700;
  color: rgba(255,255,255,.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.winner-prize {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--cyan);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.winner-prize .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  box-shadow: 0 0 8px rgba(255,45,106,.6);
  flex-shrink: 0;
}
.winners-empty {
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  padding: 28px 8px;
}

/* —— Footer bits —— */
.info-bar {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(16,10,24,.78);
  border: 1px solid rgba(255,45,106,.4);
  box-shadow:
    0 0 0 1px rgba(46,240,234,.12),
    0 10px 28px rgba(0,0,0,.28);
  animation: fadeUp .7s .2s ease both;
}
.info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255,255,255,.9);
  font-family: var(--font-display);
  font-size: clamp(.74rem, 2.4vw, .84rem);
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .15s, transform .15s, box-shadow .15s;
  text-align: center;
  line-height: 1.25;
}
.info-btn span {
  display: block;
}
.info-btn:hover {
  background: rgba(255,45,106,.14);
  box-shadow: inset 0 0 0 1px rgba(255,45,106,.25);
}
.info-btn:active { transform: scale(.98); }
.info-btn i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink);
  flex-shrink: 0;
  margin-top: 1px;
}

.info-modal-box {
  width: min(440px, 100%);
  text-align: left;
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.info-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.info-modal-head h2 {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: .03em;
  margin: 0 !important;
  line-height: 1.35;
  background: linear-gradient(90deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.info-modal-box .info-modal-x {
  flex-shrink: 0;
  width: 36px !important;
  height: 36px;
  min-width: 36px;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.06) !important;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.info-modal-box .info-modal-x:hover {
  background: rgba(255,45,106,.2) !important;
  border-color: rgba(255,45,106,.45);
}
.info-modal-body {
  overflow-y: auto;
  flex: 1;
  font-size: .9rem;
  color: rgba(255,255,255,.86);
  line-height: 1.55;
  padding: 14px 16px 16px;
}
.info-modal-foot {
  padding: 0 16px 16px;
  flex-shrink: 0;
}
.info-modal-foot .info-ok {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #ff5a8c);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255,45,106,.35);
}
.info-modal-body .prize-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.info-modal-body .prize-row {
  display: grid;
  grid-template-columns: 36px 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.info-modal-body .prize-row .n {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,45,106,.18);
  color: var(--pink2);
  font-weight: 800;
  font-size: .8rem;
}
.info-modal-body .prize-row img {
  width: 40px; height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
}
.info-modal-body .prize-row .ph {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.35);
  font-size: .7rem;
}
.info-modal-body .cond-text {
  white-space: pre-wrap;
  background: rgba(0,0,0,.25);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.06);
  line-height: 1.65;
}
.info-modal-body .hist-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .86rem;
}
.info-modal-body .hist-row:last-child { border-bottom: none; }
.info-modal-body .muted { color: var(--muted); font-size: .82rem; }
.info-modal-body .empty-msg {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px 12px;
  line-height: 1.55;
}
.info-modal-body .empty-state {
  text-align: center;
  padding: 18px 8px 8px;
}
.info-modal-body .empty-state .ico {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,45,106,.12);
  border: 1px solid rgba(255,45,106,.3);
  font-size: 1.35rem;
}
.info-modal-body .empty-state b {
  display: block;
  color: #fff;
  font-size: .98rem;
  margin-bottom: 6px;
}
.info-modal-body .empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 800;
  text-decoration: none;
  color: #fff;
  text-shadow: 0 0 20px rgba(255,45,106,.55);
  animation: fadeUp .7s .25s ease both;
}
.cta span {
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(46,240,234,.7);
  transition: transform .2s;
}
.cta:hover span { transform: translateX(4px); }

.admin-link {
  font-size: .78rem;
  color: rgba(46,240,234,.7);
  text-decoration: none;
}
.admin-link:hover { color: var(--cyan); text-decoration: underline; }

/* —— Modal —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5,3,10,.75);
  backdrop-filter: blur(8px);
}
.modal.open {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.modal-box {
  width: min(360px, 100%);
  margin: 0 auto;
  padding: 28px 22px 22px;
  border-radius: 22px;
  background: linear-gradient(165deg, #241428, #120a16);
  border: 1px solid rgba(255,45,106,.4);
  box-shadow: 0 0 40px rgba(255,45,106,.22), 0 24px 60px rgba(0,0,0,.5);
  text-align: center;
  animation: popIn .35s cubic-bezier(.2,1.2,.4,1);
}
.result-modal-box {
  position: relative;
  overflow: hidden;
  width: min(380px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 26px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.result-modal-box .result-glow {
  position: absolute;
  left: 50%;
  top: -30%;
  width: 140%;
  height: 70%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 40%, rgba(255,45,106,.35), transparent 62%);
  pointer-events: none;
}
.result-eyebrow {
  position: relative;
  width: 100%;
  margin: 0 0 14px !important;
  font-family: var(--font-display);
  font-size: .76rem !important;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cyan) !important;
  text-align: center;
  text-shadow: 0 0 14px rgba(46,240,234,.35);
}
.result-prize-visual {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.14), transparent 50%),
    linear-gradient(160deg, rgba(255,45,106,.25), rgba(46,240,234,.1));
  box-shadow:
    0 0 0 3px rgba(255,45,106,.55),
    0 0 0 8px rgba(46,240,234,.14),
    0 14px 36px rgba(0,0,0,.45),
    inset 0 0 24px rgba(0,0,0,.25);
  animation: resultPop .45s cubic-bezier(.2,1.2,.4,1) both;
}
.result-prize-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
  background: transparent;
}
.result-prize-ph {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.15);
}
.result-modal-box h2 {
  position: relative;
  width: 100%;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4.5vw, 1.7rem) !important;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.25;
  margin: 0 0 6px !important;
  background: linear-gradient(90deg, #fff 10%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  filter: drop-shadow(0 0 18px rgba(46,240,234,.35));
}
.result-meta-row {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0 12px;
}
.result-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(46,240,234,.1);
  border: 1px solid rgba(46,240,234,.35);
  color: rgba(255,255,255,.78);
  font-size: .84rem;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1;
}
.result-chip strong {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--cyan);
  min-width: 1.2ch;
  text-align: center;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-note {
  position: relative;
  width: 100%;
  margin: 0 0 18px !important;
  font-size: .74rem !important;
  font-weight: 400;
  letter-spacing: .015em;
  line-height: 1.55;
  color: rgba(255,255,255,.48) !important;
  text-align: center !important;
}
.modal-box .trophy {
  width: 72px; height: 72px; margin: 0 auto 12px;
  border-radius: 16px; object-fit: contain;
  background: rgba(255,255,255,.06);
}
.modal-box h2 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.modal-box .prize-name {
  width: 100%;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.35;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 6px 0 4px;
  text-align: center;
}
.modal-box p { color: var(--muted); font-size: .9rem; font-weight: 400; letter-spacing: .015em; line-height: 1.5; margin-bottom: 18px; text-align: center; }
.modal-box > button#closeModal {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #ff5a8c);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255,45,106,.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
@keyframes resultPop {
  from { opacity: 0; transform: scale(.72); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 16px rgba(255,45,106,.45), 0 0 28px rgba(46,240,234,.2); }
  50% { box-shadow: 0 0 28px rgba(255,45,106,.75), 0 0 40px rgba(46,240,234,.4); }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes lightBlink {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}
@keyframes pointerBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.86); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 820px) {
  .play-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .winners-card {
    width: min(400px, 100%);
    height: auto;
    max-height: 320px;
  }
  .info-bar {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .info-btn { justify-content: flex-start; padding-left: 14px; }
}

@media (max-width: 400px) {
  .seg-box { max-width: 72px; font-size: .55rem; }
  .spin-btn { width: 82px; height: 82px; }
}
