/* ============================================
   FAC WOODLAND LEAGUE
   Woodland Ledger — Wood Edition
============================================ */


/* ---------- COLOR SYSTEM ---------- */

:root {
    /* Parchment */
    --paper: #eadfbe;
    --paper-light: #f7efd7;
    --paper-dark: #d9c79d;

    /* Ink */
    --ink: #2b241c;
    --ink-soft: #675846;
    --line: #3b3025;

    /* Illustrated wood */
    --wood: #a96843;
    --wood-light: #bd7a4e;
    --wood-mid: #925938;
    --wood-dark: #613a29;
    --wood-deep: #44291f;

    /* Small warm accent */
    --gold: #b49355;

    --shadow: rgba(53, 38, 27, 0.25);
}


/* ---------- RESET ---------- */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;

    min-height: 100vh;

    font-family:
        "Libre Baskerville",
        Baskerville,
        Georgia,
        serif;

    color: var(--ink);

    background-color: var(--paper);

    background-image:
        radial-gradient(
            circle at 20% 10%,
            rgba(255, 255, 255, 0.25),
            transparent 25%
        ),
        radial-gradient(
            circle at 80% 60%,
            rgba(91, 59, 34, 0.08),
            transparent 30%
        ),
        repeating-linear-gradient(
            3deg,
            rgba(75, 48, 27, 0.018) 0px,
            rgba(75, 48, 27, 0.018) 1px,
            transparent 1px,
            transparent 5px
        );
}

button {
    font: inherit;
}


/* ============================================
   OUTER APP
============================================ */

.site-shell {
    width: min(100%, 1000px);

    min-height: 100vh;

    margin: 0 auto;

    background:
        linear-gradient(
            90deg,
            rgba(93, 61, 37, 0.05),
            transparent 4%,
            transparent 96%,
            rgba(93, 61, 37, 0.05)
        );

    border-left: 2px solid rgba(59, 48, 37, 0.28);
    border-right: 2px solid rgba(59, 48, 37, 0.28);
}


/* ============================================
   HEADER — CARTOONY WOOD PLANKS
============================================ */

.site-header {
    position: relative;

    display: flex;
    align-items: center;
    gap: 18px;

    padding: 28px 22px 24px;

    color: var(--paper-light);

    background-color: var(--wood);

    /*
       Multiple CSS layers create:
       - vertical plank divisions
       - irregular warm patches
       - dark hand-drawn-looking grain
    */
    background-image:

        /* irregular light patches */
        radial-gradient(
            ellipse at 12% 25%,
            rgba(255, 205, 145, 0.15) 0%,
            transparent 24%
        ),

        radial-gradient(
            ellipse at 62% 78%,
            rgba(73, 39, 25, 0.12) 0%,
            transparent 28%
        ),

        radial-gradient(
            ellipse at 86% 18%,
            rgba(255, 199, 130, 0.10) 0%,
            transparent 22%
        ),

        /* little grain streaks */
        repeating-linear-gradient(
            88deg,
            transparent 0px,
            transparent 16px,
            rgba(63, 34, 23, 0.08) 17px,
            transparent 18px,
            transparent 34px
        ),

        /* big plank divisions */
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 112px,
            rgba(55, 31, 22, 0.48) 113px,
            rgba(55, 31, 22, 0.48) 115px,
            rgba(212, 139, 85, 0.16) 116px,
            transparent 119px
        ),

        linear-gradient(
            180deg,
            var(--wood-light),
            var(--wood) 48%,
            var(--wood-mid)
        );

    border-bottom: 5px solid var(--wood-deep);

    box-shadow:
        inset 0 2px rgba(255, 221, 174, 0.18),
        inset 0 -3px rgba(68, 41, 31, 0.25);
}


/* Hand-drawn grain marks across header */

.site-header::after {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;

    opacity: 0.45;

    background-image:
        linear-gradient(
            93deg,
            transparent 8%,
            rgba(58, 31, 21, 0.32) 8.2%,
            transparent 8.7%
        ),
        linear-gradient(
            87deg,
            transparent 31%,
            rgba(58, 31, 21, 0.22) 31.3%,
            transparent 31.7%
        ),
        linear-gradient(
            91deg,
            transparent 69%,
            rgba(58, 31, 21, 0.24) 69.3%,
            transparent 69.8%
        );
}


.league-mark {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 64px;
    height: 64px;

    flex-shrink: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 23px;

    color: var(--paper-light);

    background: rgba(55, 30, 21, 0.18);

    border: 2px solid var(--paper-light);

    outline: 2px solid rgba(246, 237, 211, 0.30);
    outline-offset: 3px;

    box-shadow:
        3px 3px 0 rgba(55, 31, 22, 0.35);

    transform: rotate(-2deg);
}


