/* ============================================================
   SHARED FRAMEWORK — zero hex codes; all colors via variables.css
   Written with logical properties so one file serves LTR + RTL.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@media (max-width: 640px) { html { font-size: 16px; } }

body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
}

.container { max-width: var(--max-width); margin-inline: auto; padding-inline: var(--space); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---- header / nav — light, sticky, glass; signed-in state is a visible chip ---- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    color: var(--text);
    border-block-end: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: calc(var(--space) * 0.6); gap: var(--space); }
.brand { display: flex; align-items: center; gap: calc(var(--space) * 0.5); color: var(--brand-dark); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 36px; width: auto; }
.site-nav { display: flex; align-items: center; gap: calc(var(--space) * 0.9); flex-wrap: wrap; }
.site-nav a { color: var(--text); font-weight: 500; padding-block: 0.3rem; }
.site-nav a:hover { color: var(--brand); text-decoration: none; }
.nav-cta { color: var(--text-light) !important; font-weight: 600; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 0.25rem 0.6rem; font-size: 1.1rem; }

/* signed-in identity chip — you always know who you are */
.user-chip { display: inline-flex; align-items: center; gap: 0.5rem; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); border-radius: 999px; padding: 0.25rem 0.85rem 0.25rem 0.25rem; color: var(--text); text-decoration: none; }
.user-chip:hover { border-color: var(--brand); text-decoration: none; }
.user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 999px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: var(--text-light); font-weight: 700; font-size: 0.95rem; }
.user-name { font-weight: 600; font-size: 0.95rem; }

/* ---- hero ---- */
.hero { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 7%, var(--surface)), var(--surface)); border-block-end: 1px solid var(--border); padding: calc(var(--space) * 3) var(--space); text-align: center; }
.hero h1 { margin-block: 0 calc(var(--space) * 0.5); color: var(--brand-dark); font-size: 2.2rem; letter-spacing: -0.02em; }
.hero p { color: var(--text-muted); max-width: 46rem; margin-inline: auto; font-size: 1.1rem; }

/* ---- cards / grids ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space); margin-block: var(--space); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 1.25); box-shadow: var(--shadow-sm); transition: box-shadow 0.2s ease, transform 0.2s ease; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-block-start: 0; color: var(--brand-dark); }
.card .price { font-weight: 700; color: var(--brand); }

.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space); margin-block: var(--space); }
.listing-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 1.25); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.35rem; transition: box-shadow 0.2s ease, transform 0.2s ease; }
.listing-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.listing-card.featured { border-color: var(--accent); box-shadow: var(--shadow); }
.listing-card .meta { color: var(--text-muted); font-size: 0.9rem; }

/* ---- buttons — pills, confident, 44px touch targets ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border-radius: 999px; padding: 0.65rem 1.3rem; border: 1px solid transparent; cursor: pointer; font-size: 1rem; font-weight: 600; min-height: 44px; line-height: 1.3; transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--text-light); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-danger { background: var(--accent); color: var(--text-light); }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.9rem; min-height: 38px; }

/* ---- keyboard / focus visibility — easy to see where you are ---- */
a:focus-visible, .btn:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }

/* ---- tables — card-contained, readable, never wider than the view ----
   main.js wraps every table in .table-wrap and copies header text into
   data-label attributes, so narrow screens get stacked rows with labels
   instead of a sideways-squished table. */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-block: var(--space);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; margin: 0; }
th, td { text-align: start; padding: 0.85rem 1rem; border-block-end: 1px solid var(--border); vertical-align: top; }
td { overflow-wrap: break-word; word-break: break-word; }
tr:last-child td { border-block-end: none; }
th {
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    border-block-end: 2px solid var(--border);
    white-space: nowrap;
}
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
td .btn, td form { margin-block: 0.15rem; }

/* narrow screens: each row becomes a labeled card — no horizontal scrolling needed */
@media (max-width: 720px) {
    .table-wrap { border: none; background: transparent; box-shadow: none; overflow-x: visible; }
    .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
    .table-wrap thead { position: absolute; inset-inline-start: -9999px; height: 0; overflow: hidden; }
    .table-wrap tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        margin-block-end: 0.75rem;
        padding: 0.35rem 0;
    }
    .table-wrap tr:hover { background: var(--surface); }
    .table-wrap tbody tr:nth-child(even) { background: var(--surface); }
    .table-wrap td { border-block-end: 1px dashed var(--border); padding: 0.55rem 1rem; }
    .table-wrap td:last-child { border-block-end: none; }
    .table-wrap td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.8rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        margin-block-end: 0.15rem;
    }
    .table-wrap td[data-label=""]::before { content: none; }
}

/* ---- forms ---- */
form .field { margin-block-end: var(--space); }
label { display: block; margin-block-end: 0.3rem; font-weight: 600; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], select, textarea {
    width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--input-border); border-radius: var(--radius-sm);
    background: var(--input-bg); color: var(--text); font: inherit;
}
textarea { min-height: 130px; }
.form-hint { color: var(--text-muted); font-size: 0.85rem; }
.hp { position: absolute; inset-inline-start: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ---- badges / alerts ---- */
.badge { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.badge-featured { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--brand-dark); border-color: var(--accent); }
.badge-ok { background: var(--success-bg); color: var(--success-text); border-color: var(--success-text); }

.alert { max-width: var(--max-width); margin: var(--space) auto; padding: 0.7rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-text); }
.alert-error { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--brand-dark); border-color: var(--accent); }
.alert-info { background: var(--surface); color: var(--text); }

