/* Pepper Online — landscape-first, mobile-friendly.
   Shared palette: green felt table, cream panels, gold accent. */

:root {
    /* Felt table gradient endpoints */
    --felt-dark: #0a3020;
    --felt-mid:  #145a34;
    --felt-hi:   #1b7143;

    /* Panels (menu, lobby, modals) */
    --panel-bg: #f3ecdc;
    --panel-bg-alt: #ece3cc;
    --panel-border: #d4a017;
    --panel-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.35);

    --ink: #1e2a1e;
    --ink-muted: #6a7a6a;
    --ink-line: #d1c8a8;

    /* Brand + team colors */
    --gold: #d4a017;
    --gold-dark: #a97e0d;
    --color-accent: #f4c542;
    --color-red: #b91c5c;
    --color-red-ink: #8a1546;
    --color-black: #232323;

    /* Legacy in-game surface still used by the game.css overlay */
    --color-bg: var(--felt-dark);
    --color-surface: #2b3744;
    --color-text: #f4f0e2;
    --color-muted: #9aa79a;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    /* Rich green felt background used by menu + lobby views. The game screen paints its own. */
    background:
        radial-gradient(ellipse at center top, var(--felt-hi) 0%, var(--felt-mid) 40%, var(--felt-dark) 100%);
}

/* Subtle woven felt texture — pure CSS, no image required */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(45deg,  rgba(255,255,255,0.015) 0 2px, transparent 2px 4px),
        repeating-linear-gradient(-45deg, rgba(0,0,0,0.03) 0 2px, transparent 2px 4px);
}

/* Corner logo watermark for menu & lobby screens (game screen paints its own centered). */
body::after {
    content: '';
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    width: 140px;
    height: 140px;
    background-image: url('/static/Logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
}
/* The game screen has its own logo treatment, hide the corner watermark there. */
body.in-game::after { display: none; }

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: none;  /* Reserved slot from the CDG2 layout; not used by Pepper. */
}

#app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}

.ui-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 1rem;
    position: relative;
}

/* ---------- Panel: cream card used by menu/lobby/end-game ---------- */

.panel {
    background: linear-gradient(180deg, var(--panel-bg) 0%, var(--panel-bg-alt) 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--panel-shadow);
    color: var(--ink);
    padding: 1.4rem 1.6rem 1.5rem;
    width: min(92vw, 460px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    position: relative;
}
.panel--wide { width: min(94vw, 640px); }

.panel-logo {
    display: block;
    width: 130px;
    height: auto;
    margin: -1rem auto 0.25rem;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.panel-title {
    text-align: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--felt-dark);
    margin: 0;
}
.panel-subtitle {
    text-align: center;
    color: var(--ink-muted);
    font-size: 0.85rem;
    margin: -0.5rem 0 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.panel .field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 600;
}

.panel .actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* ---------- Buttons ---------- */

button {
    background: linear-gradient(180deg, var(--color-accent) 0%, var(--gold) 100%);
    color: #1a1408;
    border: 1px solid var(--gold-dark);
    border-radius: var(--radius);
    padding: 0.7rem 1.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--gold-dark), 0 4px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.08s, box-shadow 0.12s, filter 0.15s;
}
button:hover { filter: brightness(1.08); }
button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--gold-dark), 0 2px 5px rgba(0, 0, 0, 0.35);
}
button:disabled {
    background: #cfc9b8;
    color: #6a6a6a;
    border-color: #a89f83;
    box-shadow: none;
    cursor: not-allowed;
    filter: none;
    opacity: 0.9;
}

button.btn-secondary {
    background: linear-gradient(180deg, #fdf7e8 0%, #ebe1c4 100%);
    color: var(--ink);
    border-color: #b8a978;
    box-shadow: 0 2px 0 #a89568, 0 4px 8px rgba(0, 0, 0, 0.25);
}
button.btn-red {
    background: linear-gradient(180deg, #d84781 0%, #a3134f 100%);
    color: white;
    border-color: #7a0d3b;
    box-shadow: 0 2px 0 #7a0d3b, 0 4px 8px rgba(0, 0, 0, 0.35);
}
button.btn-black {
    background: linear-gradient(180deg, #3a3a3a 0%, #1c1c1c 100%);
    color: #eee;
    border-color: #000;
    box-shadow: 0 2px 0 #000, 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* ---------- Form controls ---------- */

input, select {
    background: white;
    color: var(--ink);
    border: 1px solid var(--ink-line);
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
input:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(212, 160, 23, 0.25);
}

h1, h2, h3 { margin: 0; }

/* ---------- Landscape hint on portrait mobile ---------- */

@media (orientation: portrait) and (max-width: 900px) {
    body::before {
        content: "Rotate your device to landscape for the best experience.";
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(10, 48, 32, 0.97);
        color: var(--color-text);
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 2rem;
        font-size: 1.25rem;
    }
    body::after { display: none; }
}