.league-title {
    position: relative;
    z-index: 1;

    min-width: 0;

    text-shadow:
        1px 2px 0 rgba(59, 31, 22, 0.30);
}


.eyebrow {
    margin: 0 0 3px;

    font-size: 11px;
    font-weight: bold;

    letter-spacing: 0.12em;
    text-transform: uppercase;

    opacity: 0.85;
}


h1 {
    margin: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: clamp(29px, 6vw, 48px);
    font-weight: normal;

    line-height: 1;
}


/* ============================================
   NAVIGATION
============================================ */

.main-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);

    background-color: #cfb786;

    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.08),
            rgba(104, 69, 41, 0.05)
        );

    border-bottom: 2px solid var(--line);
}


.nav-button {
    position: relative;

    padding: 14px 6px;

    border: 0;
    border-right: 1px solid rgba(71, 52, 37, 0.32);

    background: transparent;

    color: var(--ink);

    font-family:
        "Libre Baskerville",
        Georgia,
        serif;

    font-size: 12px;
    font-weight: bold;

    cursor: pointer;

    transition:
        background 120ms ease,
        color 120ms ease;
}


.nav-button:last-child {
    border-right: 0;
}


.nav-button:hover {
    background: rgba(255, 250, 225, 0.25);
}


.nav-button.active {
    background: var(--paper-light);
}


.nav-button.active::after {
    content: "";

    position: absolute;

    left: 16%;
    right: 16%;
    bottom: 5px;

    height: 3px;

    background: var(--wood-dark);

    transform: rotate(-1deg);
}


/* ============================================
   PAGES
============================================ */

.page-content {
    padding: 28px 18px 80px;
}


.page {
    display: none;
}


.page.active {
    display: block;
}


.page-heading {
    margin-bottom: 22px;
}


.section-kicker {
    margin: 0 0 3px;

    color: var(--wood-dark);

    font-size: 11px;
    font-weight: bold;

    letter-spacing: 0.14em;
    text-transform: uppercase;
}


.page-heading h2 {
    margin: 0 0 8px;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: clamp(32px, 8vw, 48px);
    font-weight: normal;

    line-height: 1;
}


.page-heading p:last-child {
    max-width: 650px;

    margin: 0;

    color: var(--ink-soft);

    font-size: 14px;
    line-height: 1.6;
}


/* ============================================
   LEDGER PANELS
============================================ */

.ledger-panel {
    position: relative;

    padding: 20px;

    background-color: var(--paper-light);

    background-image:
        radial-gradient(
            circle at 15% 10%,
            rgba(255, 255, 255, 0.20),
            transparent 26%
        ),
        repeating-linear-gradient(
            2deg,
            rgba(72, 49, 28, 0.018) 0px,
            rgba(72, 49, 28, 0.018) 1px,
            transparent 1px,
            transparent 6px
        );

    border: 2px solid var(--line);

    box-shadow:
        4px 5px 0 rgba(81, 59, 42, 0.24);

    margin-bottom: 22px;
}


.ledger-panel::before {
    content: "";

    pointer-events: none;

    position: absolute;

    inset: 5px;

    border: 1px solid rgba(81, 58, 39, 0.22);
}


.panel-heading {
    position: relative;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 16px;

    padding-bottom: 14px;
    margin-bottom: 4px;

    border-bottom: 2px solid var(--line);
}


.small-label {
    margin: 0 0 4px;

    color: var(--wood-dark);

    font-size: 10px;
    font-weight: bold;

    letter-spacing: 0.12em;
    text-transform: uppercase;
}


.ledger-panel h3 {
    margin: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 26px;
    font-weight: normal;
}


/* little wooden season plaque */

.season-label {
    position: relative;

    padding: 6px 9px;

    color: var(--paper-light);

    background-color: var(--wood);

    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 17px,
            rgba(67, 37, 25, 0.13) 18px,
            transparent 19px
        );

    border: 2px solid var(--wood-deep);

    box-shadow:
        2px 2px 0 rgba(58, 38, 27, 0.25);

    font-size: 10px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;

    transform: rotate(1deg);
}


/* ============================================
   LEADERBOARD
============================================ */

.leaderboard {
    position: relative;

    display: flex;
    flex-direction: column;
}


.rank-row {
    display: grid;

    grid-template-columns:
        46px
        minmax(0, 1fr)
        auto;

    align-items: center;

    min-height: 57px;

    border-bottom: 1px solid rgba(81, 60, 42, 0.35);
}


.rank-row:last-child {
    border-bottom: 0;
}


.rank-number {
    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 24px;

    color: var(--wood-dark);
}


