@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Fredoka+One&display=swap');

/* ── Variables ── */
:root {
    --bg:          #1a0c0c;
    --card-bg:     transparent;
    --card-border: rgba(200,160,48,0.35);
    --card-shadow: none;

    --accent:      #c8a030;
    --accent-dark: #7a5a10;
    --accent-dim:  rgba(200,160,48,0.15);

    --text:       #e8d4a8;
    --text-muted: #aaa;
    --text-dim:   #5a2e18;

    --sidebar-bg:     #120808;
    --sidebar-border: #2a1010;
    --sidebar-text:   #b89050;
    --sidebar-active: #e8b830;

    --input-bg:     #0a1e2c;
    --input-border: rgba(200,160,48,0.4);
    --input-focus:  #c8a030;
    --input-shadow: 0 0 0 2px rgba(200,160,48,0.2);

    --error-bg:   #280808;  --error-text:   #e03030;  --error-border:   #581010;
    --success-bg: #081e10;  --success-text: #80d890;  --success-border: #184028;
    --info-bg:    #081020;  --info-text:    #80b8f8;  --info-border:    #182858;
    --dev-bg:     #1a1600;  --dev-text:     #c8a840;  --dev-border:     #302800;

    --badge-admin-bg:    rgba(80,0,160,0.10);   --badge-admin-text:    #5a1888;
    --badge-reviewer-bg: rgba(0,120,80,0.10);   --badge-reviewer-text: #006644;
    --badge-author-bg:   rgba(0,40,160,0.10);   --badge-author-text:   #183880;
    --badge-player-bg:   rgba(120,60,0,0.10);   --badge-player-text:   #6a3800;
    --badge-active-bg: rgba(0,80,20,0.10);   --badge-active-text: #186030;
    --badge-unver-bg:  rgba(160,80,0,0.10);  --badge-unver-text:  #8a5000;
    --badge-banned-bg: rgba(160,0,0,0.10);   --badge-banned-text: #8a1010;
    --badge-draft-bg:  rgba(100,60,0,0.10);  --badge-draft-text:  #6a3c10;
    --badge-ready-bg:  rgba(0,100,100,0.10); --badge-ready-text:  #106060;
    --badge-pub-bg:    rgba(0,100,30,0.10);  --badge-pub-text:    #18682e;

    --table-border: rgba(200,160,48,0.3);
    --table-hover:  rgba(180, 120, 40, 0.18);

    --scrollbar-track: rgba(200,160,48,0.08);
    --scrollbar-thumb: rgba(200,160,48,0.55);

    --btn-text:   #e8d4a8;
    --panel-text: #ffffff;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); }

/* ── Panels: Window 9 parchment background ── */
.page-card, .hero-card, .news-card {
    background: none;
    border: none;
    box-shadow: none;
}

/* ── Buttons: Wood plank sprite ── */
.btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    position: relative;
    isolation: isolate;
    background-color: transparent;
    box-shadow: none;
    height: 52px;
    min-width: 96px;
    padding: 0 2rem;
    transform: none;
    transition: none;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    text-decoration: none;
    white-space: nowrap;
    color: transparent;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("assets/ui/Buttons/Text Mode/Wood (1).png");
    background-size: 100% 100%;
    z-index: -1;
}
.btn:hover::before { background-image: url("assets/ui/Buttons/Text Mode/Wood (2).png"); }
.btn:active { filter: brightness(0.8); transform: translateY(1px); box-shadow: none; }

