/*
 * Copyright (c) 2026 Copper Beech AI Ltd. All rights reserved.
 * Proprietary and confidential. No license granted. See LICENSE for terms.
 */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --muted: #888888;
    --hover: #f0f0f0;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#frame {
    width: 100%;
    max-width: 425px;
    aspect-ratio: 425 / 569;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    position: relative;
}

.brand-bar {
    flex-shrink: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--fg);
    padding: 10px 0 4px;
}

#frame:has(#screen-home.active) .brand-bar {
    display: none;
}

.screen {
    display: none;
    width: 100%;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px;
    min-height: 0;
}

#screen-game {
    padding: 12px 36px 28px;
    justify-content: flex-start;
}

.screen.active {
    display: flex;
}

#screen-create-join {
    padding: 28px 20px;
    justify-content: center;
    gap: 24px;
}

.cj-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    position: relative;
}

.cj-grid::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--muted);
}

.cj-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    min-width: 0;
}

.cj-heading {
    font-size: 13px;
    color: var(--fg);
    font-weight: 700;
    margin: 0 0 4px;
    text-align: center;
    line-height: 1.3;
    min-height: 34px;
}

.cj-col .code {
    margin: 0;
    font-size: 24px;
    letter-spacing: 3px;
    text-align: center;
}

.cj-col input[type="text"] {
    width: 100%;
    font-family: inherit;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    padding: 10px 6px;
    border: 1px solid var(--fg);
    background: var(--bg);
    color: var(--fg);
    text-transform: uppercase;
    min-width: 0;
}

.cj-col button {
    width: 100%;
    padding: 10px 0;
    font-size: 13px;
}

.cj-col .hint {
    text-align: center;
    margin-top: auto;
}

.qr {
    display: block;
    width: 110px;
    height: 110px;
    margin: 0 auto;
    background: var(--bg);
}

.brand {
    font-size: 72px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -2px;
}

.title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 36px;
}

.subtitle {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 36px;
}

.label {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 12px;
    text-align: center;
}

.status {
    font-size: 16px;
    color: var(--fg);
    margin: 0 0 28px;
    text-align: center;
}

.code {
    font-size: 40px;
    font-weight: 700;
    margin: 0 0 28px;
    letter-spacing: 4px;
    text-align: center;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

button {
    background: var(--bg);
    color: var(--fg);
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    border: 1px solid var(--fg);
    padding: 14px 20px;
    width: 220px;
    cursor: pointer;
    transition: background 80ms, color 80ms;
}

button:hover, button:active {
    background: var(--fg);
    color: var(--bg);
}

button.spaced-top {
    margin-top: 22px;
}

.toggle-group {
    display: flex;
    gap: 8px;
    margin: 0 0 36px;
}

.toggle {
    width: 96px;
    padding: 14px 0;
}

.toggle.active {
    background: var(--fg);
    color: var(--bg);
    cursor: default;
}

.toggle.active:hover {
    background: var(--fg);
    color: var(--bg);
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    min-height: 16px;
    text-align: center;
}

.dots {
    display: flex;
    gap: 10px;
    margin: 8px 0 32px;
}

.dots span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    animation: dot-pulse 1.2s infinite ease-in-out;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 60%, 100% {
        background: var(--muted);
        transform: scale(1);
    }
    30% {
        background: var(--fg);
        transform: scale(1.5);
    }
}

.about-tagline {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 28px;
    text-align: center;
}

.about-line {
    font-size: 13px;
    color: var(--fg);
    margin: 0 0 4px;
    text-align: center;
}

.about-line a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid var(--muted);
}

.about-line a:hover {
    border-bottom-color: var(--fg);
}

.about-spaced {
    margin-top: 24px;
    margin-bottom: 28px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    height: 44px;
    margin: 0 0 20px;
    font-size: 16px;
}

.player {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player.white { align-items: flex-start; }
.player.black { align-items: flex-end; }

.clock {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.game-status {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

#score-white { font-weight: 700; }
#score-black { color: var(--muted); }

#screen-game.turn-black #score-white { font-weight: 400; color: var(--muted); }
#screen-game.turn-black #score-black { font-weight: 700; color: var(--fg); }

#screen-game.game-over #score-white,
#screen-game.game-over #score-black {
    color: var(--fg);
}

#board {
    display: block;
    margin: 0 0 36px;
    touch-action: manipulation;
    cursor: pointer;
}

#screen-game.cant-play #board {
    cursor: default;
}

.game-footer {
    width: 100%;
    height: 44px;
    display: flex;
    justify-content: center;
}

.game-footer button {
    width: 220px;
    height: 44px;
    padding: 0;
    font-size: 13px;
}