.player-name {
    overflow: hidden;

    font-weight: bold;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.elo {
    padding-left: 14px;

    font-weight: bold;
}


.elo::after {
    content: " Elo";

    color: var(--ink-soft);

    font-size: 9px;
    font-weight: normal;

    text-transform: uppercase;
}


.loading-message {
    padding: 18px 0;

    color: var(--ink-soft);

    font-style: italic;
}


/* ============================================
   HOME CARDS
============================================ */

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 18px;
}


.small-panel {
    margin-bottom: 0;
}


.small-panel p:not(.small-label) {
    position: relative;

    color: var(--ink-soft);

    font-size: 13px;
    line-height: 1.6;
}


.text-button {
    position: relative;

    margin-top: 6px;
    padding: 4px 0;

    border: 0;
    border-bottom: 2px solid var(--wood-dark);

    color: var(--wood-dark);
    background: transparent;

    font-weight: bold;

    cursor: pointer;

    transition:
        color 120ms ease,
        border-color 120ms ease;
}


.text-button:hover {
    color: var(--wood-deep);
    border-color: var(--wood-deep);
}


/* ============================================
   EMPTY STATES
============================================ */

.empty-state {
    padding-top: 44px;
    padding-bottom: 44px;

    text-align: center;
}


.empty-state p:last-child {
    position: relative;

    max-width: 560px;

    margin: 12px auto 0;

    color: var(--ink-soft);

    font-size: 14px;
    line-height: 1.7;
}


/* ============================================
   FOOTER — DARK WOOD
============================================ */

.site-footer {
    position: relative;

    padding: 20px;

    color: var(--paper-light);

    background-color: var(--wood-dark);

    background-image:

        radial-gradient(
            ellipse at 25% 40%,
            rgba(189, 122, 78, 0.15),
            transparent 24%
        ),

        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 105px,
            rgba(40, 23, 18, 0.45) 106px,
            rgba(40, 23, 18, 0.45) 108px,
            transparent 111px
        ),

        linear-gradient(
            180deg,
            #70432e,
            var(--wood-dark)
        );

    border-top: 4px solid var(--wood-deep);

    box-shadow:
        inset 0 2px rgba(255, 210, 157, 0.10);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    text-align: center;

    text-shadow:
        1px 2px rgba(44, 24, 18, 0.35);
}

/* ============================================
   FACTION DIRECTORY
============================================ */

.faction-toolbar {
    display: flex;
    gap: 8px;

    margin-bottom: 18px;
}

.faction-filter {
    padding: 8px 13px;

    color: var(--ink);

    background: var(--paper-dark);

    border: 2px solid var(--line);

    box-shadow:
        2px 2px 0 rgba(71, 49, 34, 0.20);

    font-size: 11px;
    font-weight: bold;

    cursor: pointer;
}

.faction-filter:hover {
    background: var(--paper-light);
}

.faction-filter.active {
    color: var(--paper-light);

    background: var(--wood);
    border-color: var(--wood-deep);
}


.faction-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}


.faction-card {
    position: relative;

    min-height: 225px;

    padding: 18px;

    background-color: var(--paper-light);

    background-image:
        repeating-linear-gradient(
            2deg,
            rgba(72, 49, 28, 0.018) 0px,
            rgba(72, 49, 28, 0.018) 1px,
            transparent 1px,
            transparent 6px
        );

    border: 2px solid var(--line);

    box-shadow:
        4px 4px 0 rgba(81, 59, 42, 0.22);
    
    overflow: hidden;
}