/* ── Shared two-tone yellow text style (used on spans inside buttons/labels) ── */
.btn-label, .game-label {
    font-family: 'Fredoka One', cursive;
    background: linear-gradient(to bottom, #FFE033 50%, #C8A428 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000) drop-shadow(0 2px 1px #000);
}

/* ── Bold headings ── */
.mobile-brand,
.card-title, .hero-card-name, .news-card-title {
    font-family: 'Fredoka One', Georgia, serif;
    font-weight: 700;
}

/* ── Per-page header icon (override --page-icon on body or page wrapper) ── */
:root {
    --page-icon:      url("assets/ui/Elements/Icons/Icon (22).png");
    --win-top-piece:  168px;  /* Part 1 natural display height */
    --win-bot-piece:  182px;  /* Part 3 natural display height */
    --win-top-join:   55px;   /* where Part 2 background starts (Part 1 visual bottom edge) */
    --win-bot-join:   60px;   /* where Part 2 background ends from bottom (Part 3 visual top edge) */
    --win-border-w:   73px;   /* horizontal 3-slice edge width */
}

/* ── Border bars ── */
:root {
    --top-border-h:    150px;  /* content start offset — image is taller and hangs 100px over content */
    --bottom-border-h: 0px;
}

body::before {
    content: '';
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 250px;  /* full image height; --top-border-h is only the content offset */
    background-image: url("assets/ui/Elements/Border/LongTop.png");
    background-position: calc(50% + 66px) top;
    background-size: 1041px 250px;
    background-repeat: no-repeat;
    z-index: 300;
    pointer-events: none;
}


/* ── Base ── */
html, body { height: 100%; overflow: hidden; }
html { font-size: 100%; }

body {
    font-family: 'Fredoka One', 'Crimson Pro', Georgia, serif;
    font-size: 16px;
    line-height: 2;
    background-color: var(--bg);
    background-image: url("assets/ui/BG2.png");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
}

body.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

body.centered::before {
    background-position: calc(50% - 50px) top;
}

a, a:hover { color: #fff; }

/* ── Auth card ── */
.card {
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    background: none;
}

.card::before {
    content: '';
    position: absolute;
    width: calc(100% + 240px);
    aspect-ratio: 887 / 1154;
    left: -120px;
    top: 50%;
    transform: translateY(-50%);
    background-image: url("assets/ui/Windows/5/Window.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    z-index: -1;
    pointer-events: none;
}

.card-title {
    font-size: 26px;
    color: #fff;
    margin-bottom: 0.75rem;
    letter-spacing: 0.04em;
}

.card-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.4rem; }

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}

label {
    display: block;
    font-size: 18px;
    color: #fff;
    margin-bottom: 0.6rem;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"] {
    width: 100%;
    padding: 0.75rem 0.85rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: #d4a020;
    font-size: 18px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="url"] { color: #fff; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus {
    border-color: var(--input-focus);
    box-shadow: var(--input-shadow);
}

input::placeholder,
textarea::placeholder { color: rgba(232, 212, 168, 0.38); }

/* Remove browser spinner arrows so number inputs look identical to text inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="file"] {
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    width: 44px;
    height: 44px;
    background-image: url("assets/ui/Buttons/Upload (1).png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    margin-right: 0.75rem;
    vertical-align: middle;
}

input[type="file"]:hover::file-selector-button,
input[type="file"]:hover::-webkit-file-upload-button {
    background-image: url("assets/ui/Buttons/Upload (2).png");
}

select {
    padding: 0.65rem 2.5rem 0.65rem 0.75rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: #d4a020;
    font-size: 16px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpolygon points='0,0 10,0 5,6' fill='%23d4a020'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 10px 6px;
}

select:focus { border-color: var(--input-focus); box-shadow: var(--input-shadow); }

/* ── Radio button group ── */
.radio-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

.radio-option {
    display: flex;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-option span {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.radio-option input[type="radio"]:checked + span {
    border-color: var(--input-focus);
    background: #000;
    color: #d4a020;
}

.radio-option:hover span {
    border-color: var(--input-focus);
}

/* ── Custom select dropdown ── */
.custom-select-wrap {
    position: relative;
    display: block;
}

.custom-select-trigger {
    display: block;
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 0.75rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: #d4a020;
    font-size: 16px;
    outline: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpolygon points='0,0 10,0 5,6' fill='%23d4a020'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 10px 6px;
    line-height: 1;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.custom-select-trigger.is-placeholder { color: rgba(232, 212, 168, 0.38); }

.custom-select-trigger:focus,
.custom-select-wrap.is-open .custom-select-trigger {
    border-color: var(--input-focus);
    box-shadow: var(--input-shadow);
    outline: none;
}

.custom-select-wrap.is-open .custom-select-trigger {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpolygon points='0,10 10,10 5,4' fill='%23d4a020'/%3E%3C/svg%3E");
    border-radius: 8px 8px 0 0;
}

.custom-select-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    min-width: 100%;
    width: max-content;
    z-index: 500;
    background: var(--input-bg);
    border: 2px solid var(--input-focus);
    border-top: none;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.6);
    max-height: 280px;
    overflow-y: auto;
}

.custom-select-wrap.is-open .custom-select-panel { display: block; }

.custom-select-option {
    padding: 0.65rem 0.75rem;
    font-size: 16px;
    color: #d4a020;
    cursor: pointer;
    border-bottom: 1px solid var(--card-border);
    line-height: 1.6;
    white-space: nowrap;
}

.custom-select-option:last-child { border-bottom: none; }

.custom-select-option.is-placeholder { color: rgba(232, 212, 168, 0.38); }

.custom-select-option.is-selected { color: #fff; }

.custom-select-option:hover,
.custom-select-option.is-focused {
    background: var(--accent-dim);
    color: #fff;
}


/* Centered form submit variant — fixed width, centered in parent */
.btn-block {
    display: block;
    width: 192px;
    margin: 1.5rem auto 0;
}

/* Auto-width inline variant */
.btn-auto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin-top: 0;
}

/* ── Small buttons ── */
.btn-sm {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    position: relative;
    isolation: isolate;
    background-color: transparent;
    box-shadow: none;
    height: 52px;
    min-width: 96px;
    padding: 0 2rem;
    font-size: 18px;
    cursor: pointer;
    transition: none;
    line-height: 1;
    transform: none;
    font-family: 'Fredoka One', cursive;
    text-decoration: none;
    white-space: nowrap;
    color: transparent;
}
.btn-sm::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("assets/ui/Buttons/Text Mode/Wood (1).png");
    background-size: 100% 100%;
    z-index: -1;
}
.btn-sm:hover::before { background-image: url("assets/ui/Buttons/Text Mode/Wood (2).png"); }
.btn-sm:active { filter: brightness(0.8); transform: translateY(1px); }

/* Semantic colour overrides — no-op now that text uses gradient */
.btn-primary, .btn-danger, .btn-success, .btn-neutral, .btn-warning { }

/* ── Named colour button classes — unified to btn style ── */
.btn-red, .btn-orange, .btn-gold { }

.btn-sq {
    appearance: none; -webkit-appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--card-border);
    background: var(--accent-dim);
    background-image: none;
    width: 34px; height: 34px; padding: 0;
    color: #fff; font-family: inherit; font-size: 16px;
    cursor: pointer; text-decoration: none;
    transition: none; box-shadow: none; transform: none;
}
.btn-sq:hover  { background: rgba(200,160,48,0.3); }
.btn-sq:active { filter: brightness(0.8); transform: translateY(1px); }

