@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Nunito:wght@400;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
   --cyan:       #00f5ff;
   --cyan-dim:   #00b8c4;
   --purple:     #9d4edd;
   --purple-dim: #6a0dad;
   --gold:       #f9c74f;
   --p1:         #00f5ff;
   --p2:         #c77dff;
   --deep:       #03001c;
   --navy:       #05002e;
}

body {
   min-height: 100vh;
   background: radial-gradient(ellipse at 20% 20%, #0d0030 0%, #03001c 40%, #000510 100%);
   display: flex;
   align-items: center;
   justify-content: center;
   font-family: 'Nunito', sans-serif;
   overflow-x: hidden;
   position: relative;
}

/* Starfield canvas */
#starfield {
   position: fixed;
   inset: 0;
   z-index: 0;
   pointer-events: none;
}

.hidden { display: none !important; }

.screen {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 100%;
   min-height: 100vh;
   padding: 20px;
   position: relative;
   z-index: 1;
}

/* ── Title ── */
.title-icon {
   font-size: 3rem; display: block; text-align: center;
   animation: orbit 4s ease-in-out infinite;
}
@keyframes orbit {
   0%,100% { transform: scale(1) rotate(-3deg); }
   50%      { transform: scale(1.12) rotate(3deg); }
}

.title {
   font-family: 'Orbitron', monospace;
   font-size: 2rem; font-weight: 900;
   background: linear-gradient(90deg, #00f5ff, #9d4edd, #f9c74f);
   -webkit-background-clip: text; -webkit-text-fill-color: transparent;
   background-clip: text; text-align: center; letter-spacing: 3px;
   text-shadow: none;
   filter: drop-shadow(0 0 12px rgba(0,245,255,0.35));
}
.title.small { font-size: 1.2rem; letter-spacing: 2px; }

.subtitle {
   color: rgba(0,245,255,0.6);
   font-size: 0.78rem; letter-spacing: 5px;
   text-transform: uppercase; text-align: center; margin-top: 6px;
}

/* ── Name Card ── */
.name-card {
   position: relative; z-index: 1;
   background: rgba(5, 0, 46, 0.7);
   border: 1px solid rgba(0,245,255,0.2);
   backdrop-filter: blur(20px);
   border-radius: 24px; padding: 40px 44px;
   display: flex; flex-direction: column;
   align-items: center; gap: 24px;
   min-width: 420px;
   box-shadow: 0 0 40px rgba(0,245,255,0.08), 0 0 80px rgba(157,78,221,0.06);
}

.name-fields { display: flex; align-items: center; gap: 14px; width: 100%; }
.name-field  { display: flex; flex-direction: column; gap: 8px; flex: 1; }

.name-label  { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 3px; font-family: 'Orbitron', monospace; }
.p1-color { color: var(--cyan); }
.p2-color { color: var(--p2); }

.name-input {
   background: rgba(0,245,255,0.04);
   border: 1px solid rgba(0,245,255,0.15);
   border-radius: 12px; padding: 12px 16px;
   color: white; font-size: 1rem;
   font-family: 'Nunito', sans-serif; font-weight: 600;
   outline: none; transition: border-color 0.25s, box-shadow 0.25s; width: 100%;
}
.name-input:focus {
   border-color: var(--cyan);
   box-shadow: 0 0 0 3px rgba(0,245,255,0.12), 0 0 12px rgba(0,245,255,0.2);
}
.name-input::placeholder { color: rgba(255,255,255,0.2); }

.vs-divider {
   font-size: 1.6rem; padding-top: 22px; flex-shrink: 0;
   animation: orbit 3s ease-in-out infinite;
}

/* Coins */
.coins-select { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.coins-label  { color: rgba(0,245,255,0.6); font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; }
.coins-options { display: flex; gap: 10px; }
.coin-btn {
   padding: 8px 18px; border-radius: 20px;
   border: 1px solid rgba(0,245,255,0.15);
   background: rgba(0,245,255,0.05); color: rgba(0,245,255,0.7);
   font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.9rem;
   cursor: pointer; transition: all 0.2s;
}
.coin-btn:hover { background: rgba(0,245,255,0.12); }
.coin-btn.active {
   background: linear-gradient(135deg, rgba(0,245,255,0.2), rgba(157,78,221,0.2));
   border-color: var(--cyan); color: var(--cyan);
   box-shadow: 0 0 14px rgba(0,245,255,0.25);
}

.diff-btn {
   padding: 8px 16px; border-radius: 20px;
   border: 1px solid rgba(0,245,255,0.15);
   background: rgba(0,245,255,0.05); color: rgba(0,245,255,0.7);
   font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.85rem;
   cursor: pointer; transition: all 0.2s;
}
.diff-btn:hover { background: rgba(0,245,255,0.12); }
.diff-btn.active {
   background: linear-gradient(135deg, rgba(0,245,255,0.2), rgba(157,78,221,0.2));
   border-color: var(--cyan); color: var(--cyan);
   box-shadow: 0 0 14px rgba(0,245,255,0.25);
}
.goal-hint { font-size: 0.72rem; opacity: 0.7; }

.goal-display {
   color: rgba(0,245,255,0.5); font-size: 0.75rem;
   letter-spacing: 2px; text-align: center; margin-top: 4px;
   font-family: 'Orbitron', monospace;
}

.name-error { color: #ff6b6b; font-size: 0.85rem; min-height: 20px; text-align: center; }

/* ── Buttons ── */
.start-btn {
   padding: 14px 44px; border-radius: 12px; border: none; cursor: pointer;
   font-size: 0.95rem; font-weight: 800; font-family: 'Orbitron', monospace;
   letter-spacing: 2px;
   background: linear-gradient(135deg, #00b8c4, #9d4edd);
   color: white;
   box-shadow: 0 0 24px rgba(0,245,255,0.3), 0 0 48px rgba(157,78,221,0.15);
   transition: transform 0.2s, box-shadow 0.2s;
}
.start-btn:hover { transform: scale(1.04); box-shadow: 0 0 36px rgba(0,245,255,0.45); }
.start-btn.small { padding: 11px 24px; font-size: 0.78rem; }
.start-btn.outline {
   background: transparent;
   border: 1px solid rgba(0,245,255,0.25); color: rgba(0,245,255,0.7);
   box-shadow: none;
}
.start-btn.outline:hover { background: rgba(0,245,255,0.07); box-shadow: none; }

/* ── Game Screen ── */
.container {
   position: relative; z-index: 1;
   display: flex; flex-direction: column;
   align-items: center; gap: 14px;
   padding: 20px 16px; width: 100%; max-width: 480px;
}

/* Scoreboard */
.scoreboard {
   display: flex; align-items: center; gap: 10px;
   background: rgba(5,0,46,0.6);
   border: 1px solid rgba(0,245,255,0.12);
   border-radius: 16px; padding: 10px 16px;
   width: 100%; justify-content: space-between;
   backdrop-filter: blur(12px);
}
.player-card { display: flex; align-items: center; gap: 10px; }
.player-avatar {
   width: 38px; height: 38px; border-radius: 50%;
   display: flex; align-items: center; justify-content: center;
   font-size: 1.1rem; flex-shrink: 0;
}
.p1-bg { background: radial-gradient(circle, #003d4d, #006980); border: 1px solid var(--cyan); box-shadow: 0 0 10px rgba(0,245,255,0.3); }
.p2-bg { background: radial-gradient(circle, #2d0060, #6a0dad); border: 1px solid var(--p2); box-shadow: 0 0 10px rgba(199,125,255,0.3); }
.player-info { display: flex; flex-direction: column; gap: 2px; }
.player-info.right { text-align: right; }
.player-name { font-size: 0.85rem; font-weight: 700; color: white; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-coins { font-size: 1rem; font-weight: 800; color: var(--gold); }
.player-card.active-turn .player-avatar { animation: glowPulse 1.5s ease-in-out infinite; }

@keyframes glowPulse {
   0%,100% { box-shadow: 0 0 10px rgba(0,245,255,0.3); }
   50%      { box-shadow: 0 0 22px rgba(0,245,255,0.7); }
}

.turn-indicator {
   font-size: 0.7rem; font-weight: 800;
   font-family: 'Orbitron', monospace;
   text-transform: uppercase; letter-spacing: 1px;
   color: var(--cyan);
   background: rgba(0,245,255,0.08);
   border: 1px solid rgba(0,245,255,0.25);
   border-radius: 20px; padding: 6px 12px; text-align: center;
   animation: glowPulse 2s ease-in-out infinite;
}

/* ── Machine ── */
.machine {
   background: linear-gradient(160deg, #08003a, #03001c, #050025);
   border: 2px solid rgba(0,245,255,0.25);
   border-radius: 20px; padding: 18px 22px; width: 100%;
   box-shadow:
      0 0 30px rgba(0,245,255,0.1),
      0 0 60px rgba(157,78,221,0.08),
      inset 0 0 30px rgba(0,0,0,0.5);
   position: relative;
}

.machine::before {
   content: '';
   position: absolute; inset: -1px;
   border-radius: 20px;
   background: linear-gradient(135deg, rgba(0,245,255,0.15), transparent, rgba(157,78,221,0.15));
   pointer-events: none; z-index: 0;
}

.machine-top { text-align: center; margin-bottom: 14px; position: relative; z-index: 1; }
.machine-title {
   font-family: 'Orbitron', monospace;
   color: var(--gold); font-size: 0.85rem; letter-spacing: 4px;
   text-shadow: 0 0 14px rgba(249,199,79,0.6);
}

.reels-window {
   display: flex; align-items: center; justify-content: center;
   background: #000510;
   border: 2px solid rgba(0,245,255,0.15);
   border-radius: 14px; padding: 8px 12px; height: 110px;
   overflow: hidden; position: relative; z-index: 1;
   box-shadow: inset 0 0 30px rgba(0,0,20,0.8), 0 0 20px rgba(0,245,255,0.05);
}

.reel-sep { color: rgba(0,245,255,0.2); font-size: 1rem; padding: 0 6px; }
.reel-container { width: 80px; height: 90px; overflow: hidden; position: relative; }
.reel { display: flex; flex-direction: column; align-items: center; }
.reel-symbol {
   width: 80px; height: 90px;
   display: flex; align-items: center; justify-content: center;
   font-size: 2.8rem; flex-shrink: 0;
   filter: drop-shadow(0 0 6px rgba(0,245,255,0.3));
}

.win-line {
   height: 2px; margin: 8px 0 4px;
   background: linear-gradient(90deg, transparent, rgba(0,245,255,0.6), transparent);
   border-radius: 2px; position: relative; z-index: 1;
}

.result-msg {
   text-align: center; font-size: 1rem; font-weight: 700;
   color: rgba(0,245,255,0.7); min-height: 28px;
   font-family: 'Orbitron', monospace; font-size: 0.85rem; letter-spacing: 1px;
   position: relative; z-index: 1;
}
.result-msg.win  { color: var(--gold); animation: winPop 0.4s ease; text-shadow: 0 0 16px rgba(249,199,79,0.7); }
.result-msg.lose { color: #ff6b6b; }

@keyframes winPop {
   0%   { transform: scale(0.8); }
   60%  { transform: scale(1.15); }
   100% { transform: scale(1); }
}

/* Controls */
.controls { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }

.bet-row {
   display: flex; align-items: center; gap: 12px;
   background: rgba(5,0,46,0.5);
   border: 1px solid rgba(0,245,255,0.12);
   border-radius: 30px; padding: 10px 20px;
}
.bet-label { color: rgba(0,245,255,0.6); font-size: 0.85rem; font-weight: 700; font-family: 'Orbitron', monospace; letter-spacing: 1px; }
.bet-adj {
   width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(0,245,255,0.2);
   background: rgba(0,245,255,0.07); color: var(--cyan);
   font-size: 1.1rem; cursor: pointer; transition: all 0.2s;
   display: flex; align-items: center; justify-content: center;
}
.bet-adj:hover { background: rgba(0,245,255,0.18); box-shadow: 0 0 10px rgba(0,245,255,0.25); }
.bet-adj:disabled { opacity: 0.25; cursor: default; }
.bet-amount { color: var(--gold); font-size: 1.3rem; font-weight: 800; min-width: 36px; text-align: center; font-family: 'Orbitron', monospace; }

.bet-quick {
   display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}

.bet-quick-btn {
   padding: 7px 14px; border-radius: 20px;
   border: 1px solid rgba(0,245,255,0.2);
   background: rgba(0,245,255,0.06); color: var(--cyan);
   font-family: 'Orbitron', monospace; font-size: 0.72rem; font-weight: 700;
   letter-spacing: 1px; cursor: pointer; transition: all 0.2s;
}
.bet-quick-btn:hover:not(:disabled) {
   background: rgba(0,245,255,0.18);
   box-shadow: 0 0 12px rgba(0,245,255,0.25);
   transform: scale(1.05);
}
.bet-quick-btn[data-amount="allin"] {
   background: rgba(157,78,221,0.12);
   border-color: rgba(157,78,221,0.35);
   color: var(--p2);
}
.bet-quick-btn[data-amount="allin"]:hover:not(:disabled) {
   background: rgba(157,78,221,0.25);
   box-shadow: 0 0 14px rgba(157,78,221,0.35);
}
.bet-quick-btn.minus {
   background: rgba(255,100,100,0.07);
   border-color: rgba(255,100,100,0.2);
   color: #ff8fa3;
}
.bet-quick-btn.minus:hover:not(:disabled) {
   background: rgba(255,100,100,0.18);
   box-shadow: 0 0 12px rgba(255,100,100,0.2);
   transform: scale(1.05);
}
.bet-quick-btn:disabled { opacity: 0.25; cursor: default; transform: none; }

.spin-btn {
   width: 100%;
   padding: 18px 15px;
   border-radius: 16px;
   border: 1px solid rgba(0,245,255,0.4);
   cursor: pointer;
   font-size: 1.1rem;
   font-weight: 900;
   font-family: 'Orbitron', monospace;
   letter-spacing: 4px;
   background: linear-gradient(135deg, #006d75 0%, #00b8c4 40%, #6a0dad 100%);
   color: white;
   text-shadow: 0 0 10px rgba(0,245,255,0.6);
   box-shadow:
      0 0 20px rgba(0,245,255,0.3),
      0 0 40px rgba(157,78,221,0.2),
      inset 0 1px 0 rgba(255,255,255,0.15);
   transition: transform 0.2s, box-shadow 0.2s;
   position: relative;
   overflow: hidden;
}
.spin-btn::after {
   content: '';
   position: absolute; inset: 0;
   background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
   transform: translateX(-100%);
   animation: shimmer 2s ease infinite;
}
@keyframes shimmer {
   0%   { transform: translateX(-100%); }
   100% { transform: translateX(100%); }
}
.spin-btn:hover:not(:disabled) {
   transform: scale(1.04) translateY(-2px);
   box-shadow:
      0 0 36px rgba(0,245,255,0.55),
      0 0 70px rgba(157,78,221,0.3),
      inset 0 1px 0 rgba(255,255,255,0.2);
}
.spin-btn:active:not(:disabled) {
   transform: scale(0.98) translateY(0px);
}
.spin-btn:disabled { opacity: 0.3; cursor: default; transform: none; box-shadow: none; }

/* Paytable */
.paytable-btn {
   background: none; border: 1px solid rgba(0,245,255,0.15);
   color: rgba(0,245,255,0.5); font-family: 'Nunito', sans-serif;
   font-size: 0.82rem; font-weight: 700; padding: 6px 18px;
   border-radius: 20px; cursor: pointer; transition: all 0.2s;
   letter-spacing: 1px;
}
.paytable-btn:hover { background: rgba(0,245,255,0.07); color: var(--cyan); }

.paytable {
   background: rgba(5,0,46,0.7);
   border: 1px solid rgba(0,245,255,0.12);
   border-radius: 14px; padding: 14px 20px;
   width: 100%; display: flex; flex-direction: column; gap: 8px;
   backdrop-filter: blur(10px);
}
.paytable-row {
   display: flex; justify-content: space-between;
   color: rgba(255,255,255,0.75); font-size: 0.85rem; font-weight: 600;
   padding: 4px 0; border-bottom: 1px solid rgba(0,245,255,0.06);
}
.paytable-row:last-child { border-bottom: none; }
.paytable-row span:last-child { color: var(--gold); font-weight: 800; font-family: 'Orbitron', monospace; font-size: 0.8rem; }

.menu-btn {
   background: none; border: none; color: rgba(0,245,255,0.25);
   font-family: 'Nunito', sans-serif; font-size: 0.82rem;
   cursor: pointer; transition: color 0.2s; letter-spacing: 1px;
}
.menu-btn:hover { color: rgba(0,245,255,0.6); }

/* Solo scoreboard stats */
.solo-board { justify-content: space-between; }

.solo-stats {
   display: flex;
   gap: 14px;
   align-items: center;
}

.solo-stat {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 2px;
   background: rgba(0,245,255,0.04);
   border: 1px solid rgba(0,245,255,0.1);
   border-radius: 10px;
   padding: 6px 12px;
   min-width: 54px;
}

.stat-label {
   font-size: 0.55rem;
   font-family: 'Orbitron', monospace;
   color: rgba(0,245,255,0.45);
   letter-spacing: 1px;
   text-transform: uppercase;
}

.stat-value {
   font-size: 0.95rem;
   font-weight: 800;
   color: var(--gold);
   font-family: 'Orbitron', monospace;
}

.stat-value.goal-val { color: var(--cyan); }

/* ── Modal ── */
.modal-overlay {
   position: fixed; inset: 0;
   background: rgba(0,0,10,0.88);
   display: flex; align-items: center; justify-content: center;
   z-index: 100; opacity: 0; pointer-events: none;
   transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
   background: linear-gradient(135deg, #08003a, #03001c);
   border: 2px solid rgba(0,245,255,0.3);
   border-radius: 24px; padding: 44px 48px; text-align: center;
   box-shadow: 0 0 60px rgba(0,245,255,0.15), 0 0 120px rgba(157,78,221,0.08);
   transform: scale(0.85); transition: transform 0.3s ease;
   min-width: 320px;
}
.modal-overlay.active .modal { transform: scale(1); }

.modal-emoji { font-size: 3.5rem; margin-bottom: 10px; display: block; animation: orbit 2s ease-in-out infinite; }
.modal-title {
   font-family: 'Orbitron', monospace;
   background: linear-gradient(90deg, #00f5ff, #9d4edd, #f9c74f);
   -webkit-background-clip: text; -webkit-text-fill-color: transparent;
   background-clip: text; font-size: 1.5rem; margin-bottom: 8px; letter-spacing: 2px;
}
.modal-msg { color: rgba(0,245,255,0.6); font-size: 0.9rem; margin-bottom: 18px; letter-spacing: 1px; }

.final-scores { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.final-score-row {
   display: flex; justify-content: space-between; align-items: center;
   background: rgba(0,245,255,0.04);
   border-radius: 12px; padding: 9px 16px;
   border: 1px solid rgba(0,245,255,0.08);
}
.winner-row { background: rgba(0,245,255,0.08); border-color: rgba(0,245,255,0.25); }
.final-score-name { font-weight: 700; color: white; font-size: 0.95rem; }
.final-score-coins { font-weight: 800; color: var(--gold); font-size: 1.1rem; font-family: 'Orbitron', monospace; }

.modal-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Mobile ── */
@media (max-width: 480px) {
   .name-card { min-width: unset; width: 100%; padding: 28px 18px; }
   .name-fields { flex-direction: column; gap: 12px; }
   .vs-divider { padding-top: 0; }
   .title { font-size: 1.4rem; }
   .reel-container { width: 65px; }
   .reel-symbol { width: 65px; font-size: 2.2rem; }
   .modal { min-width: unset; width: calc(100vw - 40px); padding: 32px 20px; }
   .modal-buttons { flex-direction: column; align-items: center; }
   .start-btn.small { width: 100%; text-align: center; }
}