.faction-stat-value {
    display: block;

    min-width: 0;

    overflow: hidden;

    font-weight: bold;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.faction-card::before {
    content: "";

    position: absolute;
    inset: 5px;

    pointer-events: none;

    border: 1px solid rgba(81, 58, 39, 0.20);
}


.faction-card-header {
    position: relative;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 12px;

    padding-bottom: 12px;

    border-bottom: 1px solid rgba(81, 60, 42, 0.35);
}


.faction-card h3 {
    margin: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 24px;
    font-weight: normal;

    line-height: 1.05;
}


.faction-type {
    flex-shrink: 0;

    padding: 4px 6px;

    border: 1px solid var(--wood-dark);

    color: var(--wood-dark);

    font-size: 8px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.faction-stats {
    position: relative;

    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;

    padding-top: 15px;
}


.faction-stat-label {
    display: block;

    margin-bottom: 3px;

    color: var(--ink-soft);

    font-size: 9px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.faction-stat-value {
    display: block;

    font-weight: bold;
}


.faction-open-button {
    position: relative;

    margin-top: 18px;
    padding: 0 0 3px;

    border: 0;
    border-bottom: 2px solid var(--wood-dark);

    color: var(--wood-dark);
    background: transparent;

    font-weight: bold;

    cursor: pointer;
}

/* ============================================
   FACTION IDENTITY
============================================ */


/* Thick faction-color edge */

.faction-color-stripe {
    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;

    width: 9px;

    background:
        linear-gradient(
            90deg,
            var(--faction-dark),
            var(--faction-color)
        );

    border-right: 2px solid var(--faction-dark);
}


/* Top row containing seal + Official/Fan */

.faction-card-top {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-left: 7px;
    margin-bottom: 12px;
}


/* Little faction token / wax seal */

.faction-seal {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    flex-shrink: 0;

    color: #fff7df;

    background-color: var(--faction-color);

    border: 3px solid var(--faction-dark);

    border-radius: 50%;

    box-shadow:
        2px 3px 0 rgba(59, 42, 29, 0.22),
        inset 0 0 0 2px rgba(255, 245, 215, 0.16);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 14px;

    letter-spacing: 0.04em;

    transform: rotate(-3deg);
}


/* Give the title room after the stripe */

.faction-card-header {
    margin-left: 7px;
}


/* Faction name now subtly inherits faction identity */

.faction-card h3 {
    color: var(--faction-dark);
}


/* Stats line up with title */

.faction-stats {
    margin-left: 7px;
}


/* Button also adopts faction color */

.faction-open-button {
    margin-left: 7px;

    color: var(--faction-dark);

    border-bottom-color: var(--faction-color);
}


.faction-open-button:hover {
    color: var(--faction-color);
}


/* Type badge gets a little faction tint */

.faction-type {
    color: var(--faction-dark);

    border-color: var(--faction-color);

    background:
        color-mix(
            in srgb,
            var(--faction-color) 10%,
            transparent
        );
}

/* ============================================
   FACTION DETAIL PAGE
============================================ */

.hidden {
    display: none !important;
}


.back-button {
    margin-bottom: 18px;
    padding: 7px 0;

    border: 0;
    border-bottom: 2px solid var(--wood-dark);

    color: var(--wood-dark);
    background: transparent;

    font-weight: bold;

    cursor: pointer;
}


.faction-detail-banner {
    position: relative;

    display: flex;
    align-items: center;

    gap: 18px;

    padding: 22px;

    margin-bottom: 18px;

    overflow: hidden;

    background: var(--paper-light);

    border: 2px solid var(--faction-dark);
    border-left: 12px solid var(--faction-color);

    box-shadow:
        4px 5px 0 rgba(81, 59, 42, 0.22);
}


.faction-detail-banner::after {
    content: "";

    position: absolute;

    right: -40px;
    top: -45px;

    width: 150px;
    height: 150px;

    border-radius: 50%;

    background: var(--faction-color);

    opacity: 0.09;

    pointer-events: none;
}


.faction-detail-seal {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 66px;
    height: 66px;

    flex-shrink: 0;

    border-radius: 50%;

    color: #fff7df;

    background: var(--faction-color);

    border: 4px solid var(--faction-dark);

    box-shadow:
        3px 3px 0 rgba(59, 42, 29, 0.22),
        inset 0 0 0 2px rgba(255, 245, 215, 0.16);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 19px;

    transform: rotate(-3deg);
}


.faction-detail-title {
    position: relative;
    z-index: 1;
}


.faction-detail-title h2 {
    margin: 0;

    color: var(--faction-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: clamp(30px, 7vw, 44px);
    font-weight: normal;

    line-height: 1;
}


.faction-summary-grid {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 12px;

    margin-bottom: 22px;
}


.faction-summary-card {
    margin: 0;

    text-align: center;
}


.faction-summary-card strong {
    position: relative;

    display: block;

    margin-top: 6px;

    color: var(--faction-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 25px;
    font-weight: normal;
}


.provisional-key {
    padding: 5px 8px;

    color: var(--ink-soft);

    background: var(--paper-dark);

    border: 1px solid var(--line);

    font-size: 9px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


/* ---------- STANDINGS ROW ---------- */

.faction-standing-row {
    display: grid;

    grid-template-columns:
        45px
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 10px;

    min-height: 68px;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.32);
}


.faction-standing-row:last-child {
    border-bottom: 0;
}


.faction-rank {
    color: var(--faction-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 25px;
}


.faction-player-info {
    min-width: 0;
}


.faction-player-name {
    display: block;

    overflow: hidden;

    font-weight: bold;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.faction-player-status {
    display: block;

    margin-top: 4px;

    color: var(--ink-soft);

    font-size: 9px;
    font-weight: bold;

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.status-ranked {
    color: var(--faction-dark);
}


.status-provisional {
    color: var(--ink-soft);
}


.faction-rating {
    text-align: right;
}


.faction-rating strong {
    display: block;

    font-size: 18px;
}


.faction-rating span {
    display: block;

    margin-top: 2px;

    color: var(--ink-soft);

    font-size: 9px;
    text-transform: uppercase;
}


.faction-empty-state {
    padding: 34px 10px;

    color: var(--ink-soft);

    text-align: center;
}


.faction-empty-state strong {
    display: block;

    margin-bottom: 7px;

    color: var(--ink);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 25px;
    font-weight: normal;
}

/* ============================================
   RECORD GAME
============================================ */

.match-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 14px;

    margin: 18px 0 26px;
}


.form-field {
    display: flex;
    flex-direction: column;

    gap: 7px;
}


.form-field > span {
    color: var(--ink-soft);

    font-size: 10px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.form-field em {
    font-weight: normal;
    text-transform: lowercase;
}


.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;

    padding: 11px 12px;

    color: var(--ink);

    background: var(--paper-light);

    border: 2px solid var(--line);

    border-radius: 0;

    font-family:
        "Libre Baskerville",
        Georgia,
        serif;

    font-size: 14px;
}


.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 3px solid rgba(169, 104, 67, 0.22);
}


.participants-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;

    gap: 14px;

    padding-bottom: 12px;
    margin-bottom: 12px;

    border-bottom: 2px solid var(--line);
}


.participants-heading h3 {
    margin: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 25px;
    font-weight: normal;
}


.wood-button,
.submit-match-button {
    color: var(--paper-light);

    background-color: var(--wood);

    border: 2px solid var(--wood-deep);

    box-shadow:
        3px 3px 0 rgba(61, 40, 27, 0.28);

    font-weight: bold;

    cursor: pointer;
}


.wood-button {
    padding: 8px 11px;

    font-size: 11px;
}


.submit-match-button {
    width: 100%;

    margin-top: 18px;
    padding: 14px;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 20px;
    font-weight: normal;
}


.participant-row {
    position: relative;

    display: grid;

    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(0, 1.4fr)
        90px
        42px;

    gap: 9px;

    align-items: end;

    padding: 14px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.30);
}


.participant-row:last-child {
    border-bottom: 0;
}


.participant-number {
    position: absolute;

    left: -8px;
    top: 5px;

    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 15px;
}


.remove-participant {
    width: 38px;
    height: 38px;

    padding: 0;

    color: var(--wood-dark);

    background: transparent;

    border: 2px solid var(--wood-dark);

    font-weight: bold;

    cursor: pointer;
}


.notes-field {
    margin-top: 24px;
}


.form-message {
    margin-top: 18px;
    padding: 12px;

    border: 2px solid var(--wood-dark);

    background: #f0d8c5;

    color: #6a3026;

    font-size: 13px;
    line-height: 1.5;
}


.match-preview {
    margin-top: 20px;
    padding: 16px;

    background: var(--paper-dark);

    border: 2px solid var(--line);
}


.preview-result-row {
    display: grid;

    grid-template-columns:
        45px
        minmax(0, 1fr)
        auto;

    gap: 10px;

    align-items: center;

    padding: 9px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.28);
}


.preview-result-row:last-child {
    border-bottom: 0;
}


.preview-placement {
    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 20px;
}


.preview-player {
    font-weight: bold;
}


.preview-faction {
    display: block;

    margin-top: 2px;

    color: var(--ink-soft);

    font-size: 9px;

    text-transform: uppercase;
}


.preview-vp {
    font-weight: bold;
}

/* ============================================
   ACCOUNTS + PROFILE
============================================ */

.profile-state {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}


.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;

    margin: 18px 0 22px;

    border: 2px solid var(--line);
}


.auth-tab {
    padding: 11px;

    border: 0;

    color: var(--ink);
    background: var(--paper-dark);

    font-weight: bold;

    cursor: pointer;
}


.auth-tab:first-child {
    border-right: 1px solid var(--line);
}


.auth-tab.active {
    color: var(--paper-light);

    background: var(--wood);
}


.auth-form {
    display: flex;
    flex-direction: column;

    gap: 16px;
}


#claim-player-form,
#nickname-form {
    display: flex;
    flex-direction: column;

    gap: 16px;
}


.profile-explanation {
    margin: 16px 0 22px;

    color: var(--ink-soft);

    font-size: 13px;
    line-height: 1.7;
}


.account-sign-out {
    margin-top: 22px;
}


.profile-hero {
    display: grid;

    grid-template-columns:
        80px
        minmax(0, 1fr)
        auto;

    gap: 18px;

    align-items: center;
}


.profile-crest {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 70px;
    height: 70px;

    color: var(--paper-light);

    background: var(--wood);

    border: 4px solid var(--wood-deep);

    border-radius: 50%;

    box-shadow:
        3px 4px 0 rgba(59, 42, 29, 0.22);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 20px;

    transform: rotate(-3deg);
}


.profile-identity h3 {
    margin: 0;

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 34px;
    font-weight: normal;
}


.profile-identity p:last-child {
    margin: 4px 0 0;

    color: var(--ink-soft);

    font-size: 11px;
}


.profile-rating {
    text-align: right;
}


.profile-rating span {
    display: block;

    margin-bottom: 3px;

    color: var(--ink-soft);

    font-size: 9px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.profile-rating strong {
    display: block;

    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 35px;
    font-weight: normal;
}


.profile-save-button {
    align-self: flex-start;

    margin-top: 2px;
}

/* ============================================
   ELO PREVIEW + CONFIRMATION
============================================ */

.elo-preview-results {
    margin-top: 16px;

    border-top: 2px solid var(--line);
}


.elo-preview-player {
    padding: 14px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.28);
}


.elo-preview-player:last-child {
    border-bottom: 0;
}


.elo-preview-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-bottom: 9px;
}