/* ---- news / jobs / misc ---- */
.news-card { border-block-end: 1px solid var(--border); padding-block: var(--space); }
.news-card .source { color: var(--text-muted); font-size: 0.85rem; }
.job-row { display: flex; justify-content: space-between; gap: var(--space); align-items: baseline; flex-wrap: wrap; }
.job-row .company { color: var(--text-muted); }
.filter-bar { display: flex; gap: calc(var(--space) * 0.5); flex-wrap: wrap; margin-block: var(--space); }
.page-head { margin-block: calc(var(--space) * 2) calc(var(--space) * 1.5); max-width: 60rem; }
.page-head h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin-block-end: 0.35rem; }
.page-head p { color: var(--text-muted); font-size: 1.05rem; margin-block-start: 0; }

/* comfortable rhythm between sections — nothing feels crowded */
main.container > section, main.container > form { margin-block: calc(var(--space) * 1.75); }
main.container > .page-head:first-child { margin-block-start: calc(var(--space) * 1.75); }
.error-page { text-align: center; padding-block: calc(var(--space) * 3); }

/* ---- legal pages ---- */
.legal-page { max-width: 52rem; white-space: pre-wrap; }

/* ---- footer — light and quiet, not a dark slab ---- */
.site-footer { background: var(--surface); color: var(--text-muted); margin-block-start: calc(var(--space) * 2.5); border-block-start: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; gap: var(--space); flex-wrap: wrap; padding-block: var(--space); font-size: 0.92rem; }
.footer-links a { color: var(--brand); margin-inline-start: var(--space); }

/* ---- responsive ---- */
@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .site-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; }
    .site-nav.open { display: flex; }
    .header-inner { flex-wrap: wrap; }
    .hero h1 { font-size: 1.5rem; }
}

.badge-err { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--brand-dark); border-color: var(--accent); }
.badge-accent { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--brand-dark); border-color: var(--accent); }
.badge-soft { background: var(--surface); color: var(--text-muted); }
.kind-picker { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin: 0 0 1rem; }
.kind-picker legend { font-weight: 600; padding: 0 0.4rem; }
.kind-option { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; margin: 0.35rem 0; }
.panel { margin-block: calc(var(--space) * 1.5); padding: calc(var(--space) * 1.25); border: 1px solid var(--border); border-radius: var(--radius, 8px); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel h2 { margin-top: 0; font-size: 1.35rem; }
.panel .form-hint { font-size: 0.95rem; }

/* ---- sticky footer ----
   Short pages: footer pinned to the bottom of the viewport.
   Long pages: footer scrolls naturally after the content (never overlaps). */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;   /* fallback */
    min-height: 100dvh;  /* mobile-correct viewport height */
}
main.container { flex: 1 0 auto; }   /* grows to fill leftover space, pushing the footer down */
.site-footer { flex-shrink: 0; }     /* never squished, never overlapping */

/* ---- stats module ---- */
.spark { width: 100%; max-width: 420px; height: 40px; display: block; }
.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space); }
@media (max-width: 640px) { .stats-cols { grid-template-columns: 1fr; } }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space); margin-block: var(--space); }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius, 8px); padding: var(--space); background: var(--surface); text-align: center; }
.stat-card .num { font-size: 1.6rem; font-weight: 700; color: var(--brand); }
.stat-card .lbl { font-size: .9rem; color: var(--text-muted); }

/* ---- about page ---- */
.about-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 2.5) calc(var(--space) * 2); margin-block: var(--space); text-align: center; box-shadow: var(--shadow-sm); }
.about-hero h1 { margin-block: 0 calc(var(--space) * 0.5); color: var(--brand-dark); font-size: 2rem; }
.about-lead { font-size: 1.2rem; color: var(--text-muted); max-width: 44rem; margin-inline: auto; margin-block-end: 0; }
.chip-row { list-style: none; display: flex; flex-wrap: wrap; gap: calc(var(--space) * 0.5); justify-content: center; padding: 0; margin-block: var(--space) 0; }
.chip { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.85rem; color: var(--text-muted); }
.about-prose { max-width: 46rem; margin-inline: auto; margin-block: var(--space); font-size: 1.05rem; line-height: 1.7; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--space); margin-block: var(--space); }
.about-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space); box-shadow: var(--shadow-sm); border-block-start: 3px solid var(--accent); }
.about-card h3 { margin-block-start: 0; color: var(--brand-dark); }
.about-card p { color: var(--text-muted); margin-block-end: 0; }
.about-cta { text-align: center; margin-block: calc(var(--space) * 1.5); }

/* ---- showcase card (v2.10.0) — one tap target, accent bar, tile fallback ---- */
.showcase-card { display: flex; align-items: stretch; gap: 0; margin-block: var(--space); background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text); overflow: hidden; }
.showcase-card:hover { border-color: var(--accent); }
.showcase-media { flex: 0 0 72px; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.showcase-media img { width: 72px; height: 72px; object-fit: cover; display: block; }
.showcase-tile { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; color: var(--text-light); background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); }
.showcase-body { display: flex; flex-direction: column; justify-content: center; padding: calc(var(--space) * 0.6) var(--space); min-width: 0; }
.showcase-body strong { color: var(--brand-dark); }
.showcase-body span { color: var(--text-muted); font-size: 0.92em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.showcase-evidence { font-size: 0.9em; color: var(--text-muted); }
.showcase-template { background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: calc(var(--space) * 0.75); white-space: pre-wrap; }
.progress { height: 10px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin: 0.5rem 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); border-radius: 5px; transition: width 0.4s ease; }

