:root {
  --bg: #0c2f24;
  --bg2: #114032;
  --card: #165a42;
  --ink: #eef7ef;
  --muted: #9fd0b0;
  --accent: #c6ff00;
  --accent2: #7cfc00;
  --danger: #ff8a80;
  --sand: #e0c070;
  --water: #2a7ad0;
  --wall: #2e4a3a;
  --fairway: #2f9e5d;
  --fairway2: #278a50;
  --radius: 1rem;
  --touch: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #145239 0%, var(--bg) 55%);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(12,47,36,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 1rem; gap: .75rem;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.topnav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.topnav .who { color: var(--muted); font-size: .9rem; }
.shell {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr;
  gap: 1rem; padding: .75rem 1rem 2rem;
}
@media (min-width: 960px) {
  .shell { grid-template-columns: minmax(0,1fr) 160px; }
  .desktop-only { display: block !important; }
}
.desktop-only { display: none; }
.main { min-width: 0; }
.site-foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 1rem; }
.site-foot a { color: var(--muted); }
.card {
  background: linear-gradient(180deg, #1a684c, var(--card));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.hero { text-align: center; padding: 1.5rem .5rem 2rem; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: .4rem 0; letter-spacing: -.02em; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 28rem; margin: 0 auto 1.2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }
.heritage { margin-top: 1.4rem; color: var(--muted); font-size: .85rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); padding: .65rem 1.1rem;
  border-radius: .8rem; border: 0; cursor: pointer;
  background: var(--accent); color: #14301a; font-weight: 700; font-size: 1rem;
  text-decoration: none; font-family: inherit;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { min-height: 52px; padding: .8rem 1.25rem; font-size: 1.05rem; }
.btn-sm { min-height: 40px; padding: .4rem .8rem; font-size: .9rem; }
.btn-secondary { background: #ffd54f; color: #3e2f00; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid rgba(255,255,255,.25); }
.btn-danger { background: var(--danger); color: #3b0000; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .5rem 0 1rem; }
.lobby-grid { display: grid; gap: .85rem; }
@media (min-width: 700px) { .lobby-grid { grid-template-columns: 1fr 1fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem 0; border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--touch);
}
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }
.flash { padding: .7rem .85rem; border-radius: .7rem; margin: .5rem 0 1rem; }
.flash-ok { background: #1b5e20; }
.flash-error { background: #5d1a1a; color: #ffcdd2; }
.form label { display: block; margin: .7rem 0; font-weight: 600; font-size: .9rem; color: var(--muted); }
.form input[type=text], .form input[type=email], .form input[type=password] {
  display: block; width: 100%; margin-top: .3rem;
  padding: .75rem .8rem; border-radius: .7rem; border: 1px solid #1b6b4d;
  background: #0a2a1f; color: var(--ink); font-size: 1rem;
}
.form .check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 500; }
.auth-card { max-width: 24rem; margin: 1rem auto; }
.prose { max-width: 40rem; }
.prose h1 { margin-top: 0; }
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(255,255,255,.22); border-radius: .6rem;
  color: rgba(255,255,255,.35); font-size: .75rem; letter-spacing: .08em;
  text-transform: uppercase; margin: .5rem 0;
  background: rgba(0,0,0,.12);
}
.ad-banner { min-height: 60px; width: 100%; }
.ad-inline { min-height: 50px; margin: .4rem 0; }
.ad-rail { min-height: 250px; width: 100%; position: sticky; top: 4.5rem; }
.page-play { overscroll-behavior-y: contain; }
.page-play .shell { max-width: 460px; padding-left: .5rem; padding-right: .5rem; padding-top: .4rem; }
.page-play .rail { display: none !important; }
.play-wrap { display: flex; flex-direction: column; gap: .45rem; }
.play-hud {
  display: flex; flex-wrap: wrap; gap: .2rem .75rem; align-items: center;
  background: rgba(0,0,0,.28); border-radius: .75rem; padding: .5rem .7rem;
  font-size: .92rem; min-height: 2.6rem;
}
.play-hud strong { color: #fff; }
.play-hud .turn-you { color: var(--accent); font-weight: 700; margin-left: auto; }
.play-hud .turn-wait { color: var(--muted); margin-left: auto; }
.play-hud .hud-strokes { font-variant-numeric: tabular-nums; }
.play-hud .meta { color: var(--muted); font-size: .82rem; }
.canvas-wrap {
  position: relative;
  /* fit the viewport height on short phones, never wider than the 360px course */
  width: min(100%, 360px, calc((100dvh - 215px) * 0.5625));
  min-width: 220px;
  margin: 0 auto;
  border-radius: 1rem; overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,.4);
  touch-action: none; background: #15432b;
  aspect-ratio: 360 / 640;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
@supports not (height: 100dvh) {
  .canvas-wrap { width: min(100%, 360px, calc((100vh - 215px) * 0.5625)); }
}
#course { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.toast {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.9);
  max-width: 90%; text-align: center;
  background: rgba(10,30,20,.88); color: #fff; font-weight: 800; font-size: 1.25rem;
  padding: .7rem 1.1rem; border-radius: 1rem; border: 2px solid rgba(255,255,255,.25);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.good { border-color: var(--accent); color: var(--accent); }
.toast.ok { border-color: #7dffa0; }
.toast.meh { border-color: #ffab91; color: #ffccbc; font-size: 1.05rem; }
.power-box { padding: .1rem .2rem; }
.power-box.idle { opacity: .55; }
.power-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.power-label strong { color: #fff; font-variant-numeric: tabular-nums; }
.power-bar { height: 14px; border-radius: 8px; background: rgba(0,0,0,.35); overflow: hidden; border: 1px solid rgba(255,255,255,.12); }
.power-fill { height: 100%; width: 0; border-radius: 8px; background: #7dffa0; }
.play-help { text-align: center; color: var(--muted); font-size: .78rem; }
.scorecard {
  background: rgba(0,0,0,.22); border-radius: .75rem; padding: .5rem .6rem;
  font-size: .85rem;
}
.scorecard table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { padding: .18rem .3rem; text-align: center; }
.scorecard th { color: var(--muted); font-weight: 600; font-size: .78rem; white-space: nowrap; }
.scorecard tbody tr:nth-child(even) { background: rgba(255,255,255,.04); }
.scorecard tr.cur { background: rgba(198,255,0,.14) !important; }
.scorecard tfoot td { border-top: 1px solid rgba(255,255,255,.2); font-weight: 700; }
.scorecard .wip { color: var(--muted); font-style: italic; }
.scorecard th.me { color: var(--accent); }
.pdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; border: 1.5px solid #10241a; vertical-align: -1px; }
.play-actions { display: flex; justify-content: space-between; gap: .5rem; }
.play-ad { min-height: 0; }
@media (min-width: 900px) {
  .page-play .shell { max-width: 820px; }
  .play-wrap {
    display: grid; grid-template-columns: 360px minmax(0, 1fr); column-gap: 1.25rem; row-gap: .6rem;
    grid-template-areas: "canvas hud" "canvas power" "canvas help" "canvas score" "canvas actions" "canvas ad" "canvas .";
    grid-template-rows: auto auto auto auto auto auto 1fr;
    align-items: start;
  }
  .canvas-wrap { grid-area: canvas; width: 360px; margin: 0; }
  .play-hud { grid-area: hud; }
  .power-box { grid-area: power; }
  .play-help { grid-area: help; text-align: left; }
  .scorecard { grid-area: score; }
  .play-actions { grid-area: actions; }
  .play-ad { grid-area: ad; }
}
.dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: .35rem;
  background: #7dffa0; box-shadow: 0 0 6px #7dffa0;
}

.lobby-actions { display: grid; gap: .6rem; grid-template-columns: 1fr; margin: .5rem 0 1rem; }
@media (min-width: 700px) { .lobby-actions { grid-template-columns: repeat(3, 1fr); } }
.action-btn {
  flex-direction: column; align-items: flex-start; text-align: left; gap: .15rem;
  min-height: 68px; padding: .75rem 1rem; width: 100%;
}
.action-btn small { font-weight: 500; font-size: .8rem; opacity: .8; }
.section-hint { margin: -.2rem 0 .4rem; font-size: .82rem; color: var(--muted); }
.list li .btn { min-height: 44px; min-width: 76px; }
.who-name { word-break: break-word; }
.topnav a { padding: .5rem .25rem; }
.topbar { padding-top: env(safe-area-inset-top); }
.site-foot { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.shell { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
html { -webkit-text-size-adjust: 100%; }
button, .btn { touch-action: manipulation; }