.elo-preview-heading strong {
    font-size: 14px;
}


.elo-change-positive {
    color: #53633b;

    font-weight: bold;
}


.elo-change-negative {
    color: #8a3e32;

    font-weight: bold;
}


.elo-change-neutral {
    color: var(--ink-soft);

    font-weight: bold;
}


.elo-preview-lines {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 8px;
}


.elo-preview-line {
    padding: 8px;

    background:
        rgba(255, 250, 225, 0.34);

    border: 1px solid
        rgba(81, 60, 42, 0.24);
}


.elo-preview-line span {
    display: block;

    margin-bottom: 4px;

    color: var(--ink-soft);

    font-size: 8px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.elo-preview-line strong {
    font-size: 13px;
}


.provisional-preview {
    display: block;

    margin-top: 4px;

    color: var(--ink-soft);

    font-size: 8px;
    font-weight: bold;

    text-transform: uppercase;
}


.match-confirm-actions {
    display: grid;

    grid-template-columns:
        auto
        minmax(220px, 1fr);

    gap: 18px;

    align-items: center;

    margin-top: 16px;
}


.match-confirm-actions
.submit-match-button {
    margin-top: 0;
}


.match-recorded-message {
    padding: 16px;

    color: #41462d;

    background: #e2dfbd;

    border: 2px solid #62683e;

    font-weight: bold;

    text-align: center;
}

/* ============================================
   MATCH HISTORY
============================================ */

.match-history-card {
    position: relative;

    padding: 15px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.32);
}