/* ---- admin dashboard: status strip, stat cards, action grid ---- */
.admin-status { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 var(--space); align-items: center; }
.admin-status a.badge { text-decoration: none; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin: 0 0 var(--space); }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; box-shadow: var(--shadow-sm); text-align: center; }
.admin-card-number { font-size: 1.8rem; font-weight: 700; color: var(--brand-dark); margin: 0; line-height: 1.1; }
.admin-card-label { font-size: 0.95rem; color: var(--text-muted); margin: 0.25rem 0 0; }
.admin-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.admin-action { display: block; background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 0.85rem 1rem; text-decoration: none; color: var(--text); }
.admin-action:hover, .admin-action:focus { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.admin-action strong { display: block; font-size: 1.05rem; color: var(--brand-dark); margin-bottom: 0.2rem; }
.admin-action span { font-size: 0.92rem; color: var(--text-muted); line-height: 1.4; }
.mod-actions { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---- visual data patterns: bars, feed, action items (no spreadsheet look) ---- */
.bar-list { display: flex; flex-direction: column; gap: 0.55rem; margin-block: 0.5rem var(--space); }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 0.75rem; align-items: center; }
.bar-label { overflow-wrap: break-word; word-break: break-word; }
.bar-track { height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--bg) 60%, var(--surface)); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); }
.bar-value { font-weight: 700; color: var(--brand-dark); white-space: nowrap; text-align: end; }
@media (max-width: 560px) {
    .bar-row { grid-template-columns: 1fr auto; }
    .bar-track { grid-column: 1 / -1; }
}

.feed { display: flex; flex-direction: column; gap: 0.6rem; }
.feed-item { background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--brand); border-radius: var(--radius-sm); padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.1rem; }
.feed-when { font-size: 0.82rem; color: var(--text-muted); }
.feed-main { font-size: 1rem; }
.feed-meta { font-size: 0.88rem; color: var(--text-muted); overflow-wrap: break-word; word-break: break-word; }

.action-list { display: flex; flex-direction: column; gap: 0.6rem; margin-block: 0.5rem var(--space); }
.action-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space); flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 1rem; box-shadow: var(--shadow-sm); }
.action-item .action-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.action-item .action-text span { font-size: 0.9rem; color: var(--text-muted); overflow-wrap: break-word; word-break: break-word; }

/* ---- edit cards: labeled field groups instead of input-grid tables ---- */
.edit-card { border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 0.75) var(--space) var(--space); margin: 0 0 var(--space); background: var(--surface); box-shadow: var(--shadow-sm); }
.edit-card legend { font-weight: 700; padding: 0 0.4rem; color: var(--brand-dark); overflow-wrap: break-word; }
.edit-card-new { border-style: dashed; background: var(--bg); }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 var(--space); }
.edit-grid .field { margin-block-end: calc(var(--space) * 0.5); }
.edit-grid .field-wide { grid-column: 1 / -1; }
.edit-flags { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; align-items: center; margin-block-start: 0.35rem; }
.edit-flags label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; margin: 0; }
.delete-check { color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 1.15em; height: 1.15em; accent-color: var(--brand); }

/* ---- status rows (label : value, no table) ---- */
.status-rows { display: flex; flex-direction: column; gap: 0.6rem; margin-block: 0.5rem var(--space); }
.status-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space); flex-wrap: wrap; padding-block-end: 0.6rem; border-block-end: 1px solid var(--border); }
.status-row:last-child { border-block-end: none; padding-block-end: 0; }
.status-label { font-weight: 700; }
.status-value { text-align: end; }

/* ---- palette swatches ---- */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem; margin-block: 0.5rem var(--space); }
.palette-chip { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; }
.palette-swatch { flex: 0 0 2.2em; height: 2.2em; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ============================================================
   GAME LAYER (v3.0.0) — levels, XP, quests, badges, power-ups.
   Playful but readable: big type, bouncy motion, high contrast.
   ============================================================ */
@keyframes xp-shine { from { background-position: 0 0; } to { background-position: 44px 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* level hero — the member's progression banner */
.level-hero {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space);
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: var(--text-light); border-radius: calc(var(--radius) + 4px);
    padding: calc(var(--space) * 1.75) calc(var(--space) * 2);
    margin-block: calc(var(--space) * 1.75); box-shadow: var(--shadow);
    animation: pop-in 0.35s ease both;
}
.level-hero h1 { margin: 0; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; color: var(--text-light); }
.level-kicker { margin: 0 0 0.2rem; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; opacity: 0.85; font-weight: 700; }
.level-number { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.level-name { font-size: 1.4rem; font-weight: 700; opacity: 0.95; }
.level-xp { margin: 0.3rem 0 0.6rem; font-weight: 700; font-size: 1.05rem; }
.level-next { margin: 0.5rem 0 0; font-size: 0.95rem; opacity: 0.92; }
.level-medal { font-size: 3.4rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25)); }
.xp-bar { height: 16px; border-radius: 999px; background: rgba(255,255,255,0.25); overflow: hidden; }
.xp-fill {
    height: 100%; border-radius: 999px; min-width: 0;
    background: repeating-linear-gradient(45deg, var(--gold) 0 11px, color-mix(in srgb, var(--gold) 60%, var(--text-light)) 11px 22px);
    background-size: 44px 100%; animation: xp-shine 1.4s linear infinite;
    transition: width 0.6s cubic-bezier(.34,1.56,.64,1);
}

/* badge shelf — collectible tiles */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; margin-block: 0.75rem; }
.shelf-tile { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; text-align: center; padding: 1.1rem 0.8rem; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); animation: pop-in 0.35s ease both; }
.shelf-earned { border-color: var(--brand); box-shadow: var(--shadow-sm); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 7%, var(--surface)), var(--surface)); }
.shelf-locked { opacity: 0.6; border-style: dashed; }
.shelf-icon { font-size: 2.2rem; }
.shelf-name { font-weight: 700; font-size: 0.95rem; }
.shelf-hint { font-size: 0.8rem; color: var(--text-muted); }

