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

:root {
  --ink: #eef7f6;
  --muted: #8ba5a8;
  --deep: #071117;
  --panel: #0d1e27;
  --panel-2: #102833;
  --line: #203b45;
  --cyan: #36d8c4;
  --yellow: #f9c74f;
  --green: #64dc88;
  --danger: #ff776f;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--deep); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--deep); font-family: var(--body); font-size: 16px; }
button, input { font: inherit; }
button { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: .72rem 1rem; color: var(--ink); background: #132a34; font-weight: 700; cursor: pointer; }
button:hover { border-color: #45626b; background: #183641; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
button.primary { border-color: var(--cyan); color: #031513; background: var(--cyan); }
button.primary:hover { background: #62e4d4; }
button:disabled { opacity: .42; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); background: #132a34; }
button.danger { color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }

.site-header { width: min(1400px, calc(100% - 3rem)); min-height: 90px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.site-header.compact { min-height: 74px; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.45rem; font-weight: 800; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: #10232d; background: var(--yellow); font-size: 1.7rem; line-height: 1; transform: rotate(-3deg); box-shadow: 3px 3px 0 var(--cyan); }
.beta-pill, .test-badge { border: 1px solid #506168; border-radius: 99px; padding: .38rem .7rem; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; }

.landing { background-color: var(--deep); background-image: linear-gradient(rgba(54,216,196,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(54,216,196,.035) 1px, transparent 1px); background-size: 42px 42px; }
.landing-main { width: min(1400px, calc(100% - 3rem)); min-height: calc(100vh - 155px); margin: 0 auto; display: grid; grid-template-columns: .88fr 1.12fr; align-items: center; gap: clamp(2rem, 7vw, 7rem); padding: 5vh 0 9vh; }
.eyebrow { margin: 0 0 1rem; color: var(--cyan); font-family: var(--display); font-size: .9rem; font-weight: 800; letter-spacing: .18em; }
.intro-panel h1, .dashboard-heading h1 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: .88; text-transform: uppercase; }
.intro-panel h1 { max-width: 700px; font-size: clamp(4.2rem, 8.7vw, 8.5rem); }
.intro-panel h1 span { color: var(--yellow); }
.lead { max-width: 590px; margin: 2rem 0; color: #bed0d2; font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.65; }
.how-to { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; max-width: 600px; margin: 2rem 0; }
.how-to div { display: flex; align-items: center; gap: .65rem; color: #b9cace; font-size: .82rem; font-weight: 600; }
.how-to b { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; color: var(--yellow); font-family: var(--display); font-size: 1rem; }
.twitch-button { display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; border: 1px solid #8f62ff; border-radius: 8px; padding: .8rem 1.2rem; background: #7c4dff; color: #fff; font-weight: 700; text-decoration: none; }
.twitch-button:hover { background: #8b61ff; }
.fine-print { color: var(--muted); font-size: .78rem; }

.game-preview { position: relative; isolation: isolate; overflow: hidden; padding: clamp(1.5rem, 3vw, 3.5rem); border: 1px solid #294751; border-radius: 18px; background: #0b1b23; box-shadow: 0 32px 90px rgba(0,0,0,.38); transform: rotate(1deg); }
.game-preview::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .32; background: radial-gradient(circle at 50% 0, #1d7b77 0, transparent 45%); }
.preview-topline { display: flex; justify-content: space-between; color: #a5b9bc; font-family: var(--display); font-weight: 800; letter-spacing: .1em; }
.live-dot { color: var(--green); }
.live-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.preview-score { margin: 3.2rem 0 2.2rem; text-align: center; }
.preview-score span { display: block; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .14em; }
.preview-score strong { display: block; color: var(--yellow); font-family: var(--display); font-size: clamp(4.6rem, 8vw, 7.4rem); line-height: .9; }
.letter-row { display: flex; justify-content: center; gap: clamp(.35rem, 1vw, .75rem); }
.letter-row i, .mini-board i { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid #d4e7e7; border-radius: 9px; color: #10232d; background: #e9f1ec; box-shadow: 0 5px 0 #8fb4b0; font-family: var(--display); font-style: normal; font-weight: 800; }
.letter-row i { width: clamp(42px, 5.4vw, 78px); font-size: clamp(1.8rem, 3.3vw, 3.1rem); }
.found-word { display: flex; align-items: center; gap: 1rem; width: min(430px, 100%); margin: 2.7rem auto 1.8rem; padding: .9rem 1rem; border-left: 3px solid var(--cyan); background: #142c36; }
.found-word div { flex: 1; }
.found-word small { display: block; color: var(--muted); font-size: .67rem; font-weight: 700; }
.found-word b { font-family: var(--display); font-size: 1.4rem; letter-spacing: .06em; }
.found-word > strong { color: var(--cyan); font-family: var(--display); font-size: 1.5rem; }
.player-avatar { display: grid; place-items: center; flex: 0 0 35px; height: 35px; border-radius: 50%; color: #10232d; background: var(--yellow); font-weight: 800; }
.goal-track { overflow: hidden; height: 8px; border-radius: 99px; background: #1a333c; }
.goal-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--cyan); transition: width .35s ease; }
.game-preview > p { color: var(--muted); text-align: center; font-size: .82rem; }
.game-preview > p b { color: var(--ink); }
footer { width: min(1400px, calc(100% - 3rem)); margin: 0 auto; padding: 1.2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

.dashboard-page { background: #09151b; }
.connection { color: var(--muted); font-size: .8rem; font-weight: 600; }
.connection i { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: #849399; }
.connection.online i { background: var(--green); }
.dashboard-shell { width: min(1400px, calc(100% - 3rem)); margin: 0 auto; padding: 3rem 0 6rem; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 2rem; }
.dashboard-heading h1 { font-size: clamp(3rem, 6vw, 5rem); }
.dashboard-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.ghost-link { padding: .75rem 0; color: var(--cyan); font-weight: 700; text-decoration: none; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.control-card { padding: 1.5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.card-title span { color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .1em; }
.card-title strong { display: block; margin-top: .3rem; font-family: var(--display); font-size: 1.5rem; }
.card-title > b { color: var(--yellow); font-family: var(--display); font-size: 2.2rem; }
.dashboard-score { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .55rem; color: var(--muted); }
.dashboard-score strong { color: var(--ink); font-family: var(--display); font-size: 1.8rem; }
.dashboard-score i { font-style: normal; }
.mini-board { display: flex; gap: .5rem; margin: 2rem 0; }
.mini-board i { width: min(58px, 11%); font-size: 1.5rem; }
.button-row, .quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.simulator label { display: block; margin: 1rem 0 .45rem; color: #b8c9cb; font-size: .8rem; font-weight: 600; }
input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; color: var(--ink); background: #09171e; }
.round-time { display: grid; gap: .45rem; max-width: 220px; margin: 1.2rem 0; color: var(--muted); font-size: .85rem; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.feedback { min-height: 1.5em; color: var(--muted); font-size: .82rem; }
.feedback.success { color: var(--green); }
.quick-actions { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.profile-row { display: flex; align-items: center; gap: 1rem; min-height: 96px; }
.profile-row img { width: 72px; height: 72px; border: 2px solid var(--cyan); border-radius: 50%; background: #142c36; object-fit: cover; }
.profile-row b { font-size: 1.05rem; }
.profile-row p { margin: .45rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.chat-badge { border: 1px solid #506168; border-radius: 99px; padding: .38rem .7rem; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .06em; }
.chat-badge.connected { border-color: rgba(100,220,136,.45); color: var(--green); }
.chat-badge.permission_missing, .chat-badge.disconnected { border-color: rgba(255,119,111,.4); color: var(--danger); }
.claim-list, .leaderboard { margin: 0; padding: 0; list-style: none; }
.claim-list li, .leaderboard li { display: flex; align-items: center; gap: .8rem; min-height: 52px; border-top: 1px solid var(--line); }
.claim-list li:first-child, .leaderboard li:first-child { border-top: 0; }
.claim-list div { flex: 1; }
.claim-list small { display: block; color: var(--muted); font-size: .68rem; }
.claim-list b { font-family: var(--display); letter-spacing: .05em; }
.claim-list > li > strong { color: var(--cyan); }
.leaderboard li > b { width: 26px; color: var(--yellow); font-family: var(--display); }
.leaderboard li > span { flex: 1; font-weight: 600; }
.leaderboard li > small { color: var(--muted); }
.leaderboard li > strong { font-family: var(--display); font-size: 1.25rem; }
.claim-list li.empty, .leaderboard li.empty { color: var(--muted); font-size: .85rem; }

.overlay-page { overflow: hidden; background: transparent; }
.overlay-shell { position: relative; width: 100vw; height: 100vh; overflow: hidden; background: rgba(7,17,23,.97); }
.overlay-header { height: 13vh; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 4vw; border-bottom: 1px solid var(--line); }
.overlay-header .level { display: flex; align-items: baseline; gap: .6rem; }
.overlay-header .level small { color: var(--muted); font-weight: 700; letter-spacing: .15em; }
.overlay-header .level b { color: var(--yellow); font-family: var(--display); font-size: 3rem; }
.overlay-header time { justify-self: end; font-family: var(--display); font-size: clamp(2.5rem, 5vw, 4.5rem); font-weight: 800; }
.overlay-game { width: 72vw; height: 87vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4vh 5vw 8vh; }
.overlay-score { text-align: center; }
.overlay-score span { display: block; color: var(--muted); font-size: clamp(.8rem, 1.1vw, 1.2rem); font-weight: 700; letter-spacing: .14em; }
.overlay-score > strong { display: block; color: var(--yellow); font-family: var(--display); font-size: clamp(6rem, 11vw, 12rem); line-height: .82; }
.overlay-letters { margin: 7vh 0 5vh; }
.overlay-letters i { width: clamp(72px, 7.3vw, 134px); font-size: clamp(3rem, 5vw, 5.8rem); }
.goal-track.large { width: min(900px, 90%); height: 16px; }
.goal-copy { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.5rem); }
.goal-copy b { color: var(--ink); }
.overlay-side { position: absolute; top: 13vh; right: 0; width: 28vw; height: 87vh; padding: 3vh 2vw; border-left: 1px solid var(--line); background: #0a1920; }
.overlay-panel { margin-bottom: 4vh; }
.overlay-panel > span { display: block; margin-bottom: 1vh; color: var(--cyan); font-family: var(--display); font-size: 1.1rem; font-weight: 800; letter-spacing: .12em; }
.overlay-panel .claim-list li, .overlay-panel .leaderboard li { min-height: 7vh; }
.state-curtain { position: absolute; inset: 13vh 28vw 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(7,17,23,.94); }
.state-curtain[hidden] { display: none; }
.state-curtain strong { color: var(--yellow); font-family: var(--display); font-size: clamp(4rem, 9vw, 9rem); line-height: .9; text-transform: uppercase; }
.state-curtain span { margin-top: 1.5rem; color: var(--muted); font-size: clamp(1.2rem, 2vw, 2rem); }

@media (max-width: 900px) {
  .landing-main { grid-template-columns: 1fr; padding-top: 2rem; }
  .game-preview { transform: none; }
  .control-grid { grid-template-columns: 1fr; }
  .overlay-header { grid-template-columns: 1fr auto; }
  .overlay-header .level { display: none; }
}

@media (max-width: 600px) {
  .site-header, .landing-main, footer, .dashboard-shell { width: min(100% - 1.5rem, 1400px); }
  .site-header { min-height: 72px; }
  .beta-pill { display: none; }
  .intro-panel h1 { font-size: 4rem; }
  .how-to { grid-template-columns: 1fr; }
  .game-preview { padding: 1rem; }
  .letter-row { gap: .25rem; }
  .letter-row i { border-radius: 6px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .dashboard-shell { padding-top: 1.5rem; }
  .control-card { padding: 1rem; }
  .test-badge { display: none; }
  .button-row button { flex: 1 1 45%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