.match-history-card:last-child {
    border-bottom: 0;
}


.match-history-main {
    display: grid;

    grid-template-columns:
        70px
        minmax(0, 1fr)
        auto;

    gap: 14px;

    align-items: center;
}


.match-history-date {
    color: var(--ink-soft);

    font-size: 10px;

    text-align: center;
}


.match-history-winner {
    font-weight: bold;
}


.match-history-faction {
    display: block;

    margin-top: 3px;

    color: var(--ink-soft);

    font-size: 9px;

    text-transform: uppercase;
}


.match-history-open {
    border: 0;
    border-bottom: 2px solid var(--wood-dark);

    color: var(--wood-dark);
    background: transparent;

    font-weight: bold;

    cursor: pointer;
}


.match-history-voided {
    opacity: 0.55;
}


.match-status {
    padding: 5px 8px;

    border: 1px solid var(--line);

    background: var(--paper-dark);

    font-size: 9px;
    font-weight: bold;

    text-transform: uppercase;
}


.match-status.voided {
    color: #7a3028;

    background: #e9c5b7;

    border-color: #7a3028;
}


.match-detail-result {
    display: grid;

    grid-template-columns:
        45px
        minmax(0, 1fr)
        auto;

    gap: 12px;

    align-items: center;

    padding: 13px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.30);
}


.match-detail-result:last-child {
    border-bottom: 0;
}


.match-detail-placement {
    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 23px;
}


.match-detail-player {
    font-weight: bold;
}


.match-detail-faction {
    display: block;

    margin-top: 3px;

    color: var(--ink-soft);

    font-size: 9px;

    text-transform: uppercase;
}


.match-detail-rating {
    text-align: right;

    font-size: 11px;
}


.match-detail-rating strong {
    display: block;

    font-size: 15px;
}


.match-detail-meta {
    margin-top: 18px;
    padding-top: 14px;

    border-top: 2px solid var(--line);

    color: var(--ink-soft);

    font-size: 11px;
    line-height: 1.7;
}


.admin-match-actions {
    margin-top: 18px;
}


.danger-button {
    padding: 9px 12px;

    color: #fff2e8;

    background: #8a3e32;

    border: 2px solid #5c2821;

    box-shadow:
        3px 3px 0 rgba(66, 35, 27, 0.25);

    font-weight: bold;

    cursor: pointer;
}