/* ── Inline field validation errors ── */
.field-error {
    font-size: 16px;
    color: var(--error-text);
    margin-top: 0.5rem;
    line-height: 2;
    min-height: 1em;
}

/* ── Toast container ── */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 360px;
    max-width: calc(100vw - 3rem);
    pointer-events: none;
}

/* ── Alerts / Toasts ── */
.alert {
    padding: 0.85rem 2.5rem 0.85rem 1rem;
    font-size: 16px;
    line-height: 1.6;
    border: 2px solid;
    position: relative;
    pointer-events: all;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.alert.toast-hiding {
    opacity: 0;
    transform: translateX(1rem);
}

.alert-dismiss {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    opacity: 0.6;
    padding: 0.25rem;
    color: inherit;
}

.alert-dismiss:hover { opacity: 1; }

.alert-error   { background: var(--error-bg);   color: var(--error-text);   border-color: var(--error-border); }
.alert-success { background: var(--success-bg);  color: var(--success-text); border-color: var(--success-border); }
.alert-info    { background: var(--info-bg);     color: var(--info-text);    border-color: var(--info-border); }

.alert a { color: inherit; text-decoration: underline; }

/* ── Dev box ── */
.dev-box {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: var(--dev-bg);
    border: 2px solid var(--dev-border);
    font-size: 16px;
    color: var(--dev-text);
    line-height: 2;
}

.dev-box strong { display: block; margin-bottom: 0.4rem; }
.dev-box a { color: #fff; word-break: break-all; }

/* ── Auth page links ── */
.links {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 16px;
    color: var(--text-muted);
}

.links a       { color: #fff; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* ── App layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 204px;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.site-title {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding-top: var(--top-border-h);
    padding-bottom: var(--bottom-border-h);
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
    padding: 0.9rem 1.25rem 0.35rem;
    font-size: 16px;
    color: var(--sidebar-text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    box-shadow: none;
    margin-top: 0.4rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 1rem 0 16px;
    text-decoration: none;
    font-size: 16px;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 2px;
    height: calc(204px * 201 / 559);
    transition: none;
    background-image: url("assets/ui/Elements/Tabs/Unselected (3).png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
}

.sidebar-nav a:hover  { background-image: url("assets/ui/Elements/Tabs/Selected (3).png"); }
.sidebar-nav a.active { background-image: url("assets/ui/Elements/Tabs/Selected (3).png"); }

.nav-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.nav-label {
    display: block;
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    line-height: 1.1;
    background: linear-gradient(to bottom, #FFE033 50%, #C8A428 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000) drop-shadow(0 2px 1px #000);
}

.sidebar-user {
    padding: 0 1rem 0 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    cursor: pointer;
    transition: none;
    height: calc(204px * 201 / 559);
    background-image: url("assets/ui/Elements/Tabs/Unselected (3).png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 2px;
}

.sidebar-user:hover       { background-image: url("assets/ui/Elements/Tabs/Selected (3).png"); }
.sidebar-user--active     { background-image: url("assets/ui/Elements/Tabs/Selected (3).png"); border-left: none; padding-left: 1.25rem; }

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border: none;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.sidebar-user-placeholder {
    width: 36px;
    height: 36px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: none;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.sidebar-user-name {
    color: #fff;
    line-height: 1;
}

.sidebar-user-role {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.sidebar-user-role .nav-label {
    font-size: 12px;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 1rem 0 16px;
    text-decoration: none;
    font-size: 16px;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 2px;
    height: calc(204px * 201 / 559);
    transition: none;
    background-image: url("assets/ui/Elements/Tabs/Unselected (3).png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.sidebar-logout:hover {
    background-image: url("assets/ui/Elements/Tabs/Selected (3).png");
}

/* ── Page content ── */
/* Auth pages use page-content only as an SPA swap target — pass layout through. */
.page-content[data-layout="auth"] {
    all: unset;
    display: contents;
}
.page-content[data-layout="auth"]::after { display: none; }

.page-content {
    margin-left: 212px;
    margin-top: calc(var(--top-border-h) + 16px + 9rem - 110px);
    height: calc(100vh - var(--top-border-h) - 9rem + 30px);
    overflow: visible;
    display: flex;
    flex-direction: column;
    margin-right: 16px;
    margin-bottom: 0;
    flex: 1;
    min-height: calc(var(--win-top-piece) + var(--win-bot-piece) + 200px);
    position: relative;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
    border-left: var(--win-border-w) solid transparent;
    border-right: var(--win-border-w) solid transparent;
    border-image-source: url("assets/ui/Windows/9/parts/Part (2).png");
    border-image-slice: 0 14% 0 14% fill;
    border-image-width: 0 var(--win-border-w) 0 var(--win-border-w);
    border-image-repeat: stretch;
}

.page-content::before {
    content: '';
    position: absolute;
    top: calc(var(--win-top-piece) * -0.05 - 80px);
    left: calc(-1 * var(--win-border-w));
    right: calc(-1 * var(--win-border-w));
    margin-left: auto;
    margin-right: auto;
    width: calc(var(--win-top-piece) * 1171 / 296);
    height: var(--win-top-piece);
    background-image: url("assets/ui/Windows/9/parts/Part (1).png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    z-index: 2;
    pointer-events: none;
    display: none;
}

.page-content::after {
    content: '';
    position: absolute;
    bottom: calc(var(--win-bot-piece) * -0.45 - 50px);
    left: calc(-1 * var(--win-border-w));
    right: calc(-1 * var(--win-border-w));
    margin-left: auto;
    margin-right: auto;
    width: calc(var(--win-bot-piece) * 1207 / 330);
    height: var(--win-bot-piece);
    background-image: url("assets/ui/Windows/9/parts/Part (3).png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    z-index: 2;
    pointer-events: none;
}

/* ── Small/secondary text ── */
.text-sm { font-size: 1rem; color: #ccc; }
small, .hint { font-size: 1rem; color: #ccc; font-weight: 400; }
.field-hint { display: block; font-size: 0.8rem; color: #aaa; margin-top: 0.25rem; }

/* ── Links inside content area ── */
.page-scroll a { color: #fff; }
.page-scroll a:hover { color: #fff; }

/* ── Buttons inside content area: extra horizontal padding ── */
.page-scroll .btn,
.page-scroll .btn-sm {
    padding: 0 3rem;
}

/* ── Content area headings ── */
.page-scroll h1,
.page-scroll h2,
.page-scroll h3,
.page-scroll h4 {
    font-family: 'Fredoka One', cursive;
    font-weight: 400;
    color: transparent;
    margin-bottom: 0.5rem;
}

/* ── Inner scroll container (created by JS, holds content below page-header) ── */
.page-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    margin-top: calc(var(--win-top-join) + 90px);
    margin-bottom: var(--win-bot-join);
    padding: 1.5rem 1.25rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,160,48,0.4) transparent;
}

.page-scroll::-webkit-scrollbar       { width: 6px; }
.page-scroll::-webkit-scrollbar-track { background: transparent; }
.page-scroll::-webkit-scrollbar-thumb { background: rgba(200,160,48,0.4); }

/* ── Table-wrapping card (replaces inline style="padding:0;overflow:hidden") ── */
.page-card-table {
    padding: 0;
    overflow: hidden;
}

.page-header {
    background: none;
    padding: 0;
    border-bottom: none;
    margin: 0;
    position: fixed;
    top: calc(var(--top-border-h) + 60px);
    left: 217px;
    right: 16px;
    z-index: 301;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.page-header h1 {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    height: 128px;
    width: calc(128px * 819 / 306);
    padding: 0 60px 28px 105px;
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: transparent;
}

.page-header h1::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("assets/ui/Elements/HUD/Long.png");
    background-size: 100% 100%;
    z-index: -1;
}

.page-header h1::after {
    content: '';
    position: absolute;
    width: 62px;
    height: 62px;
    left: 16px;
    top: 50%;
    transform: translateY(calc(-50% - 19px));
    background-image: var(--page-icon);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 20px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
    letter-spacing: 0.04em;
}

.back-link:hover { color: #fff; }

.back-arrow { font-size: 22px; line-height: 1; }

.page-body {
    padding: 2rem;
    background: none;
    border: none;
    box-shadow: none;
}

.page-card {
    padding: 1.25rem;
    font-size: 18px;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    font-size: 16px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    border: 2px solid rgba(0,0,0,0.5);
    border-radius: 999px;
    white-space: nowrap;
    color: #fff;
}

.badge-admin      { background: #7B2FBE; }
.badge-reviewer   { background: #1A8C6C; }
.badge-author     { background: #1A5EB8; }
.badge-player     { background: #8B5A00; }
.badge-active     { background: #1A7A30; }
.badge-unverified { background: #CC6600; }
.badge-banned     { background: #B01010; }
.badge-draft      { background: #8B6000; }
.badge-ready      { background: #107070; }
.badge-published  { background: #1A7A30; }

/* ── Buttons inside inner panels — compact sizing ── */

/* ── Data table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 18px;
}

.data-table-wrap {
    width: 100%;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 0.9rem;
    font-size: 16px;
    color: #fff;
    border-bottom: 2px solid var(--table-border);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--table-border);
    vertical-align: middle;
    color: #ddd;
    line-height: 1.7;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: var(--table-hover); }

.data-table .user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.data-table .user-cell img,
.data-table .user-cell .avatar-xs {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 2px solid var(--card-border);
    image-rendering: pixelated;
}

.data-table .user-cell .avatar-xs {
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.data-table .username { font-size: 16px; color: #fff; }
.data-table .subtext  { font-size: 16px; color: var(--text-muted); }

/* ── Filter bar ── */
/* ── Form row — button+input combos ── */
.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    flex-wrap: wrap;
}
.form-row .form-group { margin-bottom: 0; }
.form-row .btn,
.form-row .btn-sm {
    height: auto;
    min-width: 0;
    font-size: 18px;
    align-self: stretch;
}

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    gap: 0.85rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-bar .filter-group { display: flex; flex-direction: column; gap: 0.4rem; }
.filter-bar label         { font-size: 16px; color: #ddd; letter-spacing: 0.05em; }

.filter-bar input[type="text"],
.filter-bar select {
    padding: 0.55rem 0.75rem;
    font-size: 16px;
}
.filter-bar .btn,
.filter-bar .btn-sm,
.filter-bar .btn-auto {
    height: auto;
    min-width: 0;
    font-size: 16px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* ── User detail ── */
.user-detail-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--card-border);
}

.user-detail-avatar {
    width: 72px;
    height: 72px;
    border: 2px solid var(--accent);
    flex-shrink: 0;
    image-rendering: pixelated;
}

.user-detail-avatar-placeholder {
    width: 72px;
    height: 72px;
    background: var(--accent-dim);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.detail-item label {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    letter-spacing: 0.06em;
}

.detail-item span { font-size: 16px; color: #ddd; }

.action-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 1.25rem;
    border-top: 2px solid var(--card-border);
}

/* ── Profile page avatar ── */
.avatar-wrap    { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.avatar-img     { width: 64px; height: 64px; border: 2px solid var(--accent); flex-shrink: 0; image-rendering: pixelated; }
.avatar-placeholder {
    width: 64px; height: 64px;
    background: var(--accent-dim); border: 2px solid var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; flex-shrink: 0;
}
.avatar-hint { font-size: 16px; color: var(--text-muted); margin-top: 0.4rem; line-height: 2; }

/* ── Nav avatar in old top-nav (unused but kept for safety) ── */
.nav-avatar             { width: 32px; height: 32px; border: 2px solid var(--accent); image-rendering: pixelated; }
.nav-avatar-placeholder { width: 32px; height: 32px; background: var(--accent-dim); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1rem; }

/* ── Page header with inline action ── */
.page-header-row {
    display: contents;
}

.page-header-row .btn,
.page-header-row .btn-sm,
.page-header-row a.btn,
.page-header-row a.btn-sm {
    margin-top: -11px;
    margin-right: 50px;
}

.page-header-row h1 { margin: 0; }

/* ── Hero create button ── */
.btn-gold--disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Hero slot pips ── */
.hero-slots {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
}

.hero-slot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--card-border);
}

.hero-slot--filled {
    background: rgba(200,160,48,0.4);
    border-color: rgba(200,160,48,0.4);
}

.hero-slot--empty {
    background: transparent;
}

.hero-slot-label {
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-left: 0.4rem;
}

/* ── Admin hero list (user_detail.php) ── */
.admin-heroes-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 18px;
    color: #fff;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--card-border);
}

.admin-heroes-count {
    font-size: 16px;
    color: var(--text-muted);
}

.admin-hero-list { display: flex; flex-direction: column; }

.admin-hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 2px solid var(--card-border);
}

.admin-hero-row:last-child { border-bottom: none; padding-bottom: 0; }

.admin-hero-name {
    font-size: 16px;
    color: #fff;
    margin-bottom: 0.35rem;
}

.admin-hero-meta {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 2;
}

/* ── Heroes list ── */

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.hero-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 2px solid var(--card-border);
    border-radius: 8px;
}

.hero-card-name {
    font-size: 20px;
    color: #fff;
    word-break: break-word;
    line-height: 1.6;
}

.hero-card-class {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 0.3rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-stat-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 2px solid var(--card-border);
    border-bottom: 2px solid var(--card-border);
}
.hero-stat-row--combat {
    border-top: none;
    margin-top: -2px;
}

.hero-stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.hero-stat-label {
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: block;
}

.hero-stat-value {
    font-size: 16px;
    color: #fff;
    display: block;
}

.hero-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.hero-card-link:hover .hero-card-name { color: #fff; }

.hero-card-actions {
    padding-top: 0.25rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.hero-card-actions .btn-sm {
    flex: 0 0 auto;
    padding: 0 1.25rem;
}

.hero-card-confirm {
    padding-top: 0.25rem;
    font-size: 16px;
    color: var(--error-text);
    line-height: 2;
}

.hero-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 3;
}

/* ── Hero detail page ── */
.hero-detail-card { max-width: 680px; }

.hero-detail-identity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.hero-detail-class {
    font-size: 20px;
    color: #fff;
}

.hero-detail-vitals {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.hero-vital-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: right;
}

.hero-vital-label {
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: block;
}

.hero-vital-value {
    font-size: 20px;
    color: #fff;
    display: block;
}

.hero-section-title {
    font-size: 16px;
    color: #fff;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--card-border);
}

.hero-empty-section {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 2;
}

.hero-item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hero-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0;
    border-bottom: 2px solid var(--card-border);
}

.hero-item:last-child { border-bottom: none; padding-bottom: 0; }

.hero-item-name {
    font-size: 16px;
    color: #fff;
}

.hero-item-desc {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 2;
}

/* ── Hero creation ── */
.hero-create-step {
    font-size: 16px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    line-height: 2;
}

.stat-roll-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}

.stat-block {
    background: var(--accent-dim);
    border: 2px solid var(--card-border);
    padding: 0.6rem 0.4rem 0.5rem;
    text-align: center;
}

.stat-block-name {
    font-size: 16px;
    color: #ddd;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    display: block;
}

.stat-block-value {
    font-size: 18px;
    color: #fff;
    display: block;
    margin-bottom: 0.2rem;
    line-height: 1.5;
}

.stat-block-mod {
    font-size: 16px;
    color: #bbb;
    display: block;
}

/* ── Nav badge (pending count) ── */
.nav-badge {
    display: inline-block;
    background: var(--accent);
    color: #1a0f00;
    font-size: 16px;
    line-height: 1.4;
    padding: 0.1rem 0.4rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ── Friends ── */
.friend-add-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.friend-add-form > input[type="text"] { flex: 1; }

.friend-add-form .btn { margin-top: 0; flex-shrink: 0; }

.friend-list { display: flex; flex-direction: column; }

.friend-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 2px solid var(--card-border);
}

.friend-row:last-child { border-bottom: none; padding-bottom: 0; }

.friend-avatar {
    width: 40px;
    height: 40px;
    border: 2px solid var(--card-border);
    flex-shrink: 0;
    image-rendering: pixelated;
}

.friend-avatar-placeholder {
    width: 40px;
    height: 40px;
    background: var(--accent-dim);
    border: 2px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.friend-info { flex: 1; overflow: hidden; }

.friend-name {
    font-size: 16px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-username {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 0.05rem;
}

.friend-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

.friend-confirm {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.friend-confirm-text {
    font-size: 16px;
    color: var(--error-text);
}

/* ── News feed ── */
.news-list { display: flex; flex-direction: column; gap: 1.5rem; }

.news-card {
    padding: 1.25rem;
}

.news-card::after,
.resource-item::after {
    content: '';
    display: block;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 1332 / 92;
    background: url("assets/ui/Elements/Slider/Hor.png") center / 100% 100% no-repeat;
    margin-top: 1rem;
}

.news-card-title {
    font-size: 22px;
    color: #fff;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.news-card-meta {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    letter-spacing: 0.04em;
}

.news-card-body {
    font-size: 16px;
    color: #ddd;
    line-height: 2.2;
    white-space: pre-wrap;
}

.news-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 3;
}

/* ── News admin ── */
.news-admin-title {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
}

.news-admin-title:hover { text-decoration: underline; }

.news-admin-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.news-admin-confirm {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Textarea ── */
textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: #d4a020;
    font-size: 16px;
    line-height: 2;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:focus {
    border-color: var(--input-focus);
    box-shadow: var(--input-shadow);
}

/* ── Action cell (inline confirm pattern in table cells) ── */
.action-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Quest detail — version list ── */
.quest-meta-bar {
    display: flex;
    gap: 1.5rem;
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.version-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-card {
    border: 1px solid var(--card-border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.version-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--accent-dim);
    border-bottom: 1px solid var(--card-border);
}

.version-card-label {
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.version-card-name {
    font-size: 1rem;
    color: #fff;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.version-card-body {
    padding: 1rem;
    background: var(--card-bg);
}

.version-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 0.75rem;
}

.version-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.version-meta-label {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.version-meta-value {
    font-size: 1rem;
    color: #fff;
}

.version-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--card-border);
}

/* ── Quest file list ── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    background: var(--accent-dim);
    border-radius: 3px;
    border: 1px solid var(--card-border);
}

.file-item-name {
    flex: 1;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-size {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Quest file upload zone ── */
.file-upload-zone {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border: 2px dashed var(--card-border);
    border-radius: 4px;
    margin-top: 0.75rem;
    background: var(--accent-dim);
}

.upload-status {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ── Checkbox label ── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    letter-spacing: 0.05em;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
    cursor: pointer;
}

/* ── Resource list ── */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resource-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.25rem;
}

.resource-item::after {
    flex: 0 0 100%;
    height: 0;
    padding-bottom: calc(100% * 0.5 * 92 / 1332);
    background: url("assets/ui/Elements/Slider/Hor.png") center / 50% 100% no-repeat;
    margin-top: 1rem;
}

.resource-item-body {
    flex: 1;
    min-width: 0;
}

.resource-item-name {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 0.4rem;
}

.resource-item-desc {
    font-size: 1rem;
    color: #fff;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.resource-item-meta {
    font-size: 1rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-item-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.1rem;
}

/* ── Button loading / spinner ── */
button.btn-loading,
button.btn-loading:disabled {
    opacity: 0.65;
    pointer-events: none;
}

/* ══════════════════════════════════════════
   Responsive layout
   Breakpoint: ≤ 768px → mobile/tablet
   ══════════════════════════════════════════ */

/* ── Mobile top bar (hidden on desktop) ── */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--sidebar-bg);
    border-bottom: 2px solid var(--sidebar-border);
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    z-index: 90;
}

.mobile-brand {
    font-size: 16px;
    color: var(--sidebar-active);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Hamburger button (hidden on desktop) ── */
.sidebar-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: 2px solid var(--sidebar-border);
    color: var(--sidebar-active);
    cursor: pointer;
    flex-shrink: 0;
    transition: none;
}

/* Three-line icon drawn via CSS — avoids glyph/font-metric alignment issues */
.sidebar-hamburger::before {
    content: '';
    position: absolute;
    top: calc(50% - 7px);
    left: calc(50% - 9px);
    width: 18px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
}

.sidebar-hamburger:hover { border-color: var(--sidebar-active); }

/* ── Sidebar backdrop (mobile only) ── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

@media (max-width: 768px) {
    /* Lock body scrolling on mobile — fixed elements (topbar, sidebar) stay
       in place because .page-content becomes the scroll container instead. */
    html, body { height: 100%; overflow: hidden; }
    .app-layout { height: 100%; }
    html, body { height: 100%; overflow: hidden; }
    .app-layout { height: 100%; }
    .page-content {
        height: 100%;
        overflow: hidden;
    }
    .page-scroll {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        height: auto;
    }

    /* Show mobile topbar and hamburger */
    .mobile-topbar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }
    .sidebar-hamburger { display: flex; }

    /* Sidebar slides off-canvas by default */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 310;
    }

    /* Sidebar visible when body has .sidebar-open */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Hide desktop-only fixed chrome */
    .site-title { display: none; }
    body::before { display: none; }

    /* Page content: full width, no border-image edges, no fixed sizing */
    .page-content {
        margin: 0;
        width: auto;
        height: auto;
        min-height: 0;
        flex: 1;
        padding: 0 0 3rem;
        border: none;
        border-image: none;
        background-image: url("assets/ui/Windows/9/parts/Part (2).png");
        background-size: 100% 100%;
        background-repeat: no-repeat;
        box-shadow: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Hide window decorations on mobile */
    .page-content::before,
    .page-content::after { display: none; }

    /* Content header: flow with page, below topbar */
    .page-header {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        padding: 1rem 1rem 0;
        margin-top: 52px;
    }

    .page-header h1 {
        height: 64px;
        width: calc(64px * 819 / 306);
        font-size: 14px;
        padding: 0 30px 14px 52px;
    }

    .page-header h1::after {
        width: 31px;
        height: 31px;
        left: 8px;
        transform: translateY(calc(-50% - 9px));
    }

    /* Page scroll: fill remaining space; padding-bottom keeps content clear of bottom border */
    .page-scroll {
        margin-top: 0;
        margin-bottom: 0;
        padding: 1rem 1rem calc(var(--win-bot-join) + 1rem);
    }

    /* Page header row: wrap so the action button goes below on very small screens */
    .page-header-row {
        flex-wrap: wrap;
    }

    /* Reset add button offsets */
    .page-header-row .btn,
    .page-header-row .btn-sm,
    .page-header-row a.btn,
    .page-header-row a.btn-sm {
        margin-top: 0.5rem;
        margin-right: 0;
    }

    /* Table cards: allow horizontal scroll instead of clipping */
    .page-card-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Action cells: allow wrapping */
    .action-cell {
        flex-wrap: wrap;
    }

    /* Single-column hero grid */
    .hero-grid {
        grid-template-columns: 1fr;
    }

    /* Detail grid: single column */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Hero stat rows: allow attributes to wrap rather than squash */
    .hero-stat-row {
        flex-wrap: wrap;
    }
    .hero-stat-item {
        min-width: 80px;
    }

    /* Stat roll grid: 3 columns on mobile instead of 6 */
    .stat-roll-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* User detail header: allow avatar + info to wrap */
    .user-detail-header {
        flex-wrap: wrap;
    }

    /* Resource items: stack vertically on mobile */
    .resource-item {
        flex-direction: column;
    }

    .resource-item-actions {
        width: 100%;
    }

    /* Version actions: wrap */
    .version-actions {
        flex-wrap: wrap;
    }

    /* Quest meta bar: wrap */
    .quest-meta-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Auth card: tighter padding */
    .card {
        padding: 1.5rem 1.25rem;
    }

    /* Auth pages (login, register, forgot password, etc):
       body keeps height:100% so content overflows and overflow-y:auto scrolls. */
    body.centered {
        overflow-y: auto;
        align-items: flex-start;
        padding: 0.25rem 0.75rem;
    }
    body.centered .card {
        padding: 0.5rem 0.75rem 1.5rem;
    }
    body.centered .card-title {
        font-size: 18px;
        margin-bottom: 0.2rem;
    }
    body.centered .card-subtitle {
        font-size: 14px;
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }
    body.centered .form-row-2 {
        grid-template-columns: 1fr;
    }
    body.centered .form-group {
        margin-bottom: 0.35rem;
    }
    body.centered label {
        font-size: 14px;
        margin-bottom: 0.2rem;
    }
    body.centered input[type="text"],
    body.centered input[type="email"],
    body.centered input[type="password"] {
        padding: 0.4rem 0.65rem;
        font-size: 15px;
    }
    body.centered .btn {
        height: 38px;
    }
    body.centered .btn-block {
        margin-top: 0.4rem;
    }
    body.centered .links {
        margin-top: 0.4rem;
        font-size: 14px;
        color: #fff;
    }
    body.centered .links a,
    body.centered .links a:hover {
        color: #fff;
    }
    body.centered .field-hint {
        font-size: 12px;
    }
    body.centered .card::before {
        width: calc(100% + 120px);
        left: -60px;
    }

    /* Inline URL input in resource zones: allow wrapping */
    .file-upload-zone {
        flex-wrap: wrap;
    }

    /* Filter bar: always column on mobile */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .custom-select-wrap {
        min-width: 0 !important;
        width: 100%;
    }
    .filter-bar .btn,
    .filter-bar .btn-sm {
        align-self: flex-start;
    }

    /* Increase touch targets */
    .btn-sm {
        padding: 0 0.75rem;
        height: 40px;
    }

    .btn {
        padding: 0 0.75rem;
    }

    /* Ensure max-width cards don't leave side gaps on mobile */
    .page-card[style] {
        max-width: 100% !important;
    }
}

/* ── Auth pages on short screens (landscape phones, 390px height etc.) ─────
   max-width:768px won't fire in landscape, so target by height instead.    */
@media (max-height: 600px) {
    body.centered {
        overflow-y: auto;
        align-items: flex-start;
        padding: 50px 0.75rem 0.25rem;
    }
    body.centered .card {
        padding: 0.5rem 0.75rem 1.5rem;
    }
    body.centered .card-title {
        font-size: 18px;
        margin-bottom: 0.2rem;
    }
    body.centered .card-subtitle {
        font-size: 14px;
        margin-bottom: 0.4rem;
        line-height: 1.3;
    }
    body.centered .form-row-2 {
        grid-template-columns: 1fr 1fr;
    }
    body.centered .form-group {
        margin-bottom: 0.35rem;
    }
    body.centered label {
        font-size: 14px;
        margin-bottom: 0.2rem;
    }
    body.centered input[type="text"],
    body.centered input[type="email"],
    body.centered input[type="password"] {
        padding: 0.4rem 0.65rem;
        font-size: 15px;
    }
    body.centered .btn {
        height: 38px;
    }
    body.centered .btn-block {
        margin-top: 0.4rem;
    }
    body.centered .links {
        margin-top: 0.4rem;
        font-size: 14px;
        color: #fff;
    }
    body.centered .links a,
    body.centered .links a:hover {
        color: #fff;
    }
    body.centered .field-hint {
        font-size: 12px;
    }
    body.centered .card::before {
        width: calc(100% + 320px);
        left: -160px;
    }
}