/* quest cards — actions with icons and XP rewards */
.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.9rem; margin-block: 0.75rem; }
.quest-card {
    display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.1rem;
    background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
    color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
    transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), border-color 0.18s ease, box-shadow 0.18s ease;
    animation: pop-in 0.35s ease both;
}
.quest-card:hover, .quest-card:focus-visible { transform: translateY(-3px) scale(1.01); border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.quest-card:active { transform: scale(0.98); }
.quest-icon { flex: 0 0 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; border-radius: 1rem; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.quest-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1; }
.quest-body strong { font-size: 1.05rem; color: var(--brand-dark); }
.quest-body span { font-size: 0.92rem; color: var(--text-muted); line-height: 1.45; }
.quest-reward { flex-shrink: 0; font-weight: 800; font-size: 0.9rem; color: var(--brand-dark); background: color-mix(in srgb, var(--accent-light, var(--accent)) 25%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 999px; padding: 0.25rem 0.7rem; }

/* admin mission board hero + power-ups */
.mission-hero {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface));
    border: 1px solid var(--border); border-inline-start: 5px solid var(--brand);
    border-radius: calc(var(--radius) + 4px); padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
    margin-block: calc(var(--space) * 1.75); box-shadow: var(--shadow-sm);
    animation: pop-in 0.35s ease both;
}
.mission-hero h1 { margin: 0 0 0.6rem; font-size: 1.9rem; letter-spacing: -0.02em; }
.mission-hero .level-kicker { color: var(--brand); opacity: 1; }
.powerups { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.powerup { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.9rem; border-radius: 999px; font-weight: 600; font-size: 0.92rem; text-decoration: none; border: 1px solid var(--border); background: var(--surface); }
.powerup-on { border-color: var(--success-text); background: var(--success-bg); color: var(--success-text); }
.powerup-off { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--brand-dark); }
a.powerup:hover { text-decoration: none; box-shadow: var(--shadow-sm); }

.admin-card-icon { font-size: 1.6rem; margin: 0 0 0.2rem; }
.admin-card { transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s ease; animation: pop-in 0.35s ease both; }
.admin-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/* nav level pill */
.user-level { font-size: 0.75rem; font-weight: 800; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: var(--text-light); border-radius: 999px; padding: 0.1rem 0.5rem; }

/* game-feel buttons: press me */
.btn { box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 130%); }
.btn-primary:hover { background: var(--brand-dark); }

/* progress bars thicker and animated everywhere */
.progress { height: 14px; border-radius: 999px; }
.progress-bar { background: repeating-linear-gradient(45deg, var(--brand) 0 11px, var(--brand-light) 11px 22px); background-size: 44px 100%; animation: xp-shine 1.4s linear infinite; border-radius: 999px; }

/* gentle entrance for panels and cards */
.panel, .edit-card, .action-item { animation: pop-in 0.3s ease both; }

@media (prefers-reduced-motion: reduce) {
    .xp-fill, .progress-bar { animation: none; }
    .level-hero, .shelf-tile, .quest-card, .admin-card, .panel, .edit-card, .action-item, .mission-hero { animation: none; }
    .quest-card, .admin-card, .card, .listing-card, .btn { transition: none; }
}

/* ---- events calendar (v2.12.0) ---- */
.event-card { border-inline-start: 3px solid var(--accent); }
.event-date { color: var(--accent); margin-block-end: 0.25rem; }

/* ---- news cards (v2.13.0) — horizontal rows, image or deliberate tile ---- */
.news-card-row { display: flex; gap: var(--space); align-items: stretch; }
.news-thumb { flex: 0 0 140px; display: block; border-radius: var(--radius-sm); overflow: hidden; }
.news-thumb img { width: 140px; height: 100%; min-height: 96px; object-fit: cover; display: block; }
.news-tile { width: 140px; min-height: 96px; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 700; color: var(--text-light); background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); }
.season-calving .news-tile { background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); }
.season-bull-sales .news-tile { background: linear-gradient(135deg, var(--accent) 0%, var(--brand-dark) 100%); }
.season-pasture .news-tile { background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 100%); }
.season-fall-run .news-tile { background: linear-gradient(135deg, var(--accent) 0%, var(--brand) 100%); }
.season-bred-cows .news-tile { background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%); }
.news-body { min-width: 0; }
.news-hero img { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); }
@media (max-width: 640px) { .news-card-row { flex-direction: column; } .news-thumb, .news-thumb img, .news-tile { width: 100%; } }

/* ============================================================
   PROGRESS-MAP GAME LAYER (v4.0.0) — warm playful world.
   Player topbar, step map, big 3D CTA, bottom HUD (member+admin),
   town-hall buildings, celebration overlay. Mobile-first.
   ============================================================ */