/* ============================================
   PLAYER PROFILE STATISTICS
============================================ */

.player-stat-grid {
    display: grid;

    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 10px;

    margin-top: 16px;
}


.player-stat-card {
    padding: 13px 10px;

    background:
        rgba(255, 250, 225, 0.34);

    border:
        1px solid rgba(81, 60, 42, 0.28);

    text-align: center;
}


.player-stat-card span {
    display: block;

    margin-bottom: 5px;

    color: var(--ink-soft);

    font-size: 8px;
    font-weight: bold;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.player-stat-card strong {
    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 25px;
    font-weight: normal;
}


/* RECENT FORM */

.recent-form {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 15px;
}


.form-result-chip {
    min-width: 74px;

    padding: 10px;

    background:
        rgba(255, 250, 225, 0.38);

    border: 1px solid
        rgba(81, 60, 42, 0.30);

    text-align: center;
}


.form-result-chip strong {
    display: block;

    color: var(--wood-dark);

    font-family:
        "IM FELL English SC",
        Georgia,
        serif;

    font-size: 20px;
    font-weight: normal;
}


.form-result-chip span {
    display: block;

    margin-top: 3px;

    color: var(--ink-soft);

    font-size: 8px;

    text-transform: uppercase;
}


/* FACTION MASTERY */

.profile-faction-mastery {
    display: flex;

    flex-direction: column;
}


.mastery-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        85px
        85px
        85px;

    gap: 10px;

    align-items: center;

    padding: 13px 0;

    border-bottom:
        1px solid rgba(81, 60, 42, 0.28);
}


.mastery-row:last-child {
    border-bottom: 0;
}


.mastery-faction {
    display: flex;

    align-items: center;

    gap: 10px;

    min-width: 0;
}


.mastery-seal {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    flex-shrink: 0;

    color: var(--paper-light);

    background:
        var(--faction-color);

    border: 2px solid
        var(--faction-dark);

    border-radius: 50%;

    font-size: 9px;
    font-weight: bold;
}


.mastery-name {
    min-width: 0;

    font-weight: bold;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.mastery-value {
    text-align: right;
}


.mastery-value span {
    display: block;

    color: var(--ink-soft);

    font-size: 7px;
    font-weight: bold;

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.mastery-value strong {
    display: block;

    margin-top: 3px;

    font-size: 12px;
}


.mastery-provisional {
    display: block;

    margin-top: 3px;

    color: var(--ink-soft);

    font-size: 7px;

    text-transform: uppercase;
}

.recent-form .faction-empty-state {
    width: 100%;
    text-align: center;
}

/* ============================================
   PLAYER LINKS
============================================ */

.player-profile-link {
    padding: 0;

    border: 0;
    border-bottom: 1px solid transparent;

    color: inherit;
    background: transparent;

    font: inherit;
    font-weight: bold;

    cursor: pointer;

    text-align: left;
}


.player-profile-link:hover {
    color: var(--wood-dark);

    border-bottom-color:
        var(--wood-dark);
}


.player-profile-link:focus-visible {
    outline:
        2px solid var(--wood-dark);

    outline-offset: 3px;
}


.public-profile-loading {
    padding: 28px 0;

    color: var(--ink-soft);

    font-style: italic;

    text-align: center;
}


#public-profile-recent-form
.faction-empty-state {
    width: 100%;

    text-align: center;
}

/* ============================================
   LEAGUE TIERS
============================================ */

.tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: fit-content;

    padding: 4px 8px;

    border: 2px solid;

    box-shadow:
        2px 2px 0 rgba(54, 39, 29, 0.20);

    font-size: 8px;
    font-weight: bold;

    letter-spacing: 0.07em;
    text-transform: uppercase;

    white-space: nowrap;
}


.tier-copper {
    color: #f6e3ca;
    background: #9b603a;
    border-color: #653a25;
}


.tier-bronze {
    color: #f7e7cc;
    background: #7f5734;
    border-color: #51371f;
}


.tier-silver {
    color: #34332f;
    background: #c0bfb5;
    border-color: #77756c;
}


.tier-gold {
    color: #3f321a;
    background: #c7a34c;
    border-color: #80652c;
}


.tier-platinum {
    color: #383934;
    background: #d7d6c9;
    border-color: #86867d;
}


.tier-root-master {
    color: #f4e5b8;
    background: #43583c;
    border-color: #b28e43;

    box-shadow:
        0 0 0 2px #43583c,
        0 0 0 4px #b28e43,
        3px 3px 0 rgba(54, 39, 29, 0.25);
}


.tier-mini {
    margin-top: 4px;

    padding: 2px 5px;

    border-width: 1px;

    box-shadow: none;

    font-size: 6px;
}


.profile-tier-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    gap: 5px;

    margin-top: 7px;
}


