:root {
  --bg: #0a1530; --bg2: #13264f; --card: #16223f; --line: rgba(255,255,255,.1);
  --txt: #e8eefc; --muted: #93a4c8; --accent: #ffd24a; --red: #ff5252; --blue: #42a5f5;
  --primary: #2e8b57; --primary2: #3fae6c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #1c3566, var(--bg));
  color: var(--txt); overflow: hidden;
}
#app { height: 100vh; }

.screen { display: none; height: 100vh; overflow: auto; }
.screen.active { display: block; }

.card {
  background: linear-gradient(180deg, var(--card), #111b34);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.card.wide { max-width: 720px; }
h1,h2,h3 { margin: 0 0 10px; }
.muted { color: var(--muted); margin: 4px 0 14px; }
.hint { color: var(--muted); font-size: 13px; }

input, select {
  width: 100%; padding: 11px 12px; margin: 6px 0; border-radius: 10px;
  border: 1px solid var(--line); background: #0e1830; color: var(--txt); font-size: 15px;
}
label { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
label input { margin-top: 4px; }

.btn {
  display: inline-block; padding: 11px 16px; margin: 6px 4px 0 0; border: none;
  border-radius: 10px; background: #24355c; color: var(--txt); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: transform .06s, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--primary2), var(--primary)); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.tiny { padding: 7px 10px; font-size: 12px; }
.btn.round { border-radius: 999px; padding: 16px 22px; background: rgba(20,30,55,.8); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* AUTH */
.auth-card { max-width: 380px; margin: 8vh auto; text-align: center; }
.logo { font-size: 30px; letter-spacing: .5px; }
.logo span { color: var(--accent); }
.logo.small { font-size: 18px; }
.tagline { color: var(--muted); margin-bottom: 16px; }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab { flex: 1; background: #1a2747; border: 1px solid var(--line); color: var(--muted);
  padding: 10px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.tab.active { background: #24355c; color: var(--txt); }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* LANDING (crawlable content shown on the sign-in screen) */
.landing { max-width: 720px; margin: 8px auto 48px; padding: 0 18px; }
.landing-block { margin: 28px 0; }
.landing h2 { font-size: 22px; }
.landing h3 { font-size: 16px; margin: 16px 0 4px; color: var(--accent); }
.landing p { color: var(--muted); line-height: 1.6; margin: 8px 0; }
.landing-list { color: var(--muted); line-height: 1.6; padding-left: 20px; margin: 8px 0; }
.landing-list li { margin: 8px 0; }
.landing strong { color: var(--txt); }
.landing-foot { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px;
  text-align: center; color: var(--muted); font-size: 14px; }

/* TOPBAR + MENU */
.topbar { display: flex; align-items: center; gap: 8px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.spacer { flex: 1; }
.pill { background: #16223f; border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; font-size: 13px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
  gap: 16px; padding: 22px; max-width: 1100px; margin: 0 auto; }
.room-list { margin-top: 10px; max-height: 180px; overflow: auto; }
.room-row { display: flex; justify-content: space-between; padding: 9px 11px; margin: 6px 0;
  background: #0e1830; border-radius: 9px; cursor: pointer; font-size: 13px; }
.room-row:hover { background: #16243f; }

/* LOBBY */
.lobby-card { max-width: 560px; margin: 6vh auto; }
.code { font-family: ui-monospace, monospace; letter-spacing: 4px; color: var(--accent);
  background: #0e1830; padding: 3px 12px; border-radius: 8px; }
.seat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.team-col h4 { margin: 0 0 8px; }
.team-col.team-0 h4 { color: var(--red); }
.team-col.team-1 h4 { color: var(--blue); }
.seat { padding: 12px; border-radius: 10px; margin-bottom: 8px; background: #0e1830;
  border: 1px solid var(--line); font-size: 14px; }
.seat.empty { color: var(--muted); border-style: dashed; }
.seat.ready { border-color: var(--primary2); }
.seat small { color: var(--muted); }
.seat em { float: right; color: var(--accent); font-style: normal; font-size: 12px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* GAME */
.game-screen { position: relative; background: #050b1c; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.game-controls { position: absolute; right: 18px; bottom: 22px; }
.exit { position: absolute; top: 12px; right: 12px; z-index: 5; }
.chat { position: absolute; left: 12px; bottom: 12px; width: 280px; max-width: 46vw;
  display: none; flex-direction: column; gap: 6px; z-index: 4; }
.chat-log { max-height: 130px; overflow: auto; font-size: 13px; background: rgba(8,16,34,.55);
  border-radius: 10px; padding: 8px; }
.chat-log div { margin: 2px 0; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { margin: 0; }

.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,20,.7); z-index: 10; }
.overlay.show { display: flex; }
.result { text-align: center; min-width: 280px; }
.bigscore { font-size: 46px; font-weight: 800; margin: 10px 0 18px; color: var(--accent); }

/* LEADERBOARD */
.wide { max-width: 720px; margin: 5vh auto; }
table.lb { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
table.lb th, table.lb td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.lb th { color: var(--muted); font-weight: 600; }

#screen-profile .card { max-width: 380px; margin: 8vh auto; }

/* FIRST-TIME FEATURE CARD */
.card.feature { grid-column: 1 / -1; cursor: pointer;
  background: linear-gradient(120deg, #1c3566, #16223f);
  border-color: rgba(255,210,74,.35); }
.card.feature:hover { filter: brightness(1.06); }

/* TUTORIAL */
.tutorial-card { max-width: 640px; margin: 6vh auto; }
.tut-head { display: flex; align-items: center; justify-content: space-between; }
.tut-slide { min-height: 220px; padding: 6px 2px 4px; }
.tut-slide h3 { font-size: 21px; }
.tut-slide .big { font-size: 44px; display: block; margin-bottom: 6px; }
.tut-slide .lead { color: var(--muted); line-height: 1.5; margin: 8px 0; }
.tut-slide ul { margin: 10px 0; padding-left: 20px; }
.tut-slide li { margin: 7px 0; line-height: 1.45; }
.tut-slide b { color: var(--accent); }
.tut-dots { display: flex; gap: 6px; justify-content: center; margin: 6px 0 14px; }
.tut-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dots span.on { background: var(--accent); }
.tut-nav { align-items: center; }

/* Shot school: pick-a-shot cards inside the tutorial + in-drill shot switcher */
.shot-school .lead { color: var(--muted); line-height: 1.5; margin: 6px 0 12px; }
.shot-school b { color: var(--accent); }
.shot-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px;
  max-height: 50vh; overflow-y: auto; padding-right: 4px;
}
.shot-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: rgba(20,30,55,.35);
}
.shot-card h4 { margin: 0 0 6px; font-size: 17px; }
.shot-card p { margin: 5px 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.shot-card p b { color: var(--txt); }
.shot-card .btn { margin-top: 8px; }
.shot-bar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 22px;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 92vw;
}
.shot-bar .shot-btn { border-radius: 999px; padding: 10px 16px; background: rgba(20,30,55,.85); margin: 0; }
.shot-bar .shot-btn.active { background: var(--accent); color: #14203c; }

/* IN-GAME COACH BAR */
.coach-bar { position: absolute; top: 92px; left: 50%; transform: translateX(-50%);
  display: none; align-items: center; gap: 10px; max-width: min(620px, 92vw);
  background: rgba(8,16,34,.88); border: 1px solid rgba(255,210,74,.35);
  border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 20; }
.coach-bar .coach-emoji { font-size: 22px; flex: 0 0 auto; }
.coach-bar b { color: var(--accent); }

/* TOAST */
.toast { position: fixed; left: 50%; bottom: -60px; transform: translateX(-50%);
  background: #1c2c50; border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px;
  transition: bottom .3s; z-index: 100; }
.toast.show { bottom: 24px; }
.toast.bad { background: #5a1f29; border-color: #8a3340; }