@keyframes xp-shine { from { background-position: 0 0; } to { background-position: 44px 0; } }
@keyframes pulse-ring { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }
@keyframes gem-pop { 50% { transform: scale(1.18); } }

/* player topbar (member dashboard header) */
.game-topbar {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: var(--text-light); border-radius: var(--radius); margin-block-start: calc(var(--space) * 1.5);
    box-shadow: var(--shadow);
}
.game-topbar .avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; color: var(--text-light); background: linear-gradient(135deg, var(--sun), var(--accent)); }
.game-topbar .who { flex: 1; min-width: 0; }
.game-topbar .who b { display: block; font-size: 1.02rem; }
.game-topbar .lv-pill { background: rgba(255,255,255,0.22); border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-weight: 800; }
.game-topbar .xpbar { display: block; height: 10px; background: rgba(255,255,255,0.28); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.game-topbar .xpfill { display: block; height: 100%; border-radius: 99px; background: repeating-linear-gradient(45deg, var(--gold) 0 8px, color-mix(in srgb, var(--gold) 60%, var(--text-light)) 8px 16px); background-size: 32px 100%; animation: xp-shine 1.6s linear infinite; transition: width 0.6s cubic-bezier(.34,1.56,.64,1); }
.game-topbar .xp-count { font-size: 0.82rem; font-weight: 800; white-space: nowrap; }

/* current-step hero + big 3D call-to-action */
.hero-now {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: var(--text-light);
    border-radius: var(--radius); padding: calc(var(--space) * 1.5); margin-block: var(--space);
    box-shadow: var(--shadow); animation: pop-in 0.35s ease both;
}
.hero-now .kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.85; font-weight: 800; margin: 0 0 0.25rem; }
.hero-now h2 { font-size: 1.35rem; margin: 0 0 0.4rem; color: var(--text-light); }
.hero-now p { font-size: 0.95rem; opacity: 0.93; line-height: 1.5; margin: 0 0 1rem; }
.big-cta {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%;
    background: var(--gold); color: var(--text); font-weight: 800; font-size: 1.08rem;
    border: none; border-radius: 999px; padding: 0.95rem 1.25rem; cursor: pointer; text-decoration: none;
    box-shadow: 0 6px 0 var(--gold-dark); transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.big-cta:hover { text-decoration: none; filter: brightness(1.05); }
.big-cta:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold-dark); }
.cta-reward { background: rgba(0,0,0,0.18); border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.85rem; }

/* the progress map — winding steps, done / current / locked */
.map { padding: 0.5rem 0 1rem; }
.path-node { display: flex; align-items: center; gap: 0.9rem; margin-block-end: 0.4rem; animation: pop-in 0.35s ease both; }
.node-dot { width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; border: 4px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.node-done .node-dot { border-color: var(--gold); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--gold) 45%, var(--text-light)), var(--gold)); }
.node-now .node-dot { border-color: var(--brand); animation: pulse-ring 1.6s infinite; }
.node-locked { opacity: 0.6; }
.node-locked .node-dot { filter: grayscale(1); }
.node-card { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; }
.node-card b { display: block; font-size: 1.02rem; color: var(--brand-dark); }
.node-card small { color: var(--text-muted); font-size: 0.88rem; line-height: 1.4; display: block; }
.node-tag { display: inline-block; margin-top: 0.35rem; margin-inline-end: 0.35rem; font-size: 0.75rem; font-weight: 800; border-radius: 999px; padding: 0.15rem 0.65rem; text-decoration: none; }
.tag-done { background: var(--success-bg); color: var(--success-text); }
.tag-now { background: var(--brand); color: var(--text-light); }
.tag-now:hover { text-decoration: none; background: var(--brand-dark); }
.tag-lock { background: var(--bg); color: var(--text-muted); border: 1px dashed var(--border); }
.tag-xp { background: color-mix(in srgb, var(--gold) 30%, var(--surface)); color: color-mix(in srgb, var(--gold-dark) 80%, var(--text)); }
.connector { width: 4px; height: 22px; margin-inline-start: 28px; border-radius: 4px; background: repeating-linear-gradient(var(--border) 0 6px, transparent 6px 11px); }

/* bottom HUD — game menu bar, fixed, mobile-first */
.hud {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    display: flex; justify-content: space-around; gap: 2px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-block-start: 3px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.hud a { display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: var(--text-muted); font-size: 0.68rem; font-weight: 800; padding: 7px 10px 6px; border-radius: 16px; position: relative; min-width: 62px; border: 2px solid transparent; }
.hud a:active { transform: scale(0.92); }
.hud a:hover { text-decoration: none; }
.hud a.is-active { color: var(--brand-dark); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 35%, var(--border)); }
.hud .hi { font-size: 1.3rem; line-height: 1; }
.hud .sub { font-size: 0.62rem; font-weight: 700; color: var(--text-muted); }
.hud .gem { position: absolute; top: -4px; inset-inline-end: 2px; min-width: 20px; height: 20px; border-radius: 99px; background: var(--gold); color: var(--text); font-size: 0.62rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--surface); }
.hud .gem.hot { background: var(--accent); animation: gem-pop 1.4s infinite; }
.hud .meter { width: 44px; height: 5px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; margin-top: 2px; }
.hud .meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--sun)); }
body.has-hud { padding-block-end: calc(86px + env(safe-area-inset-bottom)); }
body.has-hud main.container { padding-block-end: 1rem; }

