:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
  background: #09132b;
  --panel: rgba(10, 22, 47, .78);
  --panel-2: rgba(17, 32, 65, .92);
  --line: rgba(255,255,255,.13);
  --text-soft: #9eb2da;
  --primary: #6d5dfc;
  --primary-2: #8b7cff;
  --yellow: #ffc83d;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(34,126,255,.25), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(177,55,255,.20), transparent 35%),
    linear-gradient(135deg, #071126, #0d1734 52%, #10112a);
}

button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.bg-orb { position: fixed; border-radius: 999px; filter: blur(90px); pointer-events: none; opacity: .35; }
.orb-a { width: 420px; height: 420px; background: #218cff; top: -180px; left: -120px; }
.orb-b { width: 520px; height: 520px; background: #8b35ff; right: -190px; bottom: -230px; }

.screen { min-height: 100vh; padding: 24px; position: relative; z-index: 1; }
.hidden { display: none !important; }
.center-screen { display: grid; place-items: center; align-content: center; gap: 28px; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.25); backdrop-filter: blur(22px); }

.brand-wrap { text-align: center; }
.logo { font-weight: 1000; letter-spacing: -4px; font-size: clamp(52px, 8vw, 94px); line-height: .92; text-shadow: 0 10px 35px rgba(0,0,0,.35); }
.logo span { color: var(--yellow); }
.logo.small { font-size: 28px; letter-spacing: -1.5px; }
.tagline { color: var(--text-soft); margin: 14px 0 0; font-weight: 700; }

.home-card { width: min(460px, 94vw); border-radius: 28px; padding: 28px; display: grid; gap: 14px; }
.field-label, .eyebrow { color: #8ea6d3; font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
input { width: 100%; padding: 16px 17px; border-radius: 14px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.07); color: #fff; outline: 0; font-weight: 800; }
input:focus { border-color: #8175ff; box-shadow: 0 0 0 4px rgba(109,93,252,.15); }
input::placeholder { color: #6f82aa; }
.primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 10px 28px rgba(92,74,252,.32); font-weight: 950; }
button { color: #dfe8ff; background: rgba(255,255,255,.09); padding: 13px 18px; border-radius: 14px; transition: transform .15s ease, filter .15s ease; font-weight: 850; }
button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.big { min-height: 52px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.join-row input { text-transform: uppercase; letter-spacing: .18em; }
.separator { display: flex; align-items: center; gap: 10px; color: #7084ac; font-size: 11px; }
.separator span { flex: 1; height: 1px; background: rgba(255,255,255,.10); }
.error { color: #ff8f9a; min-height: 20px; margin: 0; font-size: 13px; }
.muted { color: #8ea0c4; }

.topbar, .game-header { max-width: 1400px; margin: 0 auto; min-height: 70px; border-radius: 20px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.room-chip { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 9px 12px; color: #8ea6d3; font-size: 12px; }
.room-chip strong { color: #fff; letter-spacing: .13em; }

.lobby-layout { min-height: calc(100vh - 118px); display: grid; place-items: center; }
.lobby-card { width: min(680px, 96vw); border-radius: 30px; padding: 34px; display: grid; gap: 28px; }
.lobby-card h1, .winner-card h1, .minigame-card h1 { margin: 7px 0 8px; font-size: clamp(38px, 7vw, 68px); line-height: 1; letter-spacing: -2px; }
.lobby-card p { color: #a5b7db; }
.player-list { display: grid; gap: 10px; }
.player-row { background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 13px 15px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 -8px 12px rgba(0,0,0,.22), 0 5px 20px rgba(0,0,0,.18); border: 3px solid rgba(255,255,255,.32); }
.player-row b { flex: 1; }
.host-badge { font-size: 10px; color: #ffe18a; background: rgba(255,200,61,.12); padding: 6px 8px; border-radius: 8px; }

.game-header { margin-bottom: 18px; gap: 20px; }
.game-header > div:first-child { display: flex; align-items: center; gap: 20px; }
.round-label { color: #8ea0c4; font-size: 12px; }
.round-label b { color: #fff; }
.turn-banner { font-weight: 950; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); padding: 10px 18px; border-radius: 999px; text-align: center; }
.game-layout { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; height: calc(100vh - 130px); min-height: 620px; }
.score-panel { border-radius: 22px; padding: 18px; overflow: auto; }
.score-panel h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #91a7cf; }
.score-entry { display: grid; grid-template-columns: 34px 1fr; gap: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); padding: 10px; border-radius: 14px; margin-bottom: 9px; }
.score-entry.me { outline: 2px solid rgba(255,255,255,.16); }
.score-entry .avatar { width: 34px; height: 34px; grid-row: span 2; }
.score-name { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-values { color: #9cb0d8; font-size: 12px; display: flex; gap: 10px; }
.legend { margin-top: 20px; display: grid; gap: 10px; color: #8fa4cc; font-size: 12px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; }
.dot.plus { background: #3d9cff; }.dot.minus { background: #ff5e69; }.dot.chance { background: #9b63ff; }.dot.star { background: #ffd143; box-shadow: 0 0 16px rgba(255,209,67,.45); }

.board-shell { position: relative; min-width: 0; border-radius: 24px; overflow: hidden; background: linear-gradient(180deg, rgba(22,43,82,.82), rgba(9,22,48,.90)); }
#boardCanvas { width: 100%; height: 100%; display: block; }
.dice-box { position: absolute; right: 18px; bottom: 18px; padding: 12px; border-radius: 18px; background: rgba(5,14,32,.83); border: 1px solid rgba(255,255,255,.12); display: flex; gap: 10px; align-items: center; backdrop-filter: blur(12px); }
.dice { width: 54px; height: 54px; border-radius: 14px; background: #fff; color: #10182d; display: grid; place-items: center; font-size: 28px; font-weight: 1000; box-shadow: inset 0 -5px 0 #dbe1ed; }
.dice.rolling { animation: diceShake .15s infinite; }
@keyframes diceShake { 50% { transform: rotate(8deg) scale(1.04); } }
.action-toast { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(5,14,32,.84); border: 1px solid rgba(255,255,255,.10); border-radius: 999px; padding: 10px 16px; color: #dce6ff; font-size: 13px; max-width: 62%; text-align: center; backdrop-filter: blur(12px); }

#minigameScreen { display: grid; place-items: center; }
.minigame-card { width: min(760px, 94vw); padding: 38px; border-radius: 32px; text-align: center; }
.minigame-card p { color: #a7b9dd; }
.countdown { font-size: clamp(92px, 18vw, 170px); font-weight: 1000; line-height: 1; margin: 24px 0; text-shadow: 0 12px 44px rgba(0,0,0,.3); }
.countdown.go { color: #7fff7d; }
.bash-button { width: min(360px, 85%); height: 110px; border-radius: 999px; font-size: 40px; font-weight: 1000; background: linear-gradient(180deg, #ffda52, #ff9b24); color: #3b2300; box-shadow: inset 0 -9px 0 rgba(127,69,0,.18), 0 18px 50px rgba(255,162,33,.24); user-select: none; }
.bash-button:active:not(:disabled) { transform: scale(.96); }
.mini-scores { margin-top: 26px; display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.mini-score { background: rgba(255,255,255,.06); border-radius: 14px; padding: 12px; }
.mini-score b { display: block; font-size: 23px; margin-top: 4px; }
.false-start { opacity: .5; text-decoration: line-through; }

.winner-card { width: min(680px, 94vw); border-radius: 32px; padding: 38px; text-align: center; }
.crown { font-size: 72px; filter: drop-shadow(0 12px 24px rgba(255,198,36,.25)); }
.final-ranking { display: grid; gap: 9px; margin: 28px 0; text-align: left; }
.final-line { display: flex; justify-content: space-between; gap: 15px; background: rgba(255,255,255,.06); padding: 13px 15px; border-radius: 13px; }

@media (max-width: 900px) {
  .screen { padding: 12px; }
  .game-header { min-height: 58px; }
  .turn-banner { font-size: 12px; }
  .game-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .score-panel { order: 2; }
  .board-shell { height: 64vh; min-height: 500px; }
  .legend { grid-template-columns: repeat(2, 1fr); }
  .action-toast { bottom: 90px; max-width: 88%; }
  .mini-scores { grid-template-columns: repeat(2, 1fr); }
}