.profile-tier-progress {
    color: var(--ink-soft);

    font-size: 8px;

    text-transform: uppercase;
}


.stat-tier-caption {
    display: block;

    margin-top: 4px;

    color: var(--ink-soft);

    font-size: 7px;
    font-weight: bold;

    text-transform: uppercase;
}


.leaderboard-player-block {
    display: flex;
    flex-direction: column;

    align-items: flex-start;
}


.faction-tier {
    margin: 4px 0 2px auto;
}


.tier-transition {
    display: block;

    margin-top: 5px;

    font-size: 8px;
    font-weight: bold;

    text-transform: uppercase;
}


.tier-promotion {
    color: #53633b;
}


.tier-demotion {
    color: #8a3e32;
}

/* ============================================
   MOBILE
============================================ */

@media (max-width: 650px) {

    body {
        background: var(--paper);
    }


    .site-shell {
        border: 0;
    }


    .site-header {
        padding: 21px 16px 19px;

        /*
           Narrower planks on mobile so the
           texture remains visible.
        */
        background-image:

            radial-gradient(
                ellipse at 12% 25%,
                rgba(255, 205, 145, 0.15) 0%,
                transparent 24%
            ),

            radial-gradient(
                ellipse at 62% 78%,
                rgba(73, 39, 25, 0.12) 0%,
                transparent 28%
            ),

            repeating-linear-gradient(
                88deg,
                transparent 0px,
                transparent 14px,
                rgba(63, 34, 23, 0.07) 15px,
                transparent 16px,
                transparent 28px
            ),

            repeating-linear-gradient(
                90deg,
                transparent 0px,
                transparent 72px,
                rgba(55, 31, 22, 0.48) 73px,
                rgba(55, 31, 22, 0.48) 75px,
                rgba(212, 139, 85, 0.16) 76px,
                transparent 79px
            ),

            linear-gradient(
                180deg,
                var(--wood-light),
                var(--wood) 48%,
                var(--wood-mid)
            );
    }


    .league-mark {
        width: 52px;
        height: 52px;

        font-size: 19px;
    }


    .eyebrow {
        font-size: 9px;
    }


    .page-content {
        padding:
            24px
            14px
            92px;
    }


    .ledger-panel {
        padding: 17px;
    }


    .home-grid {
        grid-template-columns: 1fr;
    }


    /* Phone app-style bottom navigation */

    .main-nav {
        position: fixed;

        z-index: 100;

        left: 0;
        right: 0;
        bottom: 0;

        grid-template-columns: repeat(5, 1fr);

        background-color: #cfb786;

        border-top: 3px solid var(--wood-deep);
        border-bottom: 0;

        box-shadow:
            0 -3px 12px rgba(40, 29, 20, 0.22);
    }


    .nav-button {
        min-height: 58px;

        padding: 9px 2px;

        font-size: 10px;
    }


    .nav-button.active::after {
        bottom: 6px;
    }


    .site-footer {
        display: none;
    }

    .faction-grid {
    grid-template-columns: 1fr;
}

.faction-toolbar {
    overflow-x: auto;
}

.faction-filter {
    flex-shrink: 0;
}

.faction-summary-grid {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}


.faction-summary-top-pilot {
    grid-column: 1 / -1;
}


.faction-summary-card {
    padding: 13px;
}


.faction-detail-banner {
    padding: 17px;
}


.faction-detail-seal {
    width: 54px;
    height: 54px;

    font-size: 15px;
}

.match-details-grid {
    grid-template-columns: 1fr;
}


.participant-row {
    grid-template-columns:
        1fr
        1fr
        70px
        38px;
}


.participant-row .form-field > span {
    font-size: 8px;
}


.participant-row select,
.participant-row input {
    padding: 9px 7px;

    font-size: 12px;
}

.profile-hero {
    grid-template-columns:
        58px
        minmax(0, 1fr);
}


.profile-crest {
    width: 54px;
    height: 54px;

    font-size: 16px;
}


.profile-rating {
    grid-column: 1 / -1;

    padding-top: 13px;

    border-top:
        1px solid rgba(81, 60, 42, 0.30);

    text-align: left;
}

.elo-preview-lines {
    grid-template-columns: 1fr;
}


.match-confirm-actions {
    grid-template-columns: 1fr;
}


.match-confirm-actions
.text-button {
    justify-self: start;
}

.player-stat-grid {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}


.mastery-row {
    grid-template-columns:
        minmax(0, 1fr)
        65px;
}


.mastery-value:nth-child(3),
.mastery-value:nth-child(4) {
    display: none;
}

.profile-tier-block {
    align-items: flex-start;
}
}