:root {
    --teal-700: #2e6e7a;
    --teal-600: #3a7f8b;
    --teal-400: #8fc2c8;
    --sky-50: #eef6f7;
    --cream-50: #fbfaf6;
    --cream-100: #f6f1e5;
    --sand-200: #f2dfb5;
    --card: #ffffff;
    --ink: #1f2a2e;
    --muted: #5b6b72;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    --radius-xl: 18px;
    --radius-lg: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--cream-50);
}

a {
    color: inherit;
}

.site-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
}

.container {
    width: min(1100px, calc(100% - 48px));
    margin: 0 auto;
}

.brandbar {
    background: #6f9dac;
    border-bottom: 4px solid rgba(255, 255, 255, 0.5);
}

.brandbar__inner {
    min-height: 20vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f3d48b;
    letter-spacing: 1px;
    font-weight: 800;
}

.brand__mark {
    width: auto;
    height: min(22vh, 160px);
    display: block;
    object-fit: contain;
}

.pagetitle {
    background: #f8f7f2;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.pagetitle__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0 16px;
}

.pagetitle h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    letter-spacing: 1px;
    color: var(--teal-700);
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal-700);
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(143, 194, 200, 0.22);
}

.page-main {
    width: 100%;
    padding: 42px 0 52px;
    background: linear-gradient(180deg, #dbecef 0%, #eaf2f4 40%, #ddebed 100%);
}

.page-stack {
    display: grid;
    gap: 22px;
}

.card {
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 22px;
}

.hero-copy {
    display: grid;
    gap: 10px;
}

.hero-copy-split {
    grid-template-columns: 1fr auto;
    align-items: start;
}

.hero-grid,
.grid-two {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}

.page-title,
.hero__headline {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 2.625rem);
    letter-spacing: 1px;
    color: var(--teal-700);
}

.page-subtitle,
.hero__sub,
.muted {
    color: var(--teal-700);
    font-size: 1rem;
    margin: 0;
}

.section-title {
    margin: 0 0 10px;
    font-size: 24px;
    letter-spacing: 0.5px;
    color: var(--teal-700);
}

.question-title {
    font-size: 22px;
    font-weight: 750;
    color: #2b3b41;
    margin: 0 0 10px;
}

.puzzle-board {
    margin: 24px 0;
    padding: 20px;
    font-size: clamp(1.55rem, 4vw, 2.8rem);
    line-height: 1.5;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: var(--teal-700);
    text-align: center;
    word-break: break-word;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 241, 229, 0.9));
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.status-message {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(143, 194, 200, 0.22);
    color: var(--teal-700);
    font-weight: 700;
    margin: 0;
}

.status-message.error,
.status-error {
    color: #8a2b2b;
    background: rgba(189, 82, 82, 0.12);
    font-weight: 700;
}

.status-ok {
    color: #2c6f3d;
    font-weight: 700;
}

.game-meta,
.stats-list,
.button-stack,
.stack,
.solve-form,
.stack-form {
    display: grid;
    gap: 12px;
}

.game-meta {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0 0 18px;
}

.meta-chip,
.stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.stats-total {
    margin: 0 0 16px;
    font-size: 1rem;
}

.progress {
    height: 14px;
    border-radius: 999px;
    background: #d7e6e8;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin: 12px 0 16px;
}

.progress__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #f0cf7a, #6fb3bd);
}

.letter-grid {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.letter-row {
    display: grid;
    gap: 8px;
    justify-content: center;
}

.letter-row-1 {
    grid-template-columns: repeat(10, minmax(0, 52px));
}

.letter-row-2 {
    grid-template-columns: repeat(9, minmax(0, 52px));
}

.letter-row-3 {
    grid-template-columns: repeat(7, minmax(0, 52px));
}

.letter-button,
.answer-btn,
.answer {
    min-height: 52px;
    border-radius: 14px;
    border: 2px solid rgba(0, 0, 0, 0.06);
    background: #fbf2d9;
    color: #2a3a40;
    font-size: 18px;
    font-weight: 650;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    cursor: pointer;
}

.answer-selected,
.answer-btn[disabled] {
    background: #8dc1c6;
    border-color: rgba(0, 0, 0, 0.1);
    color: #22444a;
    box-shadow: none;
    cursor: not-allowed;
}

.solve-panel,
.solved-panel {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--teal-700);
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

textarea {
    resize: vertical;
}

.field-help {
    font-size: 13px;
    color: var(--muted);
    margin-top: -8px;
    margin-bottom: 10px;
}

.btn,
button,
.btn-primary,
.btn-secondary,
.inline-button,
.link-button {
    width: 100%;
    min-height: 52px;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 750;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter 120ms ease;
    padding: 0 18px;
}

.btn:hover,
button:hover,
.btn-primary:hover,
.btn-secondary:hover,
.inline-button:hover,
.link-button:hover {
    filter: brightness(0.98);
}

.btn,
button:not(.secondary):not(.answer-btn),
.btn-primary,
.link-button {
    background: #f0cf7a;
    color: #2b5c65;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

button.letter-button.is-guessed,
button.letter-button:disabled {
    background: #f6e4a3;
    border: 2px solid rgba(191, 157, 58, 0.28);
    color: #8c7a39;
    box-shadow: none;
    cursor: not-allowed;
}

.secondary,
.btn-secondary,
.inline-button {
    background: #7ba7b2;
    color: #f8fffe;
    box-shadow: none;
}

.btn-danger {
    background: #b24d4d;
    color: #fff8f8;
    box-shadow: none;
}

.compact,
.compact-link,
.btn-small {
    width: auto;
    min-width: 84px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    border-radius: 10px;
}

.actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.checkbox-row input {
    width: auto;
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
}

.calendar-stack {
    display: grid;
    gap: 22px;
}

.calendar-month {
    display: grid;
    gap: 12px;
}

.calendar-month__header h3 {
    margin: 0;
    color: var(--teal-700);
    font-size: 1.3rem;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--teal-700);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 148px;
    width: 100%;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 241, 229, 0.82));
    display: grid;
    align-content: start;
    gap: 8px;
    text-align: left;
}

.calendar-day.has-affirmation {
    background: linear-gradient(180deg, rgba(240, 207, 122, 0.34), rgba(255, 255, 255, 0.96));
}

.calendar-day--blank {
    min-height: 148px;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.calendar-day.is-past,
.calendar-day:disabled {
    background: linear-gradient(180deg, rgba(246, 241, 229, 0.96), rgba(241, 232, 198, 0.9));
    color: #a9b7bd;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

.calendar-day.is-past .calendar-day__number,
.calendar-day.is-past .calendar-day__text,
.calendar-day.is-past .calendar-day__meta,
.calendar-day.is-past .calendar-day__empty,
.calendar-day:disabled .calendar-day__number,
.calendar-day:disabled .calendar-day__text,
.calendar-day:disabled .calendar-day__meta,
.calendar-day:disabled .calendar-day__empty {
    color: #a9b7bd;
}

.calendar-day.is-today {
    outline: 3px solid rgba(58, 127, 139, 0.28);
}

.calendar-day__number {
    font-size: 1rem;
    font-weight: 900;
    color: var(--teal-700);
}

.calendar-day__text {
    font-size: 0.95rem;
    line-height: 1.35;
    color: #26444c;
}

.calendar-day__meta,
.calendar-day__empty {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--muted);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(25, 38, 42, 0.48);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-backdrop.is-visible {
    display: flex;
}

.modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 22px;
}

.modal-card__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-date-label {
    margin-top: 4px;
}

.is-hidden {
    display: none;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.results-table th {
    color: var(--teal-700);
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.list-rows,
.leaderboard,
.players {
    display: grid;
    gap: 10px;
}

.lb-row,
.player-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 14px;
}

.lb-rank,
.player-rank {
    font-weight: 800;
    color: #2b5c65;
    opacity: 0.7;
}

.lb-name,
.player-name {
    font-weight: 700;
    color: #2b5c65;
}

.lb-pts,
.player-score {
    font-weight: 800;
    color: #2b5c65;
    opacity: 0.9;
}

.room-sidebar {
    background: #fbf4e0;
}

.simple-list {
    margin: 0;
    padding-left: 20px;
}

.simple-list li+li {
    margin-top: 10px;
}

.auth-card {
    max-width: 620px;
}

.full-span {
    grid-column: 1 / -1;
}

.empty-state {
    max-width: 760px;
}

blockquote {
    margin: 0 0 12px;
    padding: 16px 18px;
    border-left: 4px solid #f0cf7a;
    border-radius: 14px;
    background: rgba(240, 207, 122, 0.14);
    font-size: 1.1rem;
}

.footer {
    background: #f0d895;
    padding: 34px 0 40px;
}

.footer__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.footer__title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: var(--teal-700);
    margin-bottom: 14px;
}

.footer__links {
    display: grid;
    grid-template-columns: auto auto;
    gap: 10px 28px;
    max-width: 420px;
}

.footer__link,
.footer__text {
    color: #2b5c65;
    text-decoration: underline;
    font-size: 13px;
    opacity: 0.85;
}

.footer__col--right {
    text-align: right;
}

@media (max-width: 900px) {

    .hero-grid,
    .grid-two,
    .footer__inner,
    .hero-copy-split,
    .pagetitle__inner {
        grid-template-columns: 1fr;
    }

    .pagetitle__inner {
        display: grid;
    }

    .footer__col--right {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(1100px, calc(100% - 28px));
    }

    .brandbar__inner {
        min-height: 16vh;
    }

    .pagetitle h1 {
        font-size: 30px;
        padding: 0;
    }

    .page-title,
    .hero__headline {
        font-size: 32px;
    }

    .card {
        padding: 18px;
    }

    .letter-row-1 {
        grid-template-columns: repeat(10, minmax(0, 31px));
    }

    .letter-row-2 {
        grid-template-columns: repeat(9, minmax(0, 31px));
    }

    .letter-row-3 {
        grid-template-columns: repeat(7, minmax(0, 31px));
    }

    .letter-button {
        min-height: 42px;
        font-size: 0.95rem;
    }

    .calendar-weekdays,
    .calendar-grid {
        gap: 6px;
    }

    .calendar-day {
        min-height: 112px;
        padding: 10px;
    }

    .calendar-day__text {
        font-size: 0.82rem;
    }
}