:root {
    --forest-deep: #31512c;
    --forest-mid: #527a3f;
    --forest-light: #8dbf4d;
    --bark: #8a562a;
    --bark-dark: #613717;
    --parchment: rgba(249, 239, 211, 0.94);
    --parchment-edge: #d2b47a;
    --ink: #2f2217;
    --gold: #d49a2a;
    --danger: #bb5032;
    --shadow: 0 18px 48px rgba(20, 22, 18, 0.28);
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Nunito', sans-serif;
    color: var(--ink);
    background:
        linear-gradient(rgba(34, 49, 24, 0.48), rgba(34, 49, 24, 0.56)),
        url('assets/concept-forest.png') center center / cover no-repeat fixed;
    position: relative;
}

.page-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.1));
    pointer-events: none;
}

.hero {
    padding: 40px 20px 24px;
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(82, 122, 63, 0.9);
    border: 3px solid rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 28px;
    text-align: center;
    padding: 26px 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}

.eyebrow,
.panel-label,
.letters-caption,
.status-label,
.message,
#unique-word-total {
    letter-spacing: 0.03em;
}

.eyebrow,
.panel-label {
    margin: 0 0 6px;
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.78rem;
    color: #fef2bf;
}

.hero h1,
.panel h2,
.list-header h3 {
    font-family: 'Merriweather', serif;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.3rem);
}

.tagline {
    margin: 12px auto 0;
    max-width: 760px;
    font-size: 1.05rem;
}

.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 24px;
    position: relative;
    z-index: 1;
}

.panel {
    box-shadow: var(--shadow);
}

.parchment {
    background: linear-gradient(180deg, rgba(255, 249, 232, 0.96), var(--parchment));
    border: 6px solid rgba(128, 77, 29, 0.92);
    border-radius: 28px;
    position: relative;
    overflow: hidden;
}

.parchment::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(141, 191, 77, 0.22);
    border-radius: 20px;
    pointer-events: none;
}

.game-panel,
.sidebar-panel {
    padding: 26px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

.panel-head.compact {
    margin-bottom: 20px;
}

.panel h2 {
    margin: 0;
    font-size: 2rem;
}

.player-box {
    min-width: 220px;
}

.player-box label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
}

input[type="text"] {
    width: 100%;
    border: 2px solid #d6c49c;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(255,255,255,0.85);
    color: var(--ink);
}

input[type="text"]:focus {
    outline: 3px solid rgba(82, 122, 63, 0.22);
    border-color: var(--forest-mid);
}

.status-grid,
.lifetime-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.status-card {
    background: rgba(255,255,255,0.65);
    border: 2px solid rgba(120, 84, 33, 0.16);
    border-radius: 18px;
    padding: 14px 16px;
}

.status-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.45rem;
}

.status-card.small strong {
    font-size: 1.2rem;
}

.letters-area {
    margin-top: 22px;
    text-align: center;
}

.letters-caption {
    margin: 0 0 12px;
    color: #5e482e;
    font-weight: 700;
}

.letter-bank {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.letter-tile {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #7ac34a, #4e9634);
    color: #fff;
    font-size: 1.85rem;
    font-weight: 800;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.25), 0 8px 14px rgba(50, 71, 32, 0.18);
    cursor: pointer;
}

.letter-tile:hover {
    transform: translateY(-1px);
}

.word-form {
    margin-top: 22px;
}

.button-row,
.scoreboard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 13px 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 10px 18px rgba(51, 43, 24, 0.18);
}

.btn-primary { background: linear-gradient(180deg, #2f8fed, #1b6fc0); }
.btn-secondary { background: linear-gradient(180deg, #e1a92b, #c9890f); }
.btn-danger { background: linear-gradient(180deg, #d76d50, #ae4327); }
.btn-small { padding: 10px 14px; font-size: 0.94rem; }
.file-label { display: inline-flex; align-items: center; }

.message {
    margin-top: 16px;
    min-height: 28px;
    font-weight: 800;
    color: var(--forest-deep);
}

.lists-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 18px;
    margin-top: 22px;
}

.list-card,
.scoreboard-section {
    background: rgba(255,255,255,0.55);
    border: 2px solid rgba(120, 84, 33, 0.16);
    border-radius: 18px;
    padding: 18px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.list-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.word-list,
.leaderboard,
.recent-games {
    margin: 0;
    padding: 0;
    list-style: none;
}

.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.word-list li,
.leaderboard li,
.recent-games li {
    border-radius: 12px;
    background: rgba(248, 243, 226, 0.9);
    border: 1px solid rgba(120, 84, 33, 0.12);
    padding: 10px 12px;
}

.leaderboard li,
.recent-games li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
}

.leaderboard li:last-child,
.recent-games li:last-child {
    margin-bottom: 0;
}

.scoreboard-meta,
.recent-meta {
    display: block;
    font-size: 0.88rem;
    color: #644a2e;
}

.round-meta p {
    margin: 0 0 10px;
    line-height: 1.45;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .panel-head,
    .status-grid,
    .lifetime-grid,
    .lists-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .panel-head {
        align-items: stretch;
    }

    .letter-tile {
        width: 56px;
        height: 56px;
        font-size: 1.55rem;
    }

    .game-panel,
    .sidebar-panel,
    .hero-inner {
        padding: 20px;
    }
}