/* town hall (admin dashboard) */
.needs { background: color-mix(in srgb, var(--sun) 16%, var(--surface)); border: 3px solid var(--sun); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-block: var(--space); }
.needs b { color: var(--brand-dark); }
.needs ul { margin: 0.4rem 0 0 1.1rem; font-size: 0.92rem; }
.town { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; margin-block: 0.75rem; }
.bldg { background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius); padding: 1.1rem 0.8rem; text-align: center; position: relative; box-shadow: var(--shadow-sm); cursor: pointer; text-decoration: none; color: var(--text); transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), border-color 0.15s; animation: pop-in 0.3s ease both; }
.bldg:hover { transform: translateY(-3px) scale(1.02); border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow); }
.bldg:active { transform: scale(0.96); }
.bldg .bi { font-size: 2rem; display: block; margin-bottom: 0.35rem; }
.bldg b { font-size: 0.95rem; display: block; color: var(--brand-dark); }
.bldg small { color: var(--text-muted); font-size: 0.75rem; display: block; margin-top: 0.2rem; line-height: 1.35; }
.alert-dot { position: absolute; top: -8px; inset-inline-end: -8px; min-width: 26px; height: 26px; border-radius: 99px; background: var(--accent); color: var(--text-light); font-weight: 800; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 3px solid var(--bg); animation: gem-pop 1.4s infinite; }

/* celebration overlay */
.celebrate-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(30, 20, 8, 0.55); display: flex; align-items: center; justify-content: center; padding: 1.5rem; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.celebrate-card { background: var(--surface); border-radius: calc(var(--radius) + 6px); padding: 2rem 1.75rem; text-align: center; max-width: 340px; box-shadow: var(--shadow); animation: pop-in 0.4s cubic-bezier(.34,1.56,.64,1) both; }
.celebrate-card h2 { font-size: 1.6rem; margin: 0.4rem 0 0.2rem; color: var(--brand-dark); }
.celebrate-name { font-size: 1.1rem; font-weight: 800; color: var(--brand); margin: 0 0 0.6rem; }
.celebrate-emoji { font-size: 3.6rem; margin: 0; animation: gem-pop 0.9s infinite alternate; }
.celebrate-confetti span { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: confetti-fall 3s linear infinite; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); } }
.celebrate-confetti span:nth-child(3n) { background: var(--brand); }
.celebrate-confetti span:nth-child(3n+1) { background: var(--gold); }
.celebrate-confetti span:nth-child(3n+2) { background: var(--accent); }
.celebrate-confetti span:nth-child(1) { inset-inline-start: 8%; animation-delay: 0s; }
.celebrate-confetti span:nth-child(2) { inset-inline-start: 18%; animation-delay: 0.4s; }
.celebrate-confetti span:nth-child(3) { inset-inline-start: 28%; animation-delay: 0.8s; }
.celebrate-confetti span:nth-child(4) { inset-inline-start: 38%; animation-delay: 0.2s; }
.celebrate-confetti span:nth-child(5) { inset-inline-start: 48%; animation-delay: 0.6s; }
.celebrate-confetti span:nth-child(6) { inset-inline-start: 58%; animation-delay: 1s; }
.celebrate-confetti span:nth-child(7) { inset-inline-start: 68%; animation-delay: 0.3s; }
.celebrate-confetti span:nth-child(8) { inset-inline-start: 78%; animation-delay: 0.7s; }
.celebrate-confetti span:nth-child(9) { inset-inline-start: 88%; animation-delay: 0.5s; }
.celebrate-confetti span:nth-child(10) { inset-inline-start: 13%; animation-delay: 1.1s; }
.celebrate-confetti span:nth-child(11) { inset-inline-start: 53%; animation-delay: 0.9s; }
.celebrate-confetti span:nth-child(12) { inset-inline-start: 83%; animation-delay: 1.2s; }

/* kind picker becomes big tappable choice cards */
.kind-picker { border: none; padding: 0; margin: 0 0 1rem; }
.kind-picker legend { font-weight: 800; font-size: 1.1rem; padding: 0; margin-block-end: 0.6rem; color: var(--brand-dark); }
.kind-option { display: flex; gap: 0.75rem; align-items: center; background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem 1rem; margin: 0 0 0.6rem; font-weight: 700; font-size: 1.02rem; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.kind-option:hover { border-color: var(--brand); }
.kind-option:active { transform: scale(0.98); }
.kind-option:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); box-shadow: var(--shadow-sm); }
.kind-option small { font-weight: 400; color: var(--text-muted); }

/* friendlier big inputs */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], select, textarea {
    padding: 0.85rem 1.05rem; border: 2px solid var(--input-border); border-radius: var(--radius-sm); font-size: 1.05rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 15%, transparent); }

@media (prefers-reduced-motion: reduce) {
    .xpfill, .node-now .node-dot, .gem.hot, .alert-dot, .celebrate-emoji, .celebrate-confetti span { animation: none; }
}

/* ============================================================
   WARM PLAYFUL WORLD — base restyle (v4.0.1)
   Every color below is a token from variables.css — each site
   re-skins by editing its own variables file, nothing here.
   ============================================================ */

/* chunky cards everywhere — 3px warm border, soft warm shadow */
.card, .listing-card, .node-card, .table-wrap,
.panel, .stat-card, .quest, .shelf-item, .edit-card, .action-item {
    border: 3px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm);
}
.card:hover, .listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* buttons become game buttons — bold pills with a 3D press */
.btn { font-weight: 800; border: none; }
.btn-primary {
    background: var(--gold); color: var(--text);
    box-shadow: 0 4px 0 var(--gold-dark);
}
.btn-primary:hover { background: var(--gold); filter: brightness(1.06); transform: none; }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-dark); }
.btn-danger { background: var(--accent); color: var(--text-light); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 70%, var(--text)); }
.btn-danger:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 70%, var(--text)); }
.btn-ghost { background: var(--surface); color: var(--brand-dark); border: 3px solid var(--border); }
.btn-ghost:hover { border-color: var(--brand); }

