:root {
    --ink: #12324a;
    --muted: #5f7f93;
    --accent: #0b6fd8;
    --yellow: #FFD23F;
    --card: rgba(255, 255, 255, 0.94);
    --font: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #155fae;
    color: var(--ink);
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

#ocean {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: block;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

button { font-family: inherit; cursor: pointer; }

/* ---- cards (title, spots, intros, rewards) ---- */

#screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-y: auto;
}
#screen[hidden] { display: none; }

.card {
    width: min(100%, 440px);
    padding: clamp(18px, 4vw, 32px);
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 12px 40px rgba(8, 40, 90, 0.25);
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.6;
}
.card-wide { width: min(100%, 620px); text-align: left; }
.card p { margin: 0 0 12px; }
.card h2 { margin: 0 0 12px; font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.2; }

.eyebrow { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; margin-bottom: 6px !important; }
.logo { margin: 0 0 10px; font-size: clamp(2.2rem, 8vw, 3.6rem); line-height: 1; letter-spacing: -0.02em; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.card-wide .actions { justify-content: flex-start; }
.go {
    padding: 10px 24px;
    border: 1.5px solid #1a1a1a;
    border-radius: 999px;
    background: var(--yellow);
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 700;
}
.go:hover { background: #ffdb5c; }
/* free surf: same size as paddle out, but its own thing */
.go-free {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #12324a, #155fae);
    color: #fff;
    border-color: #12324a;
    box-shadow: 0 0 0 0 rgba(92, 225, 230, 0.6);
    animation: free-surf-glow 2.4s ease-in-out infinite;
}
.go-free:hover { background: linear-gradient(135deg, #1a4466, #1d70c8); }
@keyframes free-surf-glow {
    50% { box-shadow: 0 0 0 6px rgba(92, 225, 230, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .go-free { animation: none; }
}
.actions-small { margin-top: 10px; }
.quiet {
    padding: 10px 6px;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 0.9rem;
    text-decoration: underline;
}
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.challenge { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-weight: 700; font-size: 1rem; }
.challenge span {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.goal { color: var(--muted); }

.controls { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 4px; }
.controls li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 4px 10px; border-radius: 8px; }
.controls li.is-new { background: rgba(255, 210, 63, 0.35); }
.controls strong { flex: 0 0 16em; }
@media (max-width: 560px) {
    .controls strong { flex: 1 1 100%; }
}
.controls span { color: var(--muted); }
.controls em { margin-left: auto; font-style: normal; font-size: 0.7rem; font-weight: 700; color: #b07800; text-transform: uppercase; }

.tips summary { cursor: pointer; color: var(--accent); }
.tips ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }

.spots { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.spots button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #d7e9f5;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-size: 0.95rem;
    text-align: left;
}
.spots button:hover:not(:disabled) { border-color: var(--accent); }
.spots .locked button { opacity: 0.5; cursor: default; }
.spots-free { margin-top: 14px; }
.spots-free .spot-number { background: var(--yellow); color: #1a1a1a; }
.spot-number {
    flex: 0 0 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}
.spot-name { font-weight: 700; }
.spot-meta { margin-left: auto; color: var(--muted); font-size: 0.78rem; text-align: right; }

.stats { display: grid; gap: 4px; margin: 0 auto 4px; max-width: 280px; }
.stats div { display: flex; justify-content: space-between; gap: 12px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; }
.stats em { color: #b07800; font-style: normal; }

.reward-emoji { font-size: 3.4rem; line-height: 1; margin-bottom: 10px; }

/* ---- while you play ---- */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    color: #fff;
    text-shadow: 0 2px 3px rgba(10, 40, 80, 0.45);
    pointer-events: none;
}
#hud[hidden] { display: none; }
#hud p { margin: 0; }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 2px; }
.hud-right { align-items: flex-end; }
.hud-spot { font-weight: 700; font-size: 0.95rem; }
.hud-goal { font-size: 0.85rem; }
.hud-score { font-weight: 700; font-size: 1.2rem; }
.hud-lives { font-size: 0.9rem; min-height: 1.1em; }
.hud-arms { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; }
.hud-arms .bar { display: block; width: 70px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.hud-arms .bar span { display: block; height: 100%; background: #7ED957; transition: width 0.15s; }
.hud-arms.is-tired .bar span { background: #ff5c8a; }
#pause {
    pointer-events: auto;
    margin-top: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 700;
}

#tricks {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
}
#tricks[hidden] { display: none; }
#tricks button {
    width: 72px;
    height: 72px;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    background: rgba(255, 210, 63, 0.92);
    color: #1a1a1a;
    font-size: 0.78rem;
    font-weight: 700;
    touch-action: none;
}

#turn {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 76px;
    height: 76px;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    font-size: 0.85rem;
    font-weight: 700;
    touch-action: none;
}
#turn[hidden] { display: none; }

#rotate {
    display: none;
    position: fixed;
    inset: 0;
    margin: 0;
    place-items: center;
    padding: 24px;
    background: #155fae;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}
@media (orientation: portrait) and (pointer: coarse) {
    #rotate { display: grid; z-index: 10; }
}

/* ---- free surf's top 10 ---- */

.board-title { margin: 18px 0 6px; font-size: 1rem; }
.board { list-style: none; counter-reset: rank; margin: 0; padding: 0; display: grid; gap: 2px; text-align: left; }
.board li {
    counter-increment: rank;
    display: flex;
    gap: 10px;
    padding: 4px 10px;
    border-radius: 8px;
}
.board li::before { content: counter(rank); width: 1.6em; color: var(--muted); }
.board li span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li span:last-child { font-weight: 700; }
.board li.is-yours { background: rgba(255, 210, 63, 0.4); }
.board-empty { color: var(--muted); }

.name-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin: 14px 0 0;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 210, 63, 0.35);
    font-size: 0.85rem;
}
.name-form[hidden] { display: none; }
.name-form label { font-weight: 700; }
.name-form input {
    flex: 1 1 120px;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid #9fd3f2;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
}
.name-form button {
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 700;
}
.name-message { width: 100%; margin: 0 !important; color: #c0392b; }
.name-message:empty { display: none; }
