/* =====================================================================
   style.css — Shared base styles: theme tokens, resets, typography,
   buttons, landing/entry pages. Loaded on every page.
   ===================================================================== */

/* Elements toggled with the `hidden` attribute must really disappear.
   Without this, rules like `.modal-overlay { display: flex }` override the
   browser default and leave an invisible overlay blocking the whole game. */
[hidden] { display: none !important; }

:root {
    --bg-900: #12141c;
    --bg-800: #191c28;
    --bg-700: #212437;
    --panel-radial: radial-gradient(ellipse at top, #232a44 0%, #171926 60%, #101220 100%);

    --gold-400: #f3d98b;
    --gold-500: #e8c25f;
    --gold-600: #c9a13f;

    --ivory: #f2f0ec;
    --ivory-dim: #b9bccb;

    --ludo-red: #e6473d;
    --ludo-green: #3fae5a;
    --ludo-yellow: #f0b429;
    --ludo-blue: #3f7fe0;

    --danger: #d1495b;

    --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 3px 8px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-display: 'Georgia', 'Iowan Old Style', serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font-body);
    background: var(--panel-radial);
    color: var(--ivory);
    min-height: 100vh;
    min-height: 100dvh;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--gold-400); margin: 0 0 8px; letter-spacing: 0.02em; }
p { margin: 0 0 12px; color: var(--ivory-dim); line-height: 1.5; }
a { color: var(--gold-400); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); color: #1c1206; box-shadow: var(--shadow-soft); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-secondary { background: rgba(242, 240, 236, 0.08); color: var(--ivory); border-color: rgba(242, 240, 236, 0.25); }
.btn-secondary:hover:not(:disabled) { background: rgba(242, 240, 236, 0.14); }

.btn-danger { background: rgba(209, 73, 91, 0.15); color: #f3aab6; border-color: rgba(209, 73, 91, 0.4); }
.btn-danger:hover:not(:disabled) { background: rgba(209, 73, 91, 0.25); }

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

/* --- Landing page --- */
.page-landing { display: flex; align-items: center; justify-content: center; padding: 24px; }
.landing-wrap { width: 100%; max-width: 440px; }
.landing-card {
    background: rgba(25, 28, 40, 0.75);
    border: 1px solid rgba(232, 194, 95, 0.25);
    border-radius: var(--radius-lg);
    padding: 40px 28px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(6px);
}
.landing-dice { font-size: 44px; margin-bottom: 4px; }
.landing-card h1 { font-size: 40px; }
.landing-tagline { font-size: 15px; }
.landing-actions { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.landing-rules { text-align: left; color: var(--ivory-dim); font-size: 13px; padding-left: 20px; margin: 0; }
.landing-rules li { margin-bottom: 4px; }

/* --- Entry pages (create/join room) --- */
.page-entry { display: flex; align-items: center; justify-content: center; padding: 24px; }
.entry-wrap { width: 100%; max-width: 420px; }
.entry-back { display: inline-block; margin-bottom: 12px; font-size: 14px; color: var(--ivory-dim); text-decoration: none; }
.entry-card {
    background: rgba(25, 28, 40, 0.75);
    border: 1px solid rgba(232, 194, 95, 0.25);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-soft);
}
.entry-sub { font-size: 14px; }

form label { display: block; font-size: 13px; font-weight: 600; color: var(--gold-400); margin: 16px 0 6px; }
form input[type="text"],
form input[type="number"],
form select {
    width: 100%;
    padding: 13px 14px;
    font-size: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(242, 240, 236, 0.2);
    background: rgba(18, 20, 28, 0.65);
    color: var(--ivory);
    outline: none;
}
form input:focus, form select:focus { border-color: var(--gold-500); }
.input-room-code { letter-spacing: 0.25em; text-transform: uppercase; font-weight: 700; text-align: center; }
form button[type="submit"] { margin-top: 22px; }

.form-error {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(209, 73, 91, 0.15);
    border: 1px solid rgba(209, 73, 91, 0.4);
    color: #f3aab6;
    font-size: 13px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(18, 20, 28, 0.95);
    border: 1px solid rgba(232, 194, 95, 0.35);
    color: var(--ivory);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: var(--shadow-soft);
    z-index: 999;
    max-width: 90vw;
    text-align: center;
}

.connection-status { font-size: 12px; text-align: center; padding: 4px 0; margin: 0; }
.connection-status--ok { color: #8fd6a8; }
.connection-status--warn { color: var(--gold-400); }
.connection-status--error { color: #f3aab6; }

@media (max-width: 480px) {
    .landing-card, .entry-card { padding: 28px 18px; }
    .landing-card h1 { font-size: 32px; }
}