/* header — warm paper with a chunky bottom line, pill nav links */
.site-header { border-block-end: 3px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); }
.site-nav a { font-weight: 700; padding: 0.35rem 0.8rem; border-radius: 999px; }
.site-nav a:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand-dark); }
.brand { color: var(--brand-dark); }
.user-chip { border: 2px solid color-mix(in srgb, var(--brand) 35%, var(--border)); }

/* hero — warm sunrise wash instead of a flat band */
.hero {
    background: linear-gradient(160deg,
        color-mix(in srgb, var(--gold) 26%, var(--surface)),
        color-mix(in srgb, var(--sun) 18%, var(--bg)));
    border-block-end: 3px solid var(--border);
}
.hero h1 { color: color-mix(in srgb, var(--brand-dark) 80%, var(--text)); }
.hero p { color: var(--text-muted); }

/* badges — chunky pills */
.badge { border: 2px solid var(--border); font-weight: 700; }

/* labels + headings keep the warm ink */
h1, h2, h3, h4 { color: var(--text); }
.card h3, .node-card b, .bldg b { color: var(--brand-dark); }

/* footer separation matches the chunky world */
.site-footer { border-block-start: 3px solid var(--border); background: var(--surface); }

/* small screens — breathe: tighter gutters, single column, big tap targets */
@media (max-width: 640px) {
    .container { padding-inline: 0.9rem; }
    .header-inner { flex-wrap: wrap; gap: 0.5rem; padding-block: 0.6rem; }
    .hero { padding: calc(var(--space) * 1.6) 0.9rem; }
    .hero h1 { font-size: 1.7rem; }
    .card, .listing-card { padding: 1rem; }
    .town { grid-template-columns: 1fr 1fr; }
    .hud a { min-width: 56px; padding-inline: 6px; }
}

/* wide screens — keep the cozy reading width, never a wall of content */
@media (min-width: 900px) {
    .town { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* never let anything bleed sideways on a phone */
body { overflow-x: hidden; }
main.container { width: 100%; }

/* ============================================================
   FIT + OVERLAP FIXES (v4.0.2) — HUD gems clear of icons,
   topbar pill on its own line, no label wrapping, no wide text
   ============================================================ */

/* player topbar — name truncates, level pill gets its own row */
.game-topbar { gap: 0.6rem; padding: 0.8rem 0.9rem; }
.game-topbar .who b {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-topbar .lv-pill { display: inline-block; margin-top: 3px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-topbar .xp-count { font-size: 0.78rem; }

/* HUD — equal-width items, icon cleared of the gem, labels never wrap */
.hud { gap: 0; padding-inline: 2px; }
.hud a {
    flex: 1 1 0; min-width: 0; padding: 10px 2px 6px;
    font-size: 0.64rem; text-align: center;
}
.hud a > * { max-width: 100%; }
.hud a { overflow: hidden; }
.hud a, .hud a .sub { white-space: nowrap; text-overflow: ellipsis; }
.hud .hi { font-size: 1.25rem; margin-top: 3px; }
.hud .gem {
    top: -5px; inset-inline-end: calc(50% - 34px);
    min-width: 18px; height: 18px; font-size: 0.56rem; padding: 0 4px;
}
.hud .meter { width: 38px; }

/* open mobile menu — full-width chunky pills, always fits */
@media (max-width: 640px) {
    .site-nav.open { gap: 0.25rem; padding-block: 0.5rem; }
    .site-nav.open a {
        display: block; width: 100%; padding: 0.7rem 1rem;
        border-radius: var(--radius-sm); font-size: 1.05rem;
    }
    .site-nav.open a:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
    .site-nav.open .user-chip { width: auto; }
}

/* very small phones — tighten, keep one tap per thumb */
@media (max-width: 380px) {
    .hud a { font-size: 0.58rem; padding-top: 9px; }
    .hud .hi { font-size: 1.1rem; }
    .hud .gem { inset-inline-end: calc(50% - 30px); }
    .game-topbar .avatar { width: 38px; height: 38px; font-size: 1rem; }
    .node-dot { width: 52px; height: 52px; font-size: 1.35rem; border-width: 3px; }
    .connector { margin-inline-start: 24px; }
}

/* long words, URLs and emails break instead of overflowing the view */
.card, .listing-card, .node-card, .bldg, .quest, .stat-card, .panel,
.alert, td, .action-item, .site-nav, .game-topbar {
    overflow-wrap: break-word; word-break: break-word;
}

/* ============================================================
   YOU ARE HERE (v4.0.3) — every page announces itself:
   page-head becomes a big warm location banner, and the admin
   entry lives in the footer on every page
   ============================================================ */
.page-head {
    background: linear-gradient(160deg,
        color-mix(in srgb, var(--gold) 24%, var(--surface)),
        color-mix(in srgb, var(--sun) 15%, var(--bg)));
    border: 3px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: calc(var(--space) * 1.4) calc(var(--space) * 1.2);
    margin-block: calc(var(--space) * 1.2) var(--space);
    max-width: none;
}
.page-head h1 {
    margin: 0 0 0.3rem;
    font-size: 1.8rem; font-weight: 800; letter-spacing: -0.01em;
    color: color-mix(in srgb, var(--brand-dark) 85%, var(--text));
    overflow-wrap: break-word;
}
.page-head h1::before { content: "📍 "; }
.page-head p { margin: 0 0 0.8rem; color: var(--text-muted); font-size: 1.02rem; }
.page-head p:last-child { margin-block-end: 0; }
@media (max-width: 640px) {
    .page-head { padding: 1.1rem 1rem; }
    .page-head h1 { font-size: 1.45rem; }
    .page-head .btn { width: 100%; }
}

/* footer admin entry — quiet but always reachable, no URL typing needed */
.footer-admin {
    color: var(--text-muted); font-size: 0.85rem; font-weight: 700;
    border: 2px solid var(--border); border-radius: 999px; padding: 0.2rem 0.8rem;
}
.footer-admin:hover { color: var(--brand-dark); border-color: var(--brand); text-decoration: none; }

/* ============================================================
   EVERY PAGE IS A LEVEL (v5.0.0) — game bar, quest strip,
   next moves, admin setup path, chat-style wizard forms
   ============================================================ */

/* slim game bar — follows signed-in members on every page */
.minibar {
    display: flex; align-items: center; gap: 0.6rem;
    background: var(--surface); border-block-end: 3px solid var(--border);
    padding: 0.45rem 1rem; font-size: 0.82rem; font-weight: 800; color: var(--text);
    text-decoration: none;
}
.minibar:hover { text-decoration: none; }
.minibar .mav {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--sun), var(--accent));
    color: var(--text-light); display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
}
.minibar .mname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minibar .mxp { flex: 1; min-width: 40px; height: 7px; background: var(--bg); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.minibar .mxp i { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--gold) 0 6px, color-mix(in srgb, var(--gold) 60%, var(--text-light)) 6px 12px); }

/* quest strip — quest / signpost / level-chase */
.quest {
    display: flex; align-items: center; gap: 0.8rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 18%, var(--surface)), color-mix(in srgb, var(--gold) 30%, var(--surface)));
    border: 3px solid var(--gold); border-radius: var(--radius-sm);
    padding: 0.75rem 0.95rem; margin-block: 0 var(--space); box-shadow: var(--shadow-sm);
}
.quest .qi { font-size: 1.6rem; flex-shrink: 0; }
.quest > div { flex: 1; min-width: 0; }
.quest b { display: block; font-size: 0.98rem; }
.quest small { color: color-mix(in srgb, var(--gold-dark) 80%, var(--text)); font-size: 0.82rem; font-weight: 700; display: block; overflow-wrap: break-word; }
.quest.done { background: var(--success-bg); border-color: color-mix(in srgb, var(--success-text) 35%, var(--surface)); }
.quest.done small { color: var(--success-text); }
.qxp {
    margin-inline-start: auto; background: var(--gold); color: var(--text); font-weight: 800; font-size: 0.78rem;
    border-radius: 999px; padding: 0.3rem 0.8rem; white-space: nowrap; flex-shrink: 0;
}
a.qxp-link { text-decoration: none; box-shadow: 0 3px 0 var(--gold-dark); }
a.qxp-link:hover { text-decoration: none; filter: brightness(1.05); }
a.qxp-link:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dark); }

/* next moves — no dead ends */
.nextmoves { margin-block: calc(var(--space) * 1.5) 0; }
.nextmoves h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin: 0 0 0.6rem; }
.nm {
    display: flex; align-items: center; gap: 0.8rem; background: var(--surface);
    border: 3px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.85rem 1rem; margin-block-end: 0.6rem; box-shadow: var(--shadow-sm);
    text-decoration: none; color: var(--text); transition: transform 0.12s ease, border-color 0.15s;
}
.nm:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.nm:active { transform: scale(0.98); }
.nm .ni { font-size: 1.5rem; flex-shrink: 0; }
.nm .nm-text { flex: 1; min-width: 0; }
.nm b { font-size: 1rem; display: block; }
.nm small { color: var(--text-muted); font-size: 0.82rem; display: block; overflow-wrap: break-word; }
.nm .go { margin-inline-start: auto; font-size: 1.2rem; color: var(--brand); font-weight: 800; flex-shrink: 0; }

/* admin setup path */
.setup-heading { font-size: 1.1rem; margin: var(--space) 0 0.5rem; }
.setup-path .hero-now form { margin: 0; }

/* chat-style wizard forms — one big question at a time */
form.wizard .field, form.wizard .kind-picker { display: none; }
form.wizard .field.wiz-on, form.wizard .kind-picker.wiz-on { display: block; animation: pop-in 0.25s ease both; }
form.wizard .field label { font-size: 1.15rem; font-weight: 800; margin-block-end: 0.5rem; }
.wiz-dots { display: flex; gap: 8px; justify-content: center; margin-block-end: 1.2rem; }
.wiz-dots i { width: 34px; height: 8px; border-radius: 99px; background: var(--border); }
.wiz-dots i.on { background: var(--brand); }
.wiz-nav { display: flex; gap: 0.6rem; margin-block-start: 1rem; }
.wiz-nav .btn { flex: 1; }
form.wizard:not(.wiz-js) .field, form.wizard:not(.wiz-js) .kind-picker { display: block; }
form.wizard:not(.wiz-js) .wiz-dots, form.wizard:not(.wiz-js) .wiz-nav { display: none; }
