/* ==========================================================================
   Nullvald — dark fantasy theme
   ========================================================================== */
:root {
    --bg: #13100d;
    --bg-2: #1a1612;
    --panel: #201b16;
    --panel-2: #29221b;
    --border: #3a3027;
    --border-2: #4d3f31;
    --text: #ece3d4;
    --muted: #a3937d;
    --gold: #d9a94e;
    --gold-2: #f0c66e;
    --ember: #e3632c;
    --ember-2: #ff8a4c;
    --good: #79c27d;
    --bad: #e05d55;
    --info: #6aa6dc;
    --energy: #4fae5b;
    --courage: #d9822b;
    --health: #c9433d;
    --xp: #8a6fd1;
    --radius: 10px;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Cinzel', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* On a computer nothing on any page is meant to be wider than the window, so never show a sideways scrollbar there
   (a player on a very wide screen saw one on Settings). Phones keep it, so a wide table can still be scrolled. */
@media (min-width: 921px) { html { overflow-x: hidden; } }
body {
    background: radial-gradient(ellipse at top, #241a12 0%, var(--bg) 55%) fixed, var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--ember-2); text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .02em; margin: 0 0 .6em; line-height: 1.25; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.15rem; color: var(--gold-2); }
h2 .small { font-family: var(--font); font-weight: 400; letter-spacing: 0; margin-left: .5em; }
h3 { font-size: 1rem; }
.card .table + h3, .card dl + h3, .card p + h3 { margin-top: 18px; }
p { margin: 0 0 .8em; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 4px 0; }
.inline { display: inline; }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    /* The bar's background runs edge to edge, but its contents line up with the page below (max 1320px, centred),
       so on a very wide window the whole site stays the same size in the middle of the screen. */
    padding: 10px max(20px, calc((100% - 1320px) / 2));
    background: rgba(19, 16, 13, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.brand { white-space: nowrap; font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: var(--gold-2); letter-spacing: .06em; }
.brand:hover { text-decoration: none; color: var(--gold-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* Your name, level and XP in the top bar */
.top-me { display: flex; align-items: center; gap: 8px; margin-left: 24px; min-width: 150px; max-width: 220px; flex: 0 1 220px; }
.top-me-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.top-me-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.top-me-name { font-family: var(--display); font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-me-name:hover { color: var(--gold-2); text-decoration: none; }
.top-me-level { flex: none; font-size: .74rem; font-weight: 600; color: var(--gold-2); }
.top-me .bar-xp { height: 7px; }
/* Energy, courage and health in the top bar */
.top-stats { display: flex; align-items: center; gap: 14px; margin-left: 18px; flex: 1 1 auto; min-width: 0; max-width: 900px; container-type: inline-size; }
.top-stats.bars { margin-bottom: 0; padding: 6px 10px; }
.top-stat.bar-row + .top-stat.bar-row { margin-top: 0; }
.top-stat { flex: 1 1 0; min-width: min-content; display: flex; align-items: center; gap: 8px; color: var(--text); padding: 3px 6px; border-radius: 8px; }
.top-stat:hover { background: var(--panel-2); text-decoration: none; }
.top-stat-icon { font-size: 1.05rem; line-height: 1; }
.top-stat-body { flex: 1; min-width: min-content; display: flex; flex-direction: column; gap: 2px; }
.top-stat-head { display: flex; justify-content: space-between; gap: 6px; font-size: .74rem; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.top-stat-label { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .66rem; }
.top-stat .bar { display: block; height: 7px; }
.top-stat .bar-fill { display: block; }
/* Booster and medical cooldowns: two small rows stacked after the Focus meter */
.top-cds { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding-left: 10px; border-left: 1px solid var(--border); }
.top-cd { display: flex; align-items: center; gap: 6px; padding: 1px 5px; border-radius: 6px; font-size: .74rem; line-height: 1.25; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.top-cd:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.top-cd-icon { width: 16px; display: inline-flex; justify-content: center; font-size: .8rem; line-height: 1; }
.top-cd-icon .gicon { width: 16px; height: 16px; }
.top-cd-label { text-transform: uppercase; letter-spacing: .05em; font-size: .62rem; }
.top-cd-val { margin-left: auto; padding-left: 6px; min-width: 4.6em; text-align: right; font-weight: 600; color: var(--muted); }
.top-cd:not(.cd-on) { opacity: .55; } /* no cooldown running: dimmed, showing a dash, so only a running one catches the eye */
.top-cd:not(.cd-on):hover { opacity: 1; }
.top-cd.cd-on .top-cd-val { color: var(--gold-2); }
.top-cd.tol-full .top-cd-val { color: var(--bad, #e0605a); }
.top-stat .bar-foot { min-height: 1.1em; }
.top-full { display: none; } /* phones only (see the max-width: 920px rules) */
.top-stat .bar-foot { display: block; min-width: 0; max-width: 100%; margin-top: 0; font-size: .64rem; line-height: 1.1; color: var(--muted); white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.gold-pill { white-space: nowrap; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 4px 12px; font-weight: 600; color: var(--gold-2); }
.icon-link { position: relative; font-size: 1.15rem; padding: 4px 6px; border-radius: 8px; }
.icon-link:hover { background: var(--panel-2); text-decoration: none; }
.icon-link .badge { position: absolute; top: -4px; right: -6px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; font-size: 1.1rem; padding: 3px 10px; cursor: pointer; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.sidebar {
    padding: 18px 14px; border-right: 1px solid var(--border);
    position: sticky; top: var(--topbar-h, 53px); height: calc(100vh - var(--topbar-h, 53px)); overflow-y: auto;
}
.content { padding: 24px 28px 60px; min-width: 0; }
.page-title { margin-bottom: 18px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title-row .page-title { margin-bottom: 0; }
/* Home: a cat asleep on top of the news box, at the far end of the News heading. Pixel art, so it's kept sharp.
   The pictures have 3 empty rows under the cat; -29px (those 3 + the row's 10px gap + 16px) lets the bottom of its
   body hang in front of the box's top edge (the box has 18px of padding there, so no text is covered). */
.news-title-row { align-items: flex-end; flex-wrap: nowrap; margin-bottom: 10px; }
.news-cat { flex: none; line-height: 0; margin: 0 18px -29px 0; position: relative; z-index: 1; }
.news-cat img { display: block; width: 143px; height: auto; image-rendering: pixelated; }
/* A soft shadow on the box where the body presses on it. */
.news-cat::after { content: ''; position: absolute; left: 8%; right: 6%; bottom: 1px; height: 22px; z-index: -1;
    border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); }
.purse:hover { text-decoration: none; border-color: var(--gold); }
.purse-label { font-weight: 400; color: var(--muted); font-size: .85em; }

/* ---------- Sidebar: player block ---------- */
.me { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.me-name { font-family: var(--display); font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.me-name a { color: var(--text); }
.race-icon { font-size: 1.4rem; }
.me-meta { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }

.bars { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.bar-row + .bar-row { margin-top: 10px; }
.bar-head { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 600; margin-bottom: 3px; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-foot { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.bar { position: relative; height: 10px; background: #0d0b09; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.bar-energy .bar-fill { background: linear-gradient(90deg, #2f7d3a, var(--energy)); }
.bar-courage .bar-fill { background: linear-gradient(90deg, #a5561b, var(--courage)); }
.bar-health .bar-fill { background: linear-gradient(90deg, #8d2a26, var(--health)); }
.bar-focus .bar-fill { background: linear-gradient(90deg, #3e5f8a, #8fb6e8); }
.top-timers { display: flex; gap: 6px; margin-left: auto; }
.top-timers + .topbar-right { margin-left: 10px; }
.use-many { display: flex; gap: 4px; align-items: center; }
.use-many input { width: 58px; padding: 4px 6px; }
.cooldown-note { margin-top: -6px; }
.top-timer { white-space: nowrap; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.top-timer.timer-focus { color: #8fb6e8; border-color: rgba(143, 182, 232, .5); }
.bar-xp { height: 16px; }
.bar-xp .bar-fill { background: linear-gradient(90deg, #5b45a3, var(--xp)); }
.bar-label { position: absolute; inset: 0; font-size: .68rem; line-height: 14px; text-align: center; color: #fff; text-shadow: 0 1px 2px #000; }

.status-box { display: block; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-weight: 600; border: 1px solid; }
.status-box span { display: block; font-variant-numeric: tabular-nums; font-size: 1.2rem; }
.status-box:hover { text-decoration: none; }
.status-infirmary { background: rgba(201, 67, 61, .15); border-color: rgba(201, 67, 61, .5); color: #f1a29d; }

/* ---------- Sidebar nav ---------- */
.nav a, .nav-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 10px; border-radius: 8px; color: var(--text); font: inherit; font-size: .93rem;
    background: none; border: 0; cursor: pointer; text-align: left;
}
.nav a:hover, .nav-btn:hover { background: var(--panel-2); text-decoration: none; color: var(--gold-2); }
.nav a.active { background: linear-gradient(90deg, rgba(217, 169, 78, .18), transparent); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { width: 22px; text-align: center; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 14px 10px 4px; }
.nav > a:first-child { margin-bottom: 2px; }
.nav .badge { margin-left: auto; }
/* Events / Messages with something unread: the menu link glows ember until you've looked */
.nav a.nav-alert { color: var(--ember-2); background: linear-gradient(90deg, rgba(227, 99, 44, .16), transparent); box-shadow: inset 3px 0 0 var(--ember); }
.nav a.nav-alert .badge { animation: badge-pulse 2s ease-in-out infinite; }
@keyframes badge-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 99, 44, .55); } 50% { box-shadow: 0 0 0 5px rgba(227, 99, 44, 0); } }
@media (prefers-reduced-motion: reduce) { .nav a.nav-alert .badge { animation: none; } }
/* On a computer the menu is always on screen, so the Events and Messages shortcuts in the top bar would only repeat it.
   They stay on phones and small windows, where the menu is tucked away. */
@media (min-width: 921px) { .topbar .icon-link { display: none; } }
/* Laptop-sized windows: make room for the meters and cooldowns by showing just the crest (no wordmark) and the
   cooldowns as icon + time */
@media (min-width: 921px) and (max-width: 1240px) {
    .topbar .brand-wordmark { display: none; }
    .top-cd-label { display: none; }
    .top-cd-val { min-width: 0; }
    .top-stat .foot-pre { display: none; } /* "Full in 4h 22m" becomes just "4h 22m" under the meter */
}
@media (min-width: 921px) and (max-width: 1000px) {
    .top-me { flex-basis: 110px; min-width: 90px; margin-left: 10px; }
    .top-stats { gap: 6px; margin-left: 8px; }
    .top-stats.bars { padding: 6px 8px; }
    .top-stat { gap: 4px; padding: 3px 2px; }
    .top-cds { padding-left: 6px; }
}
.badge { background: var(--ember); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.4; }

/* ---------- Cards & layout helpers ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 620px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 18px; }
form.card .grid-2 { margin-bottom: 0; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border-2);
    background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #352c23; border-color: var(--gold); color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #c98d34, #a8701f); border-color: #d9a94e; color: #1a1209; }
.btn-primary:hover { background: linear-gradient(180deg, #ddA040, #b97c25); color: #1a1209; }
.btn-danger { background: linear-gradient(180deg, #b63e35, #8f2c25); border-color: #d05a50; color: #fff; }
.btn-danger:hover { background: linear-gradient(180deg, #c84a40, #a0342c); color: #fff; }
.btn-small { padding: 4px 10px; font-size: .8rem; }
.btn-large { padding: 12px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------- Forms ---------- */
.form label, label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
    display: block; width: 100%; margin-top: 4px;
    background: #110e0b; color: var(--text); border: 1px solid var(--border-2); border-radius: 8px;
    padding: 8px 10px; font: inherit; font-size: .95rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 169, 78, .2); }
.row input, .row select { width: auto; margin-top: 0; flex: 1; min-width: 70px; }
input.qty, .row input[type=number] { max-width: 90px; flex: 0 0 90px; }
label.check, label.radio { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .95rem; }
label.check input, label.radio input { width: auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--border-2); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.total td { font-weight: 700; border-top: 1px solid var(--border-2); }
.table tr.selected td { background: rgba(217, 169, 78, .08); }
.table tr.unread td { font-weight: 700; }
.table tr.banned td { opacity: .55; }
.card > .table { margin: -4px 0; }

/* ---------- Tags, chips, tabs ---------- */
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text); white-space: nowrap; }
.tag-good { border-color: rgba(121, 194, 125, .6); color: var(--good); }
.tag-risk { border-color: rgba(224, 93, 85, .6); color: #f19a94; }
.tag-gold { border-color: var(--gold); color: var(--gold-2); }
.tag-founder { border-color: rgba(240, 160, 90, .75); color: #ffc98a; background: rgba(240, 160, 90, .1); }   /* the Founder badge (src/launch.php) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 16px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--gold-2); border-bottom-color: var(--gold); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted); font-size: .85rem; }
.chip:hover { text-decoration: none; color: var(--text); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #1a1209; font-weight: 600; }

/* ---------- Flash & notices ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash-success { background: rgba(121, 194, 125, .12); border-color: rgba(121, 194, 125, .45); color: #b9e6bb; }
.flash-error { background: rgba(224, 93, 85, .12); border-color: rgba(224, 93, 85, .5); color: #f6b8b3; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: rgba(217, 169, 78, .1); border: 1px solid rgba(217, 169, 78, .4); color: var(--gold-2); }
.result { border-left: 4px solid var(--border-2); }
.result-good { border-left-color: var(--good); }
.result-bad { border-left-color: var(--bad); }
.result-meh { border-left-color: var(--muted); }

/* ---------- Home ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; }
.quick span { font-size: 1.8rem; }
.quick:hover { border-color: var(--gold); text-decoration: none; color: var(--gold-2); transform: translateY(-2px); transition: transform .15s; }
.news + .news { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.news h3 { margin-bottom: 2px; }
.news p { margin-top: 6px; }
/* The pinned announcement at the top of the News (Admin → News): a gilded notice. */
.news-pinned { position: relative; margin-bottom: 16px; border: 1px solid var(--gold);
    background: linear-gradient(180deg, rgba(217, 169, 78, .16), rgba(217, 169, 78, .04) 60%), var(--panel);
    box-shadow: 0 0 0 1px rgba(217, 169, 78, .25) inset, var(--shadow); }
.news-pinned-badge { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--gold-2);
    font-family: var(--display); font-weight: 700; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.news-pinned-badge img { width: 20px; height: 20px; }
.news-pinned h3 { font-size: 1.35rem; color: var(--gold-2); margin-bottom: 2px; }
.news-pinned-meta { color: var(--muted); }
.news-pinned p { margin: 6px 0 0; }
.events { list-style: none; padding: 0; margin: 0; }
.events li { padding: 8px 0 8px 12px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.events li:last-child { border-bottom: 0; }
.events li.unseen { border-left-color: var(--ember); background: rgba(227, 99, 44, .05); }

/* ---------- Gym ---------- */
.gym-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; }
.gym-meta { display: flex; gap: 24px; }
.gym-meta div { text-align: center; }
.gym-meta b { display: block; font-size: 1.5rem; color: var(--gold-2); font-family: var(--display); }
.gym-meta span { font-size: .78rem; color: var(--muted); }
.gym-head-main p { margin: 4px 0; }
.gym-next .btn { margin-left: 6px; }
.gym-meta b.focus-mult { color: #8fb6e8; }
.focus-hot { color: #8fb6e8; font-weight: 600; }
.gym-programmes { flex-basis: 100%; border-top: 1px solid var(--border); padding-top: 10px; }
.gym-programmes > summary { cursor: pointer; color: var(--gold-2); font-weight: 600; font-size: .9rem; }
.table-compact td, .table-compact th { padding-top: 5px; padding-bottom: 5px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { text-align: center; margin: 0; display: flex; flex-direction: column; }
.stat-icon { font-size: 2rem; }
.stat-value { font-family: var(--display); font-size: 1.5rem; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.stat-card p { flex: 1; }
.train-row { display: flex; gap: 6px; justify-content: center; }
.stat-card .train-row { margin-top: auto; }   /* the Train buttons line up even when one card's bonus line wraps */
.train-row input { width: 64px; margin: 0; text-align: center; }

/* ---------- Quests ---------- */
.quest { display: flex; gap: 18px; align-items: center; }
.quest.locked { opacity: .5; }
.quest-main { flex: 1; }
.quest-main h3 { margin-bottom: 2px; }
.quest-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.quest-side { text-align: center; min-width: 110px; }
.chance { font-family: var(--display); font-size: 1.6rem; color: var(--gold-2); margin-bottom: 6px; }
.monster-icon { font-size: 2.6rem; width: 68px; height: 68px; flex: 0 0 68px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 14px; }
.quest-main h3 .small { font-family: var(--font); font-weight: 400; margin-left: 4px; }
.threat { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; line-height: 1.2; }
.threat small { display: block; font-family: var(--font); font-weight: 500; font-size: .75rem; color: var(--muted); }
.threat-easy { color: var(--good); }
.threat-fair { color: var(--gold-2); }
.threat-risky { color: var(--courage); }
.threat-danger { color: var(--bad); }
.threat-deadly { color: #ff4d6d; text-shadow: 0 0 10px rgba(255, 77, 109, .35); }
.log-toggle { margin-top: 6px; }
/* Hunting Grounds: an opt-in tick box hides the weaker monsters (stronger ones are always shown). */
.section-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin: 24px 0 10px; }
.section-title-row .section-title { margin: 0; }
.hide-weaker { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); cursor: pointer; user-select: none; }
.hide-weaker input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.monster-list.hiding-weaker .is-weaker, body:has([data-hide-weaker]:checked) .monster-list .is-weaker { display: none; }
.log-toggle summary { cursor: pointer; color: var(--gold-2); font-weight: 600; font-size: .9rem; }
.log-toggle .fight-log { margin-top: 8px; max-height: 360px; overflow-y: auto; }

/* ---------- Status screens ---------- */
.status-card { text-align: center; }
.big-timer { font-family: var(--display); font-size: 2.6rem; color: var(--gold-2); font-variant-numeric: tabular-nums; margin: 8px 0; }
.status-card .actions { justify-content: center; }
.big-number { font-family: var(--display); font-size: 1.8rem; color: var(--gold-2); }

/* ---------- Items / shops ---------- */
.item-list { display: flex; flex-direction: column; }
.item-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: 0; }
.item-row.equipped .item-icon { box-shadow: 0 0 0 2px var(--good); }
.item-icon { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; background: var(--panel-2); border-radius: 10px; flex: 0 0 46px; }
.item-info { flex: 1; min-width: 0; }
.item-actions { display: flex; gap: 6px; align-items: flex-start; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 290px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.mini-form { margin-bottom: 10px; }
.mini-form label { margin-bottom: 4px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shop-item { margin: 0; display: flex; flex-direction: column; }
.shop-item.locked { opacity: .55; }
.shop-item p { flex: 1; }
.shop-icon { font-size: 2.2rem; }
.shop-needs { list-style: none; margin: 6px 0 2px; padding: 0; font-size: .82rem; }
.shop-needs li { padding: 2px 0; }
.shop-needs li.bad { color: var(--bad, #e06a5c); }
.mat-pop {
    font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
    text-decoration: underline dotted rgba(240, 198, 110, .55); text-underline-offset: 3px;
}
.mat-pop:hover, .mat-pop:focus-visible { color: var(--gold-2); text-decoration-color: var(--gold-2); }
/* The pop-up of where to get a material (views/material_where.php). */
.mat-where h3 { margin: 12px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mat-where-have { display: flex; align-items: center; gap: 8px; margin: 0 0 4px !important; }
.nv-dialog-body .mat-where-list { list-style: none; padding: 0; margin: 0 0 .6em; }
.nv-dialog-body .mat-where-list > li { padding: 8px 0; border-top: 1px solid var(--border); }
.nv-dialog-body .mat-where-list > li:first-child { border-top: 0; padding-top: 2px; }
.mat-where-needs { display: flex; flex-wrap: wrap; gap: 6px; margin: 5px 0 4px; }
.shop-stats { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.price { font-family: var(--display); font-size: 1.25rem; color: var(--gold-2); margin-bottom: 8px; }

/* ---------- Players / profile / combat ---------- */
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar input[name=q] { max-width: 320px; margin: 0; }
.search-bar label.check { margin: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.plink { font-weight: 600; }
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar { font-size: 3rem; width: 80px; height: 80px; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--border-2); border-radius: 50%; }
.profile-main { flex: 1; min-width: 220px; }
.profile-main h2 { margin-bottom: 4px; font-size: 1.5rem; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bio { white-space: normal; }
.versus { display: flex; align-items: center; justify-content: center; gap: 40px; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vs { font-family: var(--display); font-size: 2rem; color: var(--ember); }
.fight-log { padding-left: 24px; margin: 0; }
.fight-log li { padding: 4px 0; }
.fight-log li.atk { color: #f0d6b0; }
.fight-log li.def { color: #b9cde6; }
.fight-log li.crit { font-weight: 700; }
.fight-log li.miss { opacity: .7; }
.fights li { border-bottom: 1px solid var(--border); padding: 6px 0; }

/* ---------- Guilds / messages ---------- */
.post { padding: 10px 0; border-bottom: 1px solid var(--border); }
.post:last-child { border-bottom: 0; }
.post-head { margin-bottom: 4px; }
.message-body { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.danger-zone { border-color: rgba(224, 93, 85, .45); }
.hof .rank { font-size: 1.2rem; width: 40px; }

/* ---------- Admin ---------- */
body.admin .sidebar { background: rgba(0, 0, 0, .15); }
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { margin: 0; }
.tile-value { font-family: var(--display); font-size: 1.6rem; color: var(--gold-2); }

/* ---------- Public pages ---------- */
body.public { background: radial-gradient(ellipse at 50% -10%, #3a2412 0%, var(--bg) 60%) fixed, var(--bg); }
.public-wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 40px; }
.public-brand { display: block; text-align: center; font-family: var(--display); font-size: 1.4rem; font-weight: 700; color: var(--gold-2); margin-bottom: 24px; letter-spacing: .08em; }
.public-brand:hover { text-decoration: none; }
.public-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 40px; }
.legal-links { margin: 8px 0 0; font-size: .78rem; }
.legal-links a { color: var(--muted); }
.legal-links a:hover { color: var(--gold-2); }
.game-foot .legal-links { margin: 0 0 6px; }
/* Terms, Privacy, Refunds and the public Supporter Shop page (pages/terms.php …, views/legal_top.php). */
.legal-tabs { flex-wrap: wrap; }
.legal-updated { margin: -8px 0 12px; }
.legal { max-width: 860px; line-height: 1.6; }
.legal h1 { margin-top: 0; }
.legal h2 { font-size: 1.1rem; margin: 1.6em 0 .5em; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: .25em 0; }
.legal td { vertical-align: top; }
.legal .table td, .legal .table th { white-space: normal; }
.price-list { list-style: none; padding: 0 !important; margin: 10px 0; display: grid; gap: 6px; }
.price-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.price-tag { margin-left: auto; font-weight: 700; color: var(--gold-2); }
.delete-account > summary { list-style: none; display: inline-block; }
.delete-account > summary::-webkit-details-marker { display: none; }
.delete-form { margin-top: 12px; max-width: 420px; display: grid; gap: 10px; }
.company-line { display: block; margin: 6px auto 0; max-width: 640px; font-size: .72rem; opacity: .75; line-height: 1.5; }
.game-foot { margin: 40px 0 6px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .72rem; opacity: .75; line-height: 1.5; }
.hero { text-align: center; padding: 40px 0 30px; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); background: linear-gradient(180deg, #ffe2a3, #d9a94e 60%, #a66b1f); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 40px rgba(227, 99, 44, .25); margin-bottom: .2em; }
.hero-sub { max-width: 620px; margin: 0 auto 26px; color: var(--muted); font-size: 1.1rem; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 34px; }
.hero-stats b { display: block; font-family: var(--display); font-size: 1.8rem; color: var(--gold-2); }
.hero-stats span { color: var(--muted); font-size: .85rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature > span { font-size: 2rem; }
.feature h3 { margin: 8px 0 6px; color: var(--gold-2); }
.feature p { color: var(--muted); margin: 0; }
.auth-card { max-width: 420px; margin: 0 auto; }
.auth-card.wide { max-width: 680px; }

/* ---------- Recovery code ---------- */
.recovery-card { max-width: 640px; border-color: rgba(217, 169, 78, .55); }
.recovery-code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: clamp(1.2rem, 5vw, 1.9rem); letter-spacing: .12em; text-align: center; padding: 16px; margin: 14px 0 4px; background: #0d0b09; border: 1px dashed var(--gold); border-radius: var(--radius); color: var(--gold-2); user-select: all; word-break: break-all; }
.auth-card .tabs { margin-bottom: 14px; }

/* ---------- Responsive ---------- */
/* The ENERGY/COURAGE/... labels show only when the meters have room for them (decided by the meters' own width, not
   the window's, so the top bar looks the same on every window wider than the site). */
@container (max-width: 860px) {
    .top-stat-label { display: none; }
}
@media (max-width: 1100px) {
    .top-me { flex-basis: 160px; min-width: 120px; margin-left: 16px; }
    .top-stats { gap: 8px; margin-left: 12px; }
    .top-stat { gap: 5px; }
    .stat-grid, .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
    .nav-toggle { display: inline-block; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: var(--topbar-h, 53px); height: calc(100dvh - var(--topbar-h, 53px)); width: 280px; z-index: 25; background: var(--bg-2); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
    body.nav-open .sidebar { transform: none; }
    body.admin .sidebar { background: var(--bg-2); }   /* the slide-out menu must be solid on phones (the admin one is see-through on computers) */
    .content { padding: 18px 16px 50px; }
    .grid-2, .grid-3, .feature-grid { grid-template-columns: minmax(0, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .quest { flex-direction: column; align-items: stretch; }
    .quest-side { display: flex; align-items: center; justify-content: space-between; }
    .monster-icon { width: 52px; height: 52px; flex-basis: 52px; font-size: 2rem; }
    .table { display: block; overflow-x: auto; white-space: nowrap; }
    .gold-pill { font-size: .85rem; padding: 3px 8px; }
    .brand { font-size: 1.05rem; }
    .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .topbar-right { gap: 4px; }
    /* On small screens your name/level/XP replace the logo, and the meters get their own row */
    .topbar .brand { display: none; }
    .top-me { margin-left: 0; flex: 1 1 auto; min-width: 0; max-width: 200px; }
    .top-me .avatar-xs { width: 26px; height: 26px; }
    .top-stats { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; gap: 8px; flex-wrap: wrap; }
    /* Phones: the cooldowns become a slim strip along the bottom of the meters panel, side by side */
    .top-cds { flex-direction: row; flex-basis: 100%; justify-content: space-around; gap: 8px; padding: 5px 0 0; border-left: 0; border-top: 1px solid var(--border); }
    .top-cd { font-size: .72rem; padding: 1px 4px; }
    .top-stat .foot-pre { display: none; }
    /* Phones: when each meter will be full moves into the strip with the cooldowns (icon + time, side by side) */
    .top-stat .bar-foot { display: none; }
    .top-stat { flex: 1 1 auto; } /* wider numbers get a wider share of the row */
    .top-cds { justify-content: space-between; gap: 2px; flex-wrap: wrap; }
    .top-cd, .top-full { gap: 2px; padding: 1px 1px; font-size: .68rem; letter-spacing: -.01em; }
    .top-cds .top-cd-icon, .top-cds .top-cd-icon .gicon { width: 14px; height: 14px; }
    .top-cd .top-cd-val { padding-left: 0; }
    .top-cd .top-cd-label { display: none; }
    .top-full { display: flex; align-items: center; font-size: .72rem; line-height: 1.25; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; border-radius: 6px; }
    .top-full:hover { text-decoration: none; color: var(--text); }
    .top-full-val { font-weight: 600; }
    .top-full + .top-cd { padding-left: 5px; border-left: 1px solid var(--border); border-radius: 0; }
    /* four meters always share one row on phones; the numbers get a touch smaller so big ones (4459 / 4500) fit */
    .top-stat, .top-stat-body { min-width: 0; }
    .top-stat-icon .gicon { width: 18px; height: 18px; }
    .top-stat-head { font-size: .66rem; letter-spacing: -.01em; }
    .top-cd-val { min-width: 0; }
    .top-stat { padding: 2px 0; gap: 5px; }
    .top-stat-label { display: none; }
    .top-stat-icon { font-size: .9rem; }
    .top-timers { order: 4; flex-basis: 100%; gap: 4px; margin-left: 0; }
    .top-timers + .topbar-right { margin-left: auto; }
    .top-timer { font-size: .72rem; padding: 2px 7px; }
    .versus { gap: 16px; }
    .hero-stats { gap: 22px; }
}
@media (max-width: 400px) {
    .brand-text { display: none; }
    /* the phone strip (when each meter is full + cooldowns) squeezes onto one row on narrow phones */
    .top-cd, .top-full { font-size: .62rem; letter-spacing: -.02em; }
    .top-cds .top-cd-icon, .top-cds .top-cd-icon .gicon { width: 12px; height: 12px; }
    .top-full + .top-cd { padding-left: 3px; }
    .top-stats { gap: 6px; }
}
@media (max-width: 520px) {
    .stat-grid, .stat-tiles { grid-template-columns: 1fr; }
    .item-row { flex-wrap: wrap; }
    .item-actions { width: 100%; justify-content: flex-end; }
    .dropdown-body { width: min(290px, 86vw); }
}

/* Sign-up honeypot: invisible to people, tempting to bots */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { margin: 8px 0 4px; }

/* Regions, travel and bosses */
.status-travel { background: rgba(80, 140, 220, .15); border-color: rgba(80, 140, 220, .5); color: #a9c8f2; }
/* Turning back on the road: under the travel box in the menu, while it's still possible */
.turn-back:has(.status-turn-back) { display: block; margin: -6px 0 12px; }
.status-turn-back { width: 100%; }
.status-boss { background: rgba(230, 160, 40, .14); border-color: rgba(230, 160, 40, .55); color: #f3c76b; }
/* Awake bosses: one compact line each, under Regions in the menu */
.nav-bosses { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; padding: 6px; border: 1px solid rgba(230, 160, 40, .55); border-radius: var(--radius); background: rgba(230, 160, 40, .1); }
.nav-boss { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; font-size: .82rem; font-weight: 600; line-height: 1.35; color: #f3c76b; }
.nav-boss:hover { background: rgba(230, 160, 40, .18); color: #f3c76b; text-decoration: none; }
.nav-boss-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-boss-time { flex: none; font-variant-numeric: tabular-nums; opacity: .85; }
.status-box small { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }
.location { display: block; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; }
.location:hover { text-decoration: none; border-color: var(--gold); }
.region-hero { display: flex; gap: 16px; align-items: flex-start; }
.region-hero .region-icon { font-size: 2.6rem; line-height: 1; }
.region-hero h2 { margin: 0 0 4px; }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.region-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,.02); }
.region-tile.here { border-color: var(--gold); }
.region-tile h3 { margin: 0; font-size: 1rem; }
.region-tile .actions { margin-top: auto; }
.boss-card { border-color: rgba(230, 160, 40, .6); background: linear-gradient(135deg, rgba(230,160,40,.10), rgba(201,67,61,.08)); }

/* ---------- Mission targets: monsters, bosses and gathering spots today's Adventurers' Guild missions want ---------- */
.card.mission-target, .gather-node.mission-target {
    border-color: rgba(240, 198, 110, .8);
    box-shadow: 0 0 0 1px rgba(240, 198, 110, .35), 0 0 22px rgba(240, 198, 110, .16), var(--shadow);
    background-image: linear-gradient(100deg, rgba(240, 198, 110, .11), rgba(240, 198, 110, 0) 60%);
}
.boss-card.mission-target { background-image: linear-gradient(100deg, rgba(240, 198, 110, .14), rgba(201, 67, 61, .08)); }
.mission-flag { display: flex; align-items: flex-start; gap: 6px; margin: 3px 0 7px; font-size: .8rem; font-weight: 600; color: var(--gold-2); line-height: 1.35; }
.mission-flag-lines { display: flex; flex-direction: column; gap: 1px; }
.mission-flag b { color: var(--text); font-variant-numeric: tabular-nums; margin-left: 2px; white-space: nowrap; }
.mission-flag-icon { width: 18px; height: 18px; flex: none; image-rendering: auto; vertical-align: -4px; }
.tag-mission { border-color: rgba(240, 198, 110, .7); color: var(--gold-2); }
.mission-strip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-color: rgba(240, 198, 110, .55);
    background-image: linear-gradient(100deg, rgba(240, 198, 110, .09), rgba(240, 198, 110, 0) 60%); }
.mission-strip .mission-flag-icon { width: 24px; height: 24px; margin-top: 1px; }
.mission-strip > div { flex: 1; min-width: 0; }
.mission-strip-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.mission-strip-bar .bar { flex: 1; max-width: 320px; margin: 0; }
.boss-card .monster-icon { font-size: 3rem; }
.boss-alerts .boss-alert { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.boss-alert + .boss-alert { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.section-title { margin: 24px 0 10px; font-size: 1.15rem; }

/* Battle screen */
.battle-arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }   /* both fighters line up: pictures at the top, health at the bottom */
.fighter { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.fighter-icon { font-size: 4rem; line-height: 1; }
.fighter .bar { width: 100%; max-width: 260px; margin-top: auto; }
.fighter .hp-text { font-variant-numeric: tabular-nums; }
.battle-arena .vs { align-self: center; display: flex; flex-direction: column; align-items: center; font-family: var(--display); font-size: 1.6rem; color: var(--gold); }
.battle-arena .vs small { font-family: var(--font); font-size: .8rem; }
.battle-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.battle-actions .heal-form { display: inline-flex; gap: 6px; align-items: center; }
.battle-actions select { max-width: 260px; }
.battle-help { flex-basis: 100%; margin: 4px 0 0; }
.battle-log { max-height: 420px; overflow-y: auto; }
.battle-log li.heal { color: var(--good); }
.battle-log li.fresh { animation: battle-flash .8s ease-out; }
@keyframes battle-flash { from { background: rgba(217, 169, 78, .25); } to { background: transparent; } }
.status-battle { background: rgba(201, 67, 61, .15); border-color: rgba(201, 67, 61, .6); color: #f1a29d; }
@media (max-width: 640px) {
    .battle-arena { grid-template-columns: 1fr; }
    .fighter-icon { font-size: 3rem; }
}

/* ---------- Conversations & trades ---------- */
.convo-start { gap: 8px; flex-wrap: wrap; }
.convo-start input { flex: 1; min-width: 180px; }
.convo-list { list-style: none; margin: 0; padding: 0; }
.convo-list li + li { border-top: 1px solid var(--border); }
.convo-list a { display: flex; align-items: center; gap: 12px; padding: 12px 6px; color: var(--text); text-decoration: none; }
.convo-list a:hover { background: var(--panel-2); }
.convo-list li.unread b { color: var(--gold-2); }
.convo-icon { font-size: 1.6rem; }
.convo-main { flex: 1; min-width: 0; }
.convo-snippet { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-inline { display: inline-block; background: var(--ember); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .75rem; margin-left: 4px; }
.convo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.convo-head h2 { margin: 0; font-size: 1.25rem; }
.convo-head .row { gap: 8px; }
.chat { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 10px; }
.chat-line { display: flex; flex-direction: column; max-width: 78%; }
.chat-line.mine { align-self: flex-end; align-items: flex-end; }
.chat-line.theirs { align-self: flex-start; }
.bubble { padding: 9px 13px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border); line-height: 1.45; overflow-wrap: anywhere; }
.chat-line.mine .bubble { background: rgba(217, 169, 78, .16); border-color: rgba(217, 169, 78, .45); border-bottom-right-radius: 4px; }
.chat-line.theirs .bubble { border-bottom-left-radius: 4px; }
.chat-system { align-self: center; text-align: center; font-size: .9rem; color: var(--muted); max-width: 92%; }
.chat-system b { color: var(--text); }
.trade-done { background: rgba(121, 194, 125, .08); border: 1px solid rgba(121, 194, 125, .45); border-radius: var(--radius); padding: 8px 14px; color: var(--text); margin-bottom: 2px; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 6px; }
.chat-compose textarea { flex: 1; resize: vertical; margin: 0; }
.trade-card { border-color: rgba(217, 169, 78, .55); }
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trade-side { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.trade-side h3 { margin: 0 0 8px; font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trade-items { list-style: none; margin: 0 0 10px; padding: 0; }
.trade-items li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.trade-items .trade-gold { color: var(--gold-2); border-bottom: 0; }
.trade-side .mini-form { gap: 6px; flex-wrap: wrap; }
.trade-side .mini-form select { flex: 1; min-width: 140px; }
.trade-side .mini-form input[type=number] { width: 110px; }
.trade-side .mini-form input.qty { width: 70px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 2px 8px; }
.btn-ghost:hover { color: var(--bad); }
@media (max-width: 640px) {
    .trade-grid { grid-template-columns: 1fr; }
    .chat-line { max-width: 92%; }
}
.trade-grid > * { min-width: 0; }
.trade-side .mini-form { display: flex; flex-wrap: wrap; }
@media (max-width: 640px) {
    .trade-side .mini-form select { flex: 1 1 100%; min-width: 0; width: 100%; }
}

/* ---------- Martial schools ---------- */
.school-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.school-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.school-card p { margin: 0; }
.school-card.school-mine { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 169, 78, .35); }
.school-top { display: flex; align-items: center; gap: 10px; }
.school-icon { font-size: 1.8rem; }
.school-action { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; min-width: 0; }
.school-action .btn { white-space: normal; max-width: 100%; }
/* Your own school (Training Hall) */
.my-school h3 { font-size: 1rem; margin: 18px 0 8px; }
.my-school .grid-2 > div { min-width: 0; }
.my-school-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.my-school-icon { font-size: 2.6rem; line-height: 1; }
.my-school-title { flex: 1 1 260px; }
.my-school-title h2 { margin: 2px 0 0; }
.my-school-title h2 .muted { font-size: .9rem; font-family: var(--font); font-weight: 500; }
.my-school-rank { flex: 0 1 280px; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.my-school-status { margin-top: 14px; }
.good-box { background: rgba(79, 160, 90, .1); border: 1px solid rgba(79, 160, 90, .35); border-radius: var(--radius); padding: 10px 12px; font-size: .92rem; }
.trait-list { margin: 0; padding-left: 18px; }
.trait-list li { margin: 5px 0; }
.trait-list.tips li { color: var(--text); }
.locked-row td { color: var(--muted); }
.rank-ladder { display: flex; flex-wrap: wrap; gap: 6px; }
.rank-chip { font-size: .74rem; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted); }
.rank-chip.done { color: var(--text); border-color: rgba(217, 169, 78, .45); }
.rank-chip.current { color: #1a140c; background: var(--gold-2); border-color: var(--gold-2); font-weight: 700; }
.switch-school > summary { cursor: pointer; color: var(--gold-2); font-weight: 600; }
.switch-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.switch-info { flex: 1; min-width: 0; }
.switch-actions { flex: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.section-title .small { font-family: var(--font); font-weight: 400; }

/* ---------- Avatars ---------- */
.pixel-avatar { image-rendering: pixelated; image-rendering: crisp-edges; display: inline-block; object-fit: contain; vertical-align: middle; }
.pixel-avatar.flip { transform: scaleX(-1); }
.avatar-xs { width: 32px; height: 32px; font-size: 1.4rem; }
.avatar-sm { width: 48px; height: 48px; font-size: 1.6rem; }
.avatar-md { width: 80px; height: 80px; font-size: 3rem; }
.avatar-lg { width: 128px; height: 128px; font-size: 4rem; }
.avatar:has(.pixel-avatar) { overflow: hidden; border-radius: var(--radius); }
.race-icon { display: inline-flex; text-decoration: none; }
.fighter-icon .avatar-lg { margin: 0 auto; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.avatar-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--bg-2); cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.avatar-option:hover { border-color: var(--border-2); }
.avatar-option.chosen, .avatar-option:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 169, 78, .4); }
.avatar-save { flex-basis: 100%; }
@media (max-width: 640px) { .avatar-lg { width: 96px; height: 96px; } }

/* ---------- Battle backgrounds (one picture per area: assets/backgrounds/<area>.png) ---------- */
.battle-arena.has-bg {
    /* the picture itself is set on the element (style attribute) so its address works wherever the game is installed */
    background-size: cover; background-position: center 70%; background-repeat: no-repeat;
    image-rendering: pixelated; min-height: 300px; align-items: stretch; padding-top: 40px;
}
/* areas whose best part sits high in the picture */
.battle-arena.bg-frostpeak { background-position: center 30%; }
.battle-arena.bg-stormcrag { background-position: center 25%; }
.battle-arena.bg-emberveil { background-position: center 40%; }
.battle-arena.has-bg .fighter { padding: 6px 12px; }
.battle-arena.has-bg .fighter b, .battle-arena.has-bg .fighter span { text-shadow: 0 0 1px #000, 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000, 0 0 8px rgba(0, 0, 0, .95); color: var(--text); }
.battle-arena.has-bg .fighter .bar { box-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.battle-arena.has-bg .fighter-icon { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6)); }
.battle-arena.has-bg .vs, .battle-arena.has-bg .vs small { text-shadow: 0 0 1px #000, 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000, 0 0 8px rgba(0, 0, 0, .95); align-self: center; }
.battle-arena.has-bg .vs small { color: var(--text); }

/* Lodgings */
.notice-bad { background: rgba(224, 93, 85, .1); border-color: rgba(224, 93, 85, .45); color: #f19a94; }
.notice .inline { margin-left: 8px; }
.lodge-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lodge-icon { font-size: 2.8rem; line-height: 1; }
.lodge-main { flex: 1 1 280px; min-width: 0; }
.lodge-main h2 { margin: 0 0 4px; }
.lodge-facts { display: flex; gap: 18px; flex-wrap: wrap; }
.lodge-facts > div { display: flex; flex-direction: column; min-width: 90px; }
.lodge-facts b { font-family: var(--display); font-size: 1.15rem; color: var(--gold-2); }
.lodge-sell { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.lodge-invite { margin: 8px 0; }
.lodge-invite label { display: block; margin-bottom: 6px; font-size: .9rem; color: var(--muted); }
.lodge-invite-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }   /* the button lines up with the menu */
.lodge-invite-row select { flex: 0 1 460px; min-width: 0; margin: 0; }
.lodge-invite-row .btn { white-space: nowrap; }
.lodge-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lodge-requests li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.lodge-requests li:last-child { border-bottom: 0; }
.pledge-form input[type=text] { flex: 0 1 320px; min-width: 0; }
.pledge-card h3 { margin-top: 18px; }
/* Live updates: wrappers that mustn't change the layout */
.side-live { display: contents; }
.top-timers:empty { display: none; }
.top-timers:empty + .topbar-right { margin-left: auto; }
.badge[hidden] { display: none; }
.care-steps { display: flex; gap: 3px; margin: 8px 0 12px; max-width: 420px; }
.care-steps span { flex: 1; height: 8px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border-2); }
.tol-head { display: flex; justify-content: space-between; gap: 12px; max-width: 420px; margin: 8px 0 6px; }
.cleanse-card .bar { max-width: 420px; margin-bottom: 12px; }
.bar-tolerance .bar-fill { background: linear-gradient(90deg, #6b4a8f, #b48be0); }
.cleanse-card .cleanse-form + p { margin-top: 8px; }
.care-steps span.on { background: linear-gradient(180deg, #e0605a, #b63e35); border-color: #d05a50; }
/* Bank investments */
.invest-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.invest-term { margin: 0; cursor: pointer; position: relative; }
.invest-term input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.invest-term span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-2); color: var(--text); }
.invest-term span small { color: var(--good); font-size: .85rem; }
.invest-term input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 169, 78, .45); background: rgba(217, 169, 78, .08); }
.invest-term input:focus-visible + span { outline: 2px solid var(--gold); }
.invest-form .row label { margin-bottom: 0; flex: 1 1 180px; }
.invest-form .row select, .invest-form .row input, .invest-form .row input[type=number] { width: 100%; max-width: none; margin-top: 4px; }
.invest-warning .kv { margin-bottom: 12px; }
.invest-form .row .btn { align-self: flex-end; }
.invest-warning { border: 1px solid rgba(224, 160, 60, .6); background: rgba(224, 160, 60, .08); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.invest-warning h3 { margin: 0 0 10px; color: var(--gold-2); }
.invest-confirm label.check { margin: 12px 0; }
.invest h3 { margin-top: 18px; }
.shop-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.shop-grid-5 .shop-item { padding: 12px; }
.shop-grid-5 .shop-item h3 { font-size: .95rem; }
.shop-grid-5 .shop-item .row input[type=number] { flex-basis: 54px; max-width: 54px; }
@media (max-width: 1280px) { .shop-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .shop-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .shop-grid-5 { grid-template-columns: 1fr; } }
/* The Apothecary: a row of four for each kind (healing, salves, ales, tonics), so the stronger ones line up. */
.shop-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .shop-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .shop-grid-4 { grid-template-columns: 1fr; } }
.tabs-sub { margin-top: 4px; }
/* Armour worn (inventory) */
.worn-armour { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.worn-slot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); font-size: .88rem; min-width: 0; }
.worn-slot > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.worn-slot small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.worn-slot.empty { opacity: .6; }
.worn-icon { font-size: 1.4rem; }
.worn-total { grid-column: 1 / -1; font-size: .9rem; color: var(--muted); }
@media (max-width: 760px) { .worn-armour { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Logo */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.public-brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.logo-pic { display: contents; }   /* the logo with its moving flame (a still one for people who turn animations off) */
.brand-logo { flex: none; display: block; filter: drop-shadow(0 0 6px rgba(227, 99, 44, .35)); }
.hero-logo { display: block; margin: 0 auto 6px; width: 192px; height: 192px; image-rendering: pixelated; filter: drop-shadow(0 0 24px rgba(227, 99, 44, .35)); }
@media (max-width: 560px) { .hero-logo { width: 128px; height: 128px; } }
.hero h1.hero-title { margin: 0 0 .3em; line-height: 0; background: none; -webkit-background-clip: border-box; background-clip: border-box; text-shadow: none; }
.hero-wordmark { display: inline-block; width: min(490px, 92vw); height: auto; image-rendering: pixelated; filter: drop-shadow(0 4px 18px rgba(227, 99, 44, .3)); }
.brand-wordmark { display: block; height: 32px; width: auto; }
/* Attack alert (top of every page until dismissed or the events page is opened) */
.attack-alert { border: 1px solid rgba(224, 93, 85, .6); background: rgba(224, 93, 85, .12); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.attack-alert.pop { animation: alert-pop .6s ease-out 2; }
.attack-alert-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; color: #f3a29c; }
.attack-alert ul { margin: 0; }
.attack-alert li { padding: 2px 0; }
@keyframes alert-pop { 0% { box-shadow: 0 0 0 0 rgba(224, 93, 85, .7); } 100% { box-shadow: 0 0 0 12px rgba(224, 93, 85, 0); } }
@media (max-width: 640px) { .fight-table .hide-sm { display: none; } }
.guild-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin: -6px 0 10px; }
.table tr.row-mine td { background: rgba(217, 169, 78, .07); }
/* Guild wars */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.grid-4 > .card { margin-bottom: 0; }
.war-record .big-number { font-size: 1.6rem; }
@media (max-width: 760px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.war-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius);
    border: 1px solid rgba(224, 93, 85, .55); background: linear-gradient(90deg, rgba(224, 93, 85, .18), rgba(224, 93, 85, .05)); }
.war-banner > span:nth-child(2) { flex: 1; min-width: 200px; }
.war-banner-icon { font-size: 1.4rem; }
.war-note { padding: 8px 12px; border-radius: 8px; background: rgba(224, 93, 85, .1); border: 1px solid rgba(224, 93, 85, .4); }
.war-rules li { padding: 3px 0; }
.war-head.war-live { border-color: rgba(224, 93, 85, .55); }
.war-sides { display: flex; align-items: center; justify-content: center; gap: 28px; margin-bottom: 14px; text-align: center; }
.war-side { flex: 1; max-width: 260px; }
.war-tag { font-family: var(--display); font-size: 1.15rem; }
.war-table .hide-sm { white-space: nowrap; }
@media (max-width: 640px) { .war-table .hide-sm { display: none; } .war-sides { gap: 10px; } }
.profile-war { margin-top: 6px; color: #f3a29c; }
/* Herald lines in the Home news */
.herald-block { padding: 8px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); }
.news + .herald-block, .herald-block + .news { margin-top: 12px; }
.herald { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-size: .92rem; }
.herald + .herald { border-top: 1px dashed var(--border); }
.herald time { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: .78rem; }
@media (max-width: 640px) { .hof .hide-sm { display: none; } }
.plain-link { color: inherit; text-decoration: none; } .plain-link:hover { color: var(--gold-2); }
/* Gathering */
.skill-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.skill-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.skill-head { display: flex; align-items: center; gap: 8px; }
.skill-head > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.skill-head small { color: var(--muted); font-size: .78rem; }
.skill-icon { font-size: 1.5rem; }
.bar-skill .bar-fill { background: linear-gradient(90deg, #6b5a2a, var(--gold)); }
@media (max-width: 860px) { .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gather-zone-head { display: flex; gap: 14px; align-items: flex-start; }
.gather-zone-head h2 { margin-bottom: 4px; }
.gather-zone-head .region-icon { font-size: 2.4rem; line-height: 1; }
.gather-nodes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.gather-node { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255,255,255,.02); }
.gather-node.locked { opacity: .55; }
.gather-node-icon { font-size: 1.6rem; width: 2rem; text-align: center; flex: none; }
.gather-node-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gather-node-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 45%; text-align: right; }
@media (max-width: 640px) { .gather-node { flex-wrap: wrap; } .gather-node-side { max-width: none; width: 100%; justify-content: flex-start; text-align: left; } }
.gather-mats { font-size: 1.3rem; letter-spacing: 4px; }
.gather-got { display: inline-block; margin-right: 12px; }
/* What you just gathered, inside the zone's card above the spots to gather. */
.gather-result { margin: 12px 0 4px; padding: 10px 12px; border-radius: var(--radius); background: rgba(121, 194, 125, .07); border: 1px solid var(--border); border-left-width: 4px; }
.gather-result h3 { margin: 0 0 4px; font-size: 1rem; }
.gather-result { scroll-margin-top: 96px; }   /* clear of the bar at the top of the screen */
@media (max-width: 920px) { .gather-result { scroll-margin-top: 150px; } }
.gather-result p { margin: 4px 0; }
.level-up { color: var(--gold-2); }
/* Inventory search and tabs */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.search-box { margin-bottom: 12px; max-width: 520px; flex: 1; min-width: 200px; }
.search-box input { width: 100%; padding: 10px 14px; font-size: 1rem; margin: 0; }
.suggest-wrap { position: relative; display: block; }
.row > .suggest-wrap, .search-bar > .suggest-wrap { flex: 1; min-width: 180px; }
.search-bar > .suggest-wrap { max-width: 320px; }
.search-bar .suggest-wrap input[name=q] { max-width: none; width: 100%; }
.pledge-form > .suggest-wrap { flex: 0 1 320px; min-width: 0; }
.suggest-wrap > input { width: 100%; }
label > .suggest-wrap { margin: 4px 0 6px; }
.suggest-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); min-width: 240px; margin: 0; padding: 4px; list-style: none; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.5); max-height: 340px; overflow-y: auto; text-align: left; font-weight: 400; }
.suggest-list li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.suggest-list li:hover, .suggest-list li.active { background: rgba(217, 169, 78, .14); }
.suggest-icon { font-size: 1.15rem; width: 1.6rem; text-align: center; flex: none; }
.suggest-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-name mark { background: none; color: var(--gold-2); font-weight: 700; }
.suggest-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
[data-suggest-name][hidden], [data-scope-group][hidden], [data-scope-none][hidden] { display: none !important; }
.admin-items-head { align-items: center; margin-bottom: 12px; }
.admin-items-head .search-box { margin-bottom: 0; }
.inv-tabs .tab .muted { font-weight: 400; }
.item-row.flash-row { animation: row-flash 1.6s ease-out; }
@keyframes row-flash { 0%, 30% { background: rgba(217, 169, 78, .22); } 100% { background: transparent; } }
/* Arms & Armour */
.gear-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gear-total { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gear-total > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.gear-total small { color: var(--muted); font-size: .8rem; }
.gear-total-icon { font-size: 1.8rem; }
.gear-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.gear-grid > .card { margin-bottom: 0; }
.gear-slot-head { font-family: var(--display); color: var(--gold-2); font-size: 1.05rem; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gear-slot-head span { font-size: 1.3rem; }
.gear-slot.empty { border-style: dashed; }
.gear-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.gear-item + .gear-item { border-top: 1px solid var(--border); }
.gear-item-main { flex: 1; min-width: 0; }
.gear-none { margin: 4px 0 8px; }
.gear-options { margin-top: 8px; }
.gear-options summary { cursor: pointer; color: var(--gold-2); font-weight: 600; font-size: .9rem; padding: 4px 0; }
@media (max-width: 860px) { .gear-grid { grid-template-columns: 1fr; } .gear-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Adventurers' Guild */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; padding: 0 .35em; border-radius: 6px; font-family: var(--display); font-weight: 700; font-size: .85em; line-height: 1; border: 1px solid currentColor; background: rgba(0,0,0,.25); vertical-align: middle; }
.rank-f { color: #a8a29a; } .rank-e { color: #8fbf7a; } .rank-d { color: #6fb3d9; } .rank-c { color: #b48ee0; }
.rank-b { color: #e0a85a; } .rank-a { color: #ef7a5a; } .rank-s { color: #f5d26b; box-shadow: 0 0 8px rgba(245, 210, 107, .45); }
.ag-hero { display: flex; gap: 16px; align-items: flex-start; }
.ag-hero-icon { font-size: 2.6rem; line-height: 1; }
.ag-hero p { margin: 0 0 6px; }
.ag-register { max-width: 640px; margin-left: auto; margin-right: auto; }
.ag-card { display: flex; gap: 16px; align-items: center; }
.ag-card-rank .rank-badge { font-size: 2.2rem; border-width: 2px; border-radius: 10px; }
.ag-card-main { flex: 1; min-width: 0; }
.ag-card-main h2 { margin-bottom: 6px; }
.bar-mission { margin: 6px 0 4px; }
.bar-mission .bar-fill { background: linear-gradient(90deg, #6b5a2a, var(--gold)); }
.bar-mission.done .bar-fill { background: linear-gradient(90deg, #2f7d3a, var(--good)); }
.mission-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.mission { display: flex; gap: 14px; align-items: center; margin-bottom: 0; }
.mission.ready { border-color: rgba(121, 194, 125, .6); }
.mission.group { margin-bottom: 8px; }
.mission-icon { font-size: 1.8rem; width: 2.4rem; text-align: center; flex: none; }
.mission-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mission-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
.contrib { margin-top: 8px; max-width: 420px; }
@media (max-width: 640px) { .mission { flex-wrap: wrap; } .mission-side { flex-direction: row; width: 100%; justify-content: flex-start; } .ag-hero-icon { display: none; } }
/* Player profile */
.profile-hero { display: flex; gap: 22px; align-items: center; background: linear-gradient(135deg, rgba(217, 169, 78, .07), rgba(0, 0, 0, 0) 55%), var(--panel); }
.profile-portrait { flex: none; padding: 6px; border-radius: 16px; border: 1px solid var(--border-2); background: radial-gradient(circle at 50% 35%, rgba(217, 169, 78, .16), rgba(0, 0, 0, .25) 70%); }
.profile-portrait img { display: block; }
.profile-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-id h2 { margin: 0; font-size: 1.7rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-id h2 .rank-badge { font-size: 1rem; }
.profile-sub { color: var(--muted); }
.profile-sub a { color: var(--text); }
.profile-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); }
.pill .dot { margin: 0; }
.pill-risk { border-color: rgba(224, 93, 85, .5); color: #f3a29c; }
.profile-hero .profile-war { margin: 0; }
.profile-hero .profile-actions { margin-top: 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.pstat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pstat b { font-family: var(--display); font-size: 1.45rem; color: var(--gold-2); line-height: 1.1; }
.pstat span { color: var(--muted); font-size: .78rem; }
.standing { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.standing li { display: flex; gap: 12px; align-items: center; }
.standing li > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.standing small, .pskill small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.st-icon { font-size: 1.35rem; width: 2rem; text-align: center; flex: none; }
.profile-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pskill { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.pskill > span:last-child { display: flex; flex-direction: column; }
.pskill b { font-family: var(--display); font-size: 1.25rem; color: var(--gold-2); line-height: 1.1; }
.pskill-icon { font-size: 1.5rem; }
.profile-bio .bio { margin: 0; font-style: italic; border-left: 3px solid var(--border-2); padding-left: 14px; }
@media (max-width: 1100px) { .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pstat:last-child:nth-child(odd) { grid-column: span 2; } .profile-hero { flex-direction: column; text-align: center; } .profile-id { align-items: center; } .profile-id h2, .profile-pills, .profile-hero .profile-actions { justify-content: center; } .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Bios and reports */
.bio-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: -4px; }
.bio-rules { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); }
.report { margin-top: 12px; }
.report summary { cursor: pointer; list-style: none; display: inline-block; }
.report summary:hover { color: var(--bad); }
.report-form { margin-top: 8px; max-width: 420px; }
.report-card { border-left: 3px solid rgba(224, 93, 85, .6); }
.report-card .snapshot { white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.report-card .snapshot.changed { border-color: rgba(217, 169, 78, .5); }
.bio-history li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.bio-history li:last-child { border-bottom: 0; }
.standing li > span:last-child { display: block; }
.standing small { display: block; }
.keeper-tools { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.keeper-tools summary { cursor: pointer; color: var(--gold-2); list-style: none; display: inline-block; }
.keeper-form { margin-top: 8px; max-width: 520px; }
/* Pixel-art game icons (64×64 pictures shown smaller) */
.gicon { display: inline-block; width: 26px; height: 26px; vertical-align: middle; object-fit: contain; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; }
.nav-icon .gicon { width: 28px; height: 28px; margin: -4px 0; }
.top-stat-icon .gicon { width: 26px; height: 26px; }
.gold-pill .gicon { width: 20px; height: 20px; margin: -3px 0; }
.icon-link .gicon { width: 26px; height: 26px; }

/* "Link your Discord" reminder, just under the top bar until the account is linked (or the player hides it) */
.discord-nudge { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid rgba(129, 140, 248, .45); background: linear-gradient(90deg, rgba(88, 101, 242, .16), rgba(88, 101, 242, .05)); color: var(--text); }
.discord-nudge:hover { text-decoration: none; border-color: rgba(129, 140, 248, .8); color: var(--text); }
.discord-nudge-icon { font-size: 1.25rem; line-height: 1; }
.discord-nudge-text { flex: 1; min-width: 0; font-size: .9rem; }
.discord-nudge-go { flex: none; font-weight: 700; color: #a5b4fc; white-space: nowrap; }
@media (max-width: 520px) { .discord-nudge { flex-wrap: wrap; row-gap: 6px; } .discord-nudge-text { flex-basis: calc(100% - 44px); } .discord-nudge-go { margin-left: 32px; } }
/* Arriving from the reminder: the Discord box clears the sticky top bar and glows briefly */
#discord { scroll-margin-top: 120px; }
#discord:target { animation: discord-glow 2.4s ease-out 1; }
@keyframes discord-glow { 0%, 30% { box-shadow: 0 0 0 2px rgba(129, 140, 248, .8), 0 0 24px rgba(88, 101, 242, .35); } 100% { box-shadow: none; } }
.discord-rules { margin: 12px 0; padding: 10px 14px; border-radius: 8px; background: rgba(0, 0, 0, .18); border: 1px solid var(--border); }
.discord-rules ul { margin: 6px 0; padding-left: 20px; }
.discord-rules li { margin: 2px 0; }
.discord-rules p { margin: 4px 0; }
.discord-optout { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.discord-optout p { margin: 0 0 8px; }


/* ---------- Map of the realm (Hunting Grounds & Gathering) ---------- */
.realm { margin-bottom: 20px; }
.realm-frame { position: relative; }
.realm-map {
    position: relative; aspect-ratio: 688 / 384; overflow: hidden; border-radius: var(--radius);
    background: #12303f; border: 2px solid var(--border-2);
    box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(240, 198, 110, .25);
}
.realm-map::after {
    /* a soft dark edge and a thin gold inner rule, like an old framed chart */
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: inherit;
    box-shadow: inset 0 0 60px rgba(10, 7, 4, .55), inset 0 0 0 3px rgba(19, 16, 13, .55), inset 0 0 0 4px rgba(217, 169, 78, .35);
}
.realm-img { display: block; width: 100%; height: 100%; image-rendering: pixelated; user-select: none; -webkit-user-drag: none; }
.realm-dots { position: absolute; inset: 0; z-index: 4; pointer-events: none; } /* above the badges, but never catches clicks */
/* The map picture and the moving dots each get their own layer. Otherwise every step a dot takes makes the browser
   repaint the strip of map under it, and with the sharp pixel-art scaling those small repaints don't line up exactly
   with the rest of the picture: thin lines flicker across the map where the dots move (worst over the busy city). */
.realm-img, .realm-dots { will-change: transform; transform: translateZ(0); backface-visibility: hidden; }
/* worldmap.js draws the picture once into a canvas at the screen's exact pixels (no rows rounding differently each
   redraw); the <img> underneath is only shown until then, or if the canvas can't be used. */
.realm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.realm-painted .realm-img { visibility: hidden; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(8, 6, 4, .9); vertical-align: middle; }
.map-dot { position: absolute; transform: translate(-50%, -50%); width: 10px; height: 10px; border-width: 2px; }   /* even sizes and whole-pixel borders keep every dot perfectly round */
.dot-npc { background: #f3efe4; box-shadow: 0 0 5px rgba(255, 255, 255, .55); }
.dot-p { background: #5ed36a; box-shadow: 0 0 6px rgba(94, 211, 106, .8); }
.dot-g { background: #4fa6ff; box-shadow: 0 0 6px rgba(79, 166, 255, .85); }
.dot-w { background: #ff4436; box-shadow: 0 0 7px rgba(255, 68, 54, .9); }
.dot-l { background: #b06cff; box-shadow: 0 0 7px rgba(176, 108, 255, .9); }   /* your pledge */
.dot-you { background: var(--gold-2); box-shadow: 0 0 8px rgba(240, 198, 110, .95); }
/* Every dot is the same size: travellers and your own dot only differ by colour (and your gold ping). */
.map-dot.dot-you { z-index: 2; }
.map-dot.dot-you::after {
    content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--gold-2);
    animation: you-ping 1.8s ease-out infinite;
}
@keyframes you-ping { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }

.map-node {
    position: absolute; z-index: 2; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center;
    background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); font: inherit;
}
.map-node-icon {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 17px; line-height: 1;
    background: radial-gradient(circle at 35% 30%, #3a2f24, #17120d 75%); border: 2px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(0, 0, 0, .6);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.map-node-name {
    margin-top: 3px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; pointer-events: none;
    font-family: var(--display); font-size: .7rem; font-weight: 700; letter-spacing: .03em; color: #fbf1dc;
    background: rgba(19, 16, 13, .78); border: 1px solid rgba(217, 169, 78, .35); text-shadow: 0 1px 2px #000;
}
.map-node:hover .map-node-icon, .map-node:focus-visible .map-node-icon, .map-node.open .map-node-icon {
    transform: scale(1.14); border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(240, 198, 110, .25), 0 3px 12px rgba(0, 0, 0, .8);
}
.map-node:focus { outline: none; }
.map-node.map-city .map-node-icon { width: 38px; height: 38px; font-size: 20px; border-width: 3px; }
.map-node.map-city .map-node-name { font-size: .8rem; }
.map-node.here .map-node-icon { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(240, 198, 110, .22), 0 0 12px rgba(240, 198, 110, .45); }
.map-node.heading .map-node-icon { border-color: var(--gold-2); animation: node-here 2.4s ease-in-out infinite; }
@keyframes node-here { 50% { box-shadow: 0 0 0 5px rgba(240, 198, 110, .28), 0 0 18px rgba(240, 198, 110, .55); } }
.map-node-icon { position: relative; }
.map-node.boss .map-node-icon::after {
    content: ''; position: absolute; top: -14px; right: -13px; width: 22px; height: 22px;
    background: url('../icons/ui/boss.png?v=2') center / contain no-repeat;
    filter: drop-shadow(0 1px 2px #000);
}
/* Today's missions want something here: the Adventurers' Guild mark on the badge's other shoulder */
.map-node.mission .map-node-icon::before {
    content: ''; position: absolute; top: -13px; left: -13px; width: 22px; height: 22px;
    background: url('../icons/adventurers_guild.png') center / contain no-repeat;
    filter: drop-shadow(0 1px 2px #000) drop-shadow(0 0 4px rgba(240, 198, 110, .55));
}
@media (max-width: 700px) { .map-node.mission .map-node-icon::before { width: 18px; height: 18px; top: -11px; left: -10px; } }
.map-card .mission-flag { margin: 6px 0 8px; }
/* A boss is awake: the crowned red skull before its name above the menu */
.boss-skull { display: inline-flex; vertical-align: -3px; }
.boss-skull .pix-icon { width: 18px; height: 18px; image-rendering: auto; }
h2 .boss-skull { vertical-align: -0.15em; }
h2 .boss-skull .pix-icon { width: 1.25em; height: 1.25em; }

.map-card {
    position: absolute; z-index: 6; width: 270px; transform: translate(26px, -26px);
    background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border-2); border-radius: var(--radius);
    padding: 12px 14px 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(240, 198, 110, .12);
}
.map-card.flip-x { transform: translate(calc(-100% - 26px), -26px); }
.map-card.flip-y { transform: translate(26px, calc(-100% + 26px)); }
.map-card.flip-x.flip-y { transform: translate(calc(-100% - 26px), calc(-100% + 26px)); }
.map-card h3 { margin: 0 22px 6px 0; color: var(--gold-2); }
.map-card p { margin: 0 0 8px; }
.map-card .map-card-tags .tag { margin: 0 4px 4px 0; }
.map-card .map-card-here { margin: 8px 0 0; }
.map-card-close { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.map-card-close:hover { color: var(--text); }

.realm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: .82rem; color: var(--muted); }
.realm-legend span { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 1100px) {
    .realm-img { image-rendering: auto; } /* shrunk below its real size, smooth looks better than dropped pixels */
    .map-node-icon { width: 26px; height: 26px; font-size: 14px; }
    .map-node.map-city .map-node-icon { width: 32px; height: 32px; font-size: 17px; }
    .map-node-name { font-size: .62rem; padding: 0 5px; }
}
@media (max-width: 700px) {
    .realm-map { border-radius: 8px; }
    .map-node-icon { width: 22px; height: 22px; font-size: 12px; border-width: 1.5px; }
    .map-node.map-city .map-node-icon { width: 26px; height: 26px; font-size: 14px; border-width: 2px; }
    .map-node-name { display: none; }
    .map-node.boss .map-node-icon::after { width: 18px; height: 18px; top: -11px; right: -10px; }
    .map-dot { width: 8px; height: 8px; }
    .map-card, .map-card.flip-x, .map-card.flip-y, .map-card.flip-x.flip-y { position: relative; left: auto !important; top: auto !important; width: auto; transform: none; margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .map-dot.dot-you::after, .map-node.heading .map-node-icon { animation: none; }
}

/* Gold fields: "= 1,500,000g" under the box when using 250k / 1.5m / 2b shorthand */
.gold-hint { display: block; min-height: 0; margin-top: 3px; font-size: .78rem; font-weight: 600; color: var(--gold-2); }
.gold-hint:empty { display: none; }
.gold-hint.bad { color: var(--bad); }

/* ---------- Front page (visitors) ---------- */
.public-wrap.public-landing { max-width: 1180px; }
.hero.hero-compact { padding: 18px 0 26px; }
.hero-compact .hero-logo { width: 112px; height: 112px; margin-bottom: 2px; }
.hero-compact .hero-wordmark { width: min(400px, 84vw); }
.hero-kicker { margin: 4px 0 6px; font-family: var(--display); font-size: .82rem; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.hero-compact .hero-sub { margin: 0 auto 22px; font-size: 1.2rem; color: var(--text); font-family: var(--display); letter-spacing: .02em; }
.hero-free { margin: 14px 0 0; }

.realm-public { max-width: 1004px; margin: 0 auto 8px; }   /* the same size as the map inside the game */
@media (min-width: 921px) { .realm-public { max-width: min(1004px, calc(100vw - 316px)); } }   /* in the game the menu takes 260px + padding */
.realm-public .realm-map { border-width: 2px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(240, 198, 110, .25), 0 0 80px rgba(227, 99, 44, .08); }
.realm-live {
    position: absolute; z-index: 5; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px; pointer-events: none;
    padding: 4px 11px 4px 9px; border-radius: 999px; background: rgba(19, 16, 13, .8); border: 1px solid rgba(217, 169, 78, .35);
    font-size: .78rem; font-weight: 600; color: #fbf1dc; text-shadow: 0 1px 2px #000; backdrop-filter: blur(2px);
}
.realm-live i { width: 8px; height: 8px; border-radius: 50%; background: #5ed36a; box-shadow: 0 0 6px rgba(94, 211, 106, .9); }

.landing-stats { display: flex; justify-content: center; gap: clamp(22px, 6vw, 64px); margin: 30px 0 10px; text-align: center; }
.landing-stats b { display: block; font-family: var(--display); font-size: 1.9rem; color: var(--gold-2); line-height: 1.1; }
.landing-stats span { color: var(--muted); font-size: .82rem; letter-spacing: .04em; }
.landing-latest { text-align: center; margin: 8px 0 0; font-size: .92rem; }
.landing-latest .muted { margin-left: 6px; font-size: .85em; }

.landing-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 36px 0 0; }
.landing-feature { display: flex; gap: 14px; align-items: center; padding: 16px 18px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); border-radius: var(--radius); }
.landing-feature-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 30px; }
.landing-feature-icon img { width: 48px; height: 48px; image-rendering: pixelated; }
.landing-feature h3 { margin: 0 0 2px; color: var(--gold-2); font-size: 1rem; }
.landing-feature p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.4; }

.landing-join { text-align: center; margin: 44px 0 0; padding: 34px 20px; border-radius: var(--radius); border: 1px solid var(--border-2);
    background: radial-gradient(ellipse at 50% 0%, rgba(227, 99, 44, .16), transparent 70%), var(--panel); }
.landing-join h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); margin-bottom: 18px; color: var(--text); }
.landing-join p { margin: 14px 0 0; }

@media (max-width: 900px) { .landing-features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    .landing-features { grid-template-columns: 1fr; }
    .landing-stats { flex-wrap: wrap; gap: 14px 30px; }
    .landing-stats > div { min-width: 40%; }
    .hero-compact .hero-logo { width: 88px; height: 88px; }
    .realm-live { top: 8px; left: 8px; font-size: .7rem; }
}

/* ---------- Confirm your email ---------- */
.verify-card { text-align: center; }
.verify-icon { font-size: 44px; line-height: 1; margin: 4px 0 10px; }
.verify-icon img { width: 64px; height: 64px; image-rendering: pixelated; }
.verify-card .form { text-align: left; margin-top: 14px; }
.verify-change { margin: 14px 0 6px; text-align: left; }
.verify-change summary { cursor: pointer; color: var(--gold-2); text-align: center; }
.verify-out { margin-top: 14px; }

/* Two-factor authentication: the login step and the Settings card */
.twofa-card { text-align: center; }
.twofa-card .form, .twofa-card .verify-change { text-align: left; }
.twofa-input { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 1.35rem; letter-spacing: .18em; text-align: center; }
.twofa-card .twofa-input { width: 100%; }
.twofa-setup { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.twofa-qr { flex: 0 0 196px; width: 196px; aspect-ratio: 1; background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-2); }
.twofa-qr svg { display: block; width: 100%; height: 100%; }
.twofa-steps { flex: 1 1 280px; margin: 0; padding-left: 20px; }
.twofa-steps li { margin-bottom: 12px; }
.twofa-steps li .muted { display: block; margin-top: 4px; }
.twofa-key { user-select: all; letter-spacing: .06em; color: var(--gold-2); word-break: break-word; }
.twofa-confirm { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.twofa-confirm .twofa-input { width: 9.5em; }
.twofa-mobile { display: none; }
@media (hover: none) and (pointer: coarse) { .twofa-mobile { display: inline; } }
.twofa-codes-box { border: 1px dashed var(--gold); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; background: #0d0b09; }
.twofa-codes-box h3 { margin-top: 0; color: var(--gold-2); }
.twofa-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 22px; margin: 12px 0; white-space: pre-line; }
.twofa-codes code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 1.1rem; letter-spacing: .08em; background: none; padding: 0; color: var(--gold-2); }
.twofa-actions { margin-top: 14px; }
.twofa-actions h3 { margin: 0 0 4px; }
.twofa-actions .twofa-input { max-width: 14em; }
.twofa-off { margin-top: 14px; }
.twofa-off summary { cursor: pointer; color: var(--muted); }
.twofa-warning { margin: 10px 0; padding: 10px 14px; border-radius: 8px; background: rgba(200, 70, 60, .1); border: 1px solid rgba(200, 70, 60, .45); }
.twofa-warning p { margin: 0 0 6px; }
.twofa-warning ul { margin: 0 0 8px; padding-left: 18px; }
.twofa-warning li { margin-bottom: 6px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-2); cursor: pointer; }
.link-btn:hover { color: var(--ember-2); text-decoration: underline; }


/* Deeds and Boons */
.deeds-summary-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.deeds-summary-stats div { display: flex; flex-direction: column; }
.deeds-summary-stats b { font-size: 1.6rem; color: var(--gold-2); font-variant-numeric: tabular-nums; line-height: 1.1; }
.deeds-summary-stats span { font-size: .8rem; color: var(--muted); }
.deeds-cat { margin: 22px 0 10px; font-size: 1.1rem; }
.deeds-grid, .boons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 8px; }
.deed, .boon { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.deed:target, .boon:target { border-color: var(--gold); }
.deed-complete, .boon-max { border-color: rgba(217, 169, 78, .45); background: linear-gradient(180deg, rgba(217, 169, 78, .07), var(--panel) 60%); }
.boon-soon { opacity: .7; border-style: dashed; }
.deed-head { display: flex; gap: 10px; align-items: center; }
.deed-head h3 { margin: 0; font-size: 1rem; }
.deed-head p { margin: 0; }
.deed-icon { font-size: 26px; line-height: 1; width: 34px; text-align: center; flex: 0 0 34px; }
.deed p { margin: 0; }
.deed .bar-foot { margin-top: -2px; }
.deed-ranks { list-style: none; padding: 0; margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.deed-ranks li { font-size: .72rem; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--muted); }
.deed-ranks li b { color: var(--gold-2); font-weight: 700; }
.deed-ranks li.done { color: var(--good); border-color: rgba(120, 190, 120, .4); }
.deed-ranks li.next { color: var(--text); border-color: var(--gold); }
.boon-pips { display: flex; gap: 3px; }
.boon-pips span { flex: 1; height: 7px; border-radius: 2px; background: #0d0b09; border: 1px solid var(--border); }
.boon-pips span.on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold); }
.boon-pips span.paused { border: 1px dashed var(--gold); background: rgba(217, 169, 78, .12); }
.boon form { margin-top: auto; }
.boon .btn { white-space: normal; text-align: left; line-height: 1.3; }
.boon p { margin: 0; }
.gold-text { color: var(--gold-2); }
@media (max-width: 640px) { .deeds-summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .deeds-summary-stats b { font-size: 1.35rem; } }
.admin-deed table input { width: 100%; }

/* Deeds on a profile */
.pdeeds-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pdeeds-head h2 { margin: 0; }
.pdeeds-count { color: var(--muted); font-size: .9rem; }
.pdeeds-count b { color: var(--gold-2); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.pdeeds-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; margin-bottom: 16px; }
.pdc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pdc-icon { font-size: 18px; width: 22px; text-align: center; flex: 0 0 22px; }
.pdc-body { flex: 1; min-width: 0; }
.pdc-body small { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.pdc-body .bar { height: 6px; }
.pdc > b { font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--text); min-width: 42px; text-align: right; }
.pdc > b span { color: var(--muted); font-weight: 400; }
.pdc-full > b { color: var(--good); }
.medals { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.medal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 6px 8px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--border); cursor: default; }
.medal-face { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 25px;
    background: radial-gradient(circle at 35% 30%, #4a3a26, #1a140e 70%); border: 3px solid #8a6a43; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .4); }
.medal-full { border-color: rgba(217, 169, 78, .45); background: linear-gradient(180deg, rgba(217, 169, 78, .1), var(--panel-2) 70%); }
.medal-full .medal-face { border-color: var(--gold); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .45), 0 0 10px rgba(217, 169, 78, .35); }
.medal-pips { display: flex; gap: 3px; }
.medal-pips i { width: 6px; height: 6px; border-radius: 50%; background: #0d0b09; border: 1px solid var(--border-2); }
.medal-pips i.on { background: var(--gold-2); border-color: var(--gold); }
.medal b { font-size: .78rem; line-height: 1.2; color: var(--gold-2); }
.medal small { font-size: .68rem; color: var(--muted); line-height: 1.2; }
.medals-more { margin-top: 10px; }
.medals-more summary { cursor: pointer; color: var(--gold-2); font-size: .85rem; margin-bottom: 10px; }
.profile-deeds > p:last-child { margin: 12px 0 0; }
@media (max-width: 640px) {
    .pdeeds-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
    .pdc > b { min-width: 0; }
    .medals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .medal { padding: 8px 4px 6px; }
    .medal-face { width: 44px; height: 44px; font-size: 21px; }
}

/* Login: keep me logged in + forgot password on one line */
.login-extra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 10px; }
.login-extra label.check { font-size: .9rem; }

/* Pixel-art icons (deeds, deed categories, Boons) */
.pix-icon { width: 32px; height: 32px; image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; display: inline-block; }
.deeds-cat .pix-icon { margin-right: 4px; position: relative; top: -2px; }
.pdc-icon { flex: 0 0 32px; width: 32px; }
.admin-deed label .pix-icon { width: 24px; height: 24px; image-rendering: auto; }

/* Pixel-art pictures that replace emoji (src/emoji_icons.php) */
.emo { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.28em; object-fit: contain; }
.btn .emo, .tag .emo, .tab .emo { width: 1.25em; height: 1.25em; margin: -0.15em 0; }
.item-icon .emo { width: 34px; height: 34px; margin: 0; vertical-align: middle; }
.gather-mats .emo { width: 1.5em; height: 1.5em; }

/* ---------- Admin → Monitor ---------- */
.tile-value.bad { color: var(--bad); }
.table-scroll { overflow-x: auto; }
.monitor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.monitor-head h2 { margin: 0; }
.monitor-head + .table, .monitor-head + p { margin-top: 12px; }
.monitor-chart { display: block; width: 100%; height: auto; overflow: visible; }
.monitor-chart .mc-base { stroke: var(--border-2); stroke-width: 1; }
.monitor-chart .mc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.monitor-chart .mc-label { fill: var(--muted); font-size: 11px; }
.monitor-chart .mc-hit { fill: transparent; }
.monitor-chart .mc-bar { fill: var(--gold); }
.monitor-chart .mc-slow { fill: var(--ember); }
.monitor-chart .mc-err { fill: var(--bad); stroke: var(--panel); stroke-width: 2; }
.monitor-chart .mc-col:hover .mc-hit { fill: rgba(255, 255, 255, .05); }
.monitor-chart .mc-col:hover .mc-bar { fill: var(--gold-2); }
.monitor-key { margin: 8px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mk { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.mk:first-child { margin-left: 0; }
.mk-bar { background: var(--gold); }
.mk-slow { background: var(--ember); }
.mk-err { background: var(--bad); border-radius: 50%; }
.monitor-tabs { margin-top: 4px; }
.monitor-alerts { list-style: none; margin: 12px 0 0; padding: 0; }
.monitor-alerts li { padding: 8px 0 8px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.monitor-alerts li:last-child { border-bottom: 0; }
.monitor-alerts li.unread { border-left-color: var(--gold); }
.monitor-alerts li:not(.unread) { color: var(--muted); }
.ma-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 2px; }

/* ---------- Travel pack (Inventory) and Stables ---------- */
.pack-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pack-head h2 { margin: 0; }
.pack-head .pix-icon { width: 1.6em; height: 1.6em; vertical-align: -0.45em; }
.pack-bar { height: 8px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); overflow: hidden; margin: 10px 0; }
.pack-bar i { display: block; height: 100%; background: var(--gold); }
.pack-full .pack-bar i { background: var(--ember); }
.pack-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 8px; margin: 10px 0; }
.pack-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.pack-item > span { flex: 1; min-width: 0; }
.pack-form { display: flex; align-items: center; gap: 6px; }
.pack-form input[type=number] { width: 64px; margin: 0; }
.pack-all { margin-top: 6px; }
/* Pinned pack items stay packed when the player gets back to Nullvald (src/game/stables.php pack_home_check). */
.pack-item.pinned { border-color: rgba(240, 198, 110, .45); background: linear-gradient(90deg, rgba(240, 198, 110, .07), transparent 60%), var(--panel-2); }
.btn-pin { opacity: .75; }
.btn-pin:hover, .btn-pin:focus-visible { opacity: 1; }
.btn-pin.active { opacity: 1; color: var(--gold-2); border-color: rgba(240, 198, 110, .55); }
.pack-pinned-out { margin: 8px 0 0; line-height: 2; }
.pack-pinned-out form.inline { display: inline-block; margin-left: 4px; }
.pack-note { margin: 8px 0 0; }
@media (max-width: 600px) { .pack-item { flex-wrap: wrap; } .pack-item > span { flex-basis: calc(100% - 48px); } }
.horse-cell { display: flex; align-items: center; gap: 10px; }
.horse-cell .pix-icon, .school-icon .pix-icon, .lodge-icon .pix-icon { width: 48px; height: 48px; }
.horse-facts { margin: 6px 0 10px; padding-left: 18px; }
.horse-buy { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.horse-buy input { flex: 1 1 120px; margin: 0; }
.horse-buy input[name=name] { flex-basis: 100%; }
.horse-buy select { flex: 1 1 140px; margin: 0; }
.horse-tiers { margin: 4px 0 8px; font-size: .82rem; }
.horse-tiers th { padding: 4px 4px; font-size: .68rem; letter-spacing: .03em; }
.horse-tiers td { padding: 4px; }
.horse-tiers th:first-child, .horse-tiers td:first-child { padding-left: 0; }
.horse-tiers th:last-child, .horse-tiers td:last-child { padding-right: 0; }
.horse-list { display: flex; flex-direction: column; gap: 8px; }
.horse-list + p { margin-top: 12px; }
.horse-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.horse-riding { background: rgba(217, 169, 78, .08); border-color: rgba(217, 169, 78, .45); }
.horse-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.horse-manage { grid-column: 1 / -1; padding-left: 58px; }
.horse-manage summary { cursor: pointer; color: var(--muted); font-size: .85rem; width: max-content; }
.horse-manage summary:hover { color: var(--gold-2); }
.horse-manage-body { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.horse-rename { display: flex; gap: 6px; flex: 1 1 260px; max-width: 380px; }
.horse-rename input { flex: 1; margin: 0; }
@media (max-width: 520px) {
    .horse-manage { padding-left: 0; }
    .horse-row { grid-template-columns: minmax(0, 1fr); }
    .horse-actions { justify-content: flex-start; flex-wrap: wrap; padding-left: 58px; }
}

/* Monster portraits (assets/monsters/*.png): fill the card's picture box; shrunk copies are smoothed so no pixels drop out. */
.monster-icon:has(.monster-portrait) { overflow: hidden; padding: 0; }
.monster-portrait { width: 100%; height: 100%; image-rendering: auto; }
.boss-card .monster-icon:has(.monster-portrait) { width: 84px; height: 84px; flex-basis: 84px; }
@media (max-width: 640px) { .boss-card .monster-icon:has(.monster-portrait) { width: 64px; height: 64px; flex-basis: 64px; } }
img.monster-pic.emo { image-rendering: auto; width: 1.6em; height: 1.6em; vertical-align: -0.45em; }
.fighter-icon .monster-pic.avatar-lg { margin: 0 auto; }
/* Long buttons in a hunting ground's header (e.g. "Gather here: …") wrap on phones instead of pushing the page sideways. */
.region-hero > div:last-child { min-width: 0; }
.region-hero .btn { white-space: normal; text-align: left; max-width: 100%; }
/* Phones: every meter keeps room for its "+5 in 4:07" line, however short its numbers */
@media (max-width: 920px) { .top-stat .top-stat-body { min-width: 2.95rem; } }
@media (max-width: 400px) { .top-stat .top-stat-body { min-width: 2.75rem; } }
@media (max-width: 400px) {
    .top-stat { gap: 3px; }
    .top-stat-icon .gicon { width: 15px; height: 15px; }
}

/* ---------- Wiki (public/wiki.php) ---------- */
body.wiki { background: var(--bg); }
.wiki-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, calc((100% - 1100px) / 2)); border-bottom: 1px solid var(--border); background: var(--bg-2); }
.wiki-brand { display: flex; align-items: center; gap: 8px; color: var(--gold-2); font-family: var(--display); font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; }
.wiki-brand:hover { text-decoration: none; color: var(--gold-2); }
.wiki-brand b { color: var(--text); font-weight: 500; }
.wiki-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }
.wiki-contents { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 1px; font-size: .9rem; }
.wiki-contents-title { font-family: var(--display); color: var(--gold-2); font-weight: 700; margin-bottom: 6px; }
.wiki-contents a { color: var(--text); padding: 4px 8px; border-radius: 6px; }
.wiki-contents a:hover { background: var(--panel-2); text-decoration: none; }
.wiki-contents a.active { background: var(--panel-2); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.wiki-group { margin: 12px 0 2px; padding: 0 8px; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.wiki-article { max-width: 760px; line-height: 1.6; }
.wiki-article h1 { font-family: var(--display); color: var(--gold-2); margin: 4px 0 10px; font-size: 1.9rem; }
.wiki-article h2 { font-family: var(--display); color: var(--gold-2); font-size: 1.25rem; margin: 26px 0 8px; }
.wiki-article h3 { font-size: 1.05rem; margin: 18px 0 4px; }
.wiki-article ul { padding-left: 1.2em; }
.wiki-article li { margin: 3px 0; }
.wiki-article .table { margin: 8px 0 12px; white-space: normal; }
.wiki-lead { font-size: 1.05rem; color: var(--text); }
.wiki-crumbs { font-size: .8rem; color: var(--muted); }
.wiki-index { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.wiki-index li { display: flex; flex-direction: column; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.wiki-index li a { font-weight: 600; }
.wiki-index li span { color: var(--muted); font-size: .88rem; }
.wiki-changes { margin-top: 30px; padding-top: 6px; border-top: 1px solid var(--border); }
.wiki-changes ul { list-style: none; padding: 0; font-size: .9rem; }
.wiki-changes time { display: inline-block; min-width: 7.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Wiki: Update log */
.upd-month { margin-top: 28px; }
.upd-month .small { font-family: var(--font); font-weight: 400; margin-left: 6px; }
.upd-list { display: flex; flex-direction: column; gap: 10px; }
.upd { padding: 12px 16px; border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius); background: rgba(255, 255, 255, .02); scroll-margin-top: 80px; }
.upd-new { border-left-color: var(--good); }
.upd-fix { border-left-color: #6fa3d8; }
.upd:target { border-color: var(--gold-2); box-shadow: 0 0 0 1px rgba(240, 198, 110, .35), 0 0 18px rgba(240, 198, 110, .12); }
.upd-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.upd-head h3 { flex: 1; min-width: 12em; margin: 0; font-size: 1.02rem; }
.upd-head h3 a { color: var(--text); }
.upd-head time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.upd-tag { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; color: var(--gold-2); }
.upd-new .upd-tag { color: var(--good); }
.upd-fix .upd-tag { color: #8fbbe6; }
.upd-body { margin-top: 6px; font-size: .92rem; }
.upd-body p { margin: 6px 0; }
.upd-body ul { margin: 6px 0; padding-left: 1.3em; }
.upd-body li { margin: 2px 0; }
.wiki-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px 16px 30px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
    .wiki-shell { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 14px; }
    .wiki-side { order: 2; border-top: 1px solid var(--border); padding-top: 14px; } /* phones: the page first, the contents after it */
    .wiki-contents { position: static; }
    .wiki-article h1 { font-size: 1.5rem; }
    .wiki-play { font-size: .8rem; }
}

/* The "?" next to a page's title that opens its wiki page */
.wiki-help { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-left: 8px; border: 1px solid var(--border-2); border-radius: 50%; font-family: var(--font); font-size: .55em; font-weight: 700; color: var(--muted); vertical-align: middle; position: relative; top: -.15em; }
.wiki-help:hover { color: var(--gold-2); border-color: var(--gold); text-decoration: none; }

/* Refill rings: a ring around each meter's icon fills up clockwise until the next refill, then starts again from
   empty. A full meter shows a closed ring. --p (0 to 1) is set by live_parts.php and kept moving by app.js. */
.top-stat-icon { --rs: 32px; --rw: 2px; --ring: var(--gold); position: relative; flex: none; width: var(--rs); height: var(--rs); display: inline-grid; place-items: center; }
.top-stat-icon .gicon { width: calc(var(--rs) - 2 * var(--rw) - 6px); height: calc(var(--rs) - 2 * var(--rw) - 6px); }
.top-stat-icon::before { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    background: conic-gradient(var(--ring) calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .10) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw) - .5px), #000 calc(100% - var(--rw)));
            mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw) - .5px), #000 calc(100% - var(--rw))); }
.bar-row.is-full .top-stat-icon { --p: 1 !important; }
[data-bar="energy"] .top-stat-icon { --ring: var(--energy); }
[data-bar="courage"] .top-stat-icon { --ring: var(--courage); }
[data-bar="health"] .top-stat-icon { --ring: var(--health); }
[data-bar="focus"] .top-stat-icon { --ring: #8fb6e8; }
@media (max-width: 920px) { .top-stat-icon { --rs: 26px; } }
@media (max-width: 400px) { .top-stat-icon { --rs: 24px; } }


/* Newcomers without a martial school: the prompt that sends them to the Training Hall, and the chooser there. */
.school-prompt .btn { margin-left: 8px; vertical-align: middle; }
.school-choose { border-color: rgba(217, 169, 78, .55); }

/* Adventurers' Guild: the day's missions and the Dawnbreak Elixir for handing them all in. */
.ag-daily { display: flex; gap: 16px; align-items: center; }
.ag-daily-pic { flex: none; width: 56px; height: 56px; display: grid; place-items: center; font-size: 2.2rem; }
.ag-daily-pic img { width: 56px; height: 56px; image-rendering: pixelated; }
.ag-daily-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ag-daily-main h2 { margin: 0; }
.ag-daily-main p { margin: 0; }
.ag-daily-side { flex: none; }
.mission.handed { opacity: .6; }
.mission.handed .bar-fill { background: var(--good); }
@media (max-width: 640px) { .ag-daily { flex-wrap: wrap; } .ag-daily-pic { width: 40px; height: 40px; } .ag-daily-pic img { width: 40px; height: 40px; } .ag-daily-side { width: 100%; } }

/* Admin: country flags next to IP addresses (src/geoip.php). The sprite holds 40×30 flags, shown at half size. */
.flag { display: inline-block; width: 20px; height: 15px; vertical-align: -2px; border-radius: 2px; background: url('../flags.png?v=1') no-repeat; background-size: 320px 255px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.flag-none { background: none; box-shadow: none; font-size: 13px; line-height: 15px; text-align: center; opacity: .6; }
.ip { white-space: nowrap; }
.ip a code { color: inherit; }
.school-edit-list { display: flex; flex-direction: column; margin: 4px 0 10px; }
.school-edit { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 10px 0; border-bottom: 1px solid var(--border); }
.school-edit-name { flex: 1 1 140px; min-width: 0; align-self: center; }
.school-edit-field { flex: none; margin: 0; font-size: .8rem; white-space: nowrap; }
.school-edit-field select { width: 170px; }
.school-edit-field input { width: 110px; }
/* Admin lists that stay inside the card on phones (inventory, connections on the Edit player page). */
.admin-list { display: flex; flex-direction: column; margin-bottom: 10px; }
.admin-list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.admin-list-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.admin-list-qty { flex: none; color: var(--muted); }
.admin-list-row > .btn, .admin-list-row > form { flex: none; }

/* Training Hall: each stat's battle value (trained stat plus weapon, armour, school and Boons). */
.stat-battle { font-size: .85rem; margin: -2px 0 10px; }
.stat-battle b { color: var(--gold-2); }
.stat-battle .small { font-size: .72rem; line-height: 1.3; margin-top: 2px; }

/* Training Hall: Mastery echoes (a third of each mastered school's signature ability, in every fight). */
.echo-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.echo-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.echo-list .school-icon { flex: none; font-size: 1.4rem; }
.echo-list .echo-off { opacity: .55; }
@media (max-width: 700px) { .echo-list { grid-template-columns: 1fr; } }

/* Search boxes: a small drawn magnifier instead of an emoji in the placeholder (admin pages keep theirs). */
input[type="search"]:not([placeholder*="🔍"]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%23a89f8c' stroke-width='2'/%3E%3Cpath d='M10 10l4.5 4.5' stroke='%23a89f8c' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.6rem center;
    background-size: 1rem;
    padding-left: 2.1rem;
}
.suggest-icon img { image-rendering: pixelated; vertical-align: middle; }

/* ---- The Torchbearers and the Master's Scrolls (Settings → The Torch / Master's Scrolls) ---- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.torch h3, .scrolls h3 { margin: 18px 0 6px; font-size: 1rem; }
.torch-link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.torch-link-row code { padding: 6px 10px; overflow-wrap: anywhere; font-size: .88rem; }
.torch-ask input { flex: 1; min-width: 0; }
.torch-grid { margin-top: 4px; }
.torch-wards td { vertical-align: top; }
.torch-rewards { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.torch-reward { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.die { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; padding: 0 3px; border-radius: 5px;
    font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); }
.die-win { border-color: var(--good); color: var(--good); }
.die-miss { color: var(--muted); }
.scroll-now { padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--gold); border-radius: var(--radius); background: rgba(217, 169, 78, .07); }
.scroll-now b { color: var(--gold-2); }
.scroll-table td { vertical-align: middle; }
.scroll-does-phone, .scroll-phone-word { display: none; }
.scroll-history li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.status-scroll { background: rgba(217, 169, 78, .1); border-color: rgba(217, 169, 78, .55); color: var(--gold-2); }
.torch-invite { margin-bottom: 12px; }
.torch-lv-phone { display: none; }
@media (max-width: 600px) {
    /* Each Ward becomes a block: name and level, then what they've brought you. */
    .torch-wards thead { display: none; }
    .torch-wards tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
    .torch-wards tr:last-child { border-bottom: 0; }
    .torch-wards td { display: block; padding: 3px 0; border: 0; }
    .torch-wards td:nth-child(2) { display: none; }
    .torch-lv-phone { display: inline; }
    .torch-wards td.torch-rewards { display: flex; }
    .torch-wards, .scroll-table { white-space: normal; }
    .torch-wards, .torch-wards tbody, .scroll-table, .scroll-table tbody { display: block; width: 100%; }
    /* Each scroll becomes a block: name and teaching on the left, reads left, how many you have and Read on the right. */
    .scroll-table thead { display: none; }
    .scroll-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); }
    .scroll-table tr:last-child { border-bottom: 0; }
    .scroll-table td { display: block; padding: 0; border: 0; text-align: right; font-size: .85rem; }
    .scroll-table td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; text-align: left; font-size: .92rem; }
    .scroll-table td:nth-child(2) { display: none; }
    .scroll-table td:nth-child(n+3) { grid-column: 2; }
    .scroll-table td:empty, .scroll-none { display: none; }
    .scroll-does-phone, .scroll-phone-word { display: inline; }
    .scroll-does-phone { display: block; }
}

/* ---- The Marketplace: one item's market, price help when selling, the price history graph ---- */
.market-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.market-item-title { display: flex; align-items: center; gap: 12px; }
.market-item-title h2 { margin: 0 0 2px; }
.market-item-title .item-icon img, .market-item-title .item-icon { font-size: 2rem; }
.market-stats .tile-value { font-size: 1.25rem; }
.market-browse td, .market-offers td, .market-orders td { vertical-align: middle; }
.market-offers tr.cheapest td { background: rgba(121, 194, 125, .05); }
.market-mine .reprice { gap: 6px; flex-wrap: nowrap; }
.market-mine .price-input { width: 8em; flex: 0 0 8em; }
.market-order-form h3 { margin: 14px 0 6px; font-size: 1rem; }
.market-order-form .row, .market-watch-form { align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.market-order-form label, .market-watch-form label { margin: 0; }
.price-help { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); }
.price-help-row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; padding: 2px 0; }
.price-help-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.price-help .notice { margin: 8px 0 0; }
.price-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price-history-head h2 { margin: 0; }
.price-history-head .filters { margin: 0; }
.price-chart-wrap { position: relative; margin: 12px 0 6px; min-height: 200px; }
.price-chart { display: block; overflow: visible; touch-action: pan-y; }
.price-chart .pc-grid { stroke: var(--border); stroke-width: 1; }
.price-chart .pc-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.price-chart .pc-band { fill: rgba(217, 169, 78, .14); stroke: none; }
.price-chart .pc-line { fill: none; stroke: var(--gold-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.price-chart .pc-dot { fill: var(--gold-2); stroke: var(--panel); stroke-width: 2; }
.price-chart .pc-dot.on { r: 6; }
.price-chart .pc-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.price-chart .pc-hit { fill: transparent; cursor: crosshair; }
.pc-tip { position: absolute; pointer-events: none; z-index: 2; padding: 6px 9px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border-2);
    color: var(--text); font-size: .8rem; line-height: 1.35; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.recent-sales { margin-top: 8px; }
@media (max-width: 600px) {
    .market-browse th:nth-child(5), .market-browse td:nth-child(5) { display: none; }
    .market-offers th:nth-child(4), .market-offers td:nth-child(4) { display: none; }
    .market-history th:nth-child(7), .market-history td:nth-child(7) { display: none; }
    .stat-tiles.market-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .market-stats .tile-value { font-size: 1.05rem; }
}

/* ---- Admin → Activity (messages, trades, money trail, activity times) ---- */
.act-find .row { flex-wrap: wrap; gap: 8px; align-items: center; }
.act-find input { max-width: 260px; }
.act-messages { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.act-convo { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--text); border: 1px solid transparent; }
.act-convo:hover { background: var(--panel-2); text-decoration: none; }
.act-convo.active { border-color: var(--gold); background: var(--panel-2); }
.act-convo .muted { display: block; }
.act-thread { max-height: 75vh; overflow-y: auto; }
.act-line, .act-msg { padding: 8px 10px; margin: 6px 0; border-radius: var(--radius); background: var(--panel-2); border-left: 3px solid var(--border-2); }
.act-line.act-mine { border-left-color: var(--gold); }
.act-msg-head { margin-bottom: 2px; }
.act-msg-head .tag { margin-left: 6px; }
.act-msg-body { white-space: normal; overflow-wrap: anywhere; }
.act-trades td, .act-money td { vertical-align: top; }
.act-money tr.act-flag td { background: rgba(201, 67, 61, .07); }
.act-vs { gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.act-vs input { max-width: 240px; }
.act-grid { border-collapse: separate; border-spacing: 2px; font-size: .72rem; }
.act-grid th { font-weight: 400; color: var(--muted); text-align: left; padding-right: 6px; white-space: nowrap; }
.act-grid thead th { text-align: center; padding: 0; }
.act-grid td { width: 18px; height: 16px; border-radius: 3px; background: var(--panel-2); }
.act-grid td.k1, .act-key.k1 { background: var(--gold); }
.act-grid td.k2, .act-key.k2 { background: #5b9bd5; }
.act-grid td.k3, .act-key.k3 { background: #c9433d; }
.act-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.act-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
@media (max-width: 900px) { .act-messages { grid-template-columns: 1fr; } .act-thread { max-height: none; } }

/* Settings → Notifications (src/push.php) */
.push [hidden] { display: none !important; }
.push h3 { margin: 18px 0 8px; }
.push .push-status { margin: 6px 0 10px; }
.push-ios { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-top: 10px; }
.push-ios ol { margin: 6px 0 0; padding-left: 20px; }
.push-devices { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.push-devices li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: var(--panel-2); border-radius: var(--radius); }
.push-prefs { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.push-kind { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.push-kind input { width: auto; margin: 3px 0 0; flex: none; }
.push-kind .small { display: block; }

/* Wiki: the notifications troubleshooter (views/wiki/notifications.php) */
.wiki-trouble { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.wiki-trouble details { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.wiki-trouble details[open] { border-color: var(--border-2); }
.wiki-trouble summary { cursor: pointer; font-weight: 600; }
.wiki-trouble details > :not(summary) { margin-top: 8px; }

/* Lodgings & Stables: a "!" on a tab with something unpaid, and the homes for sale folding away once you own one */
.tab-alert { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; border-radius: 50%; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: 1px; }
.lodge-sale > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.lodge-sale > summary::-webkit-details-marker { display: none; }
.lodge-sale > summary h2 { margin: 0; }
.lodge-sale > summary::after { content: '▾'; margin-left: auto; color: var(--gold-2); transition: transform .15s; }
.lodge-sale[open] > summary::after { transform: rotate(180deg); }
.lodge-sale[open] > summary { margin-bottom: 12px; }
.lodge-sale > summary:hover h2 { color: var(--gold-2); }

/* Wiki bestiary: a card per monster (views/wiki/bestiary.php, views/wiki/region.php, wiki_beast_html()) */
.beast-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 18px; }
.beast { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); scroll-margin-top: 12px; }
.beast:target { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.beast-boss { border-color: rgba(230, 160, 40, .55); background: linear-gradient(180deg, rgba(230, 160, 40, .08), var(--panel) 60%); }
.beast-pic { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border-2); }
.beast-pic .monster-portrait { display: block; width: 100%; height: 100%; }
.beast-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; line-height: 1.3; }
.beast-head b { font-size: 1rem; }
.beast-lv { margin-left: auto; color: var(--gold-2); font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; }
.beast-desc { margin: 3px 0 0; font-size: .88rem; color: var(--muted); line-height: 1.45; }
.beast-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 8px 0 6px; }
.beast-stats div { padding: 3px 6px; border-radius: 6px; background: var(--bg-2); min-width: 0; }
.beast-stats dt { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.beast-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.beast-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.beast-meta .tag { display: inline-flex; align-items: center; gap: 4px; }
.beast-meta .emo { width: 1.2em; height: 1.2em; }
.tag-muted { color: var(--muted); }
.beast-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.beast-ground { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; scroll-margin-top: 12px; }
.beast-ground a { color: var(--gold-2); }
.beast-region-head { display: flex; align-items: center; gap: 12px; }
.beast-region-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; }
.beast-region-icon img { width: 48px; height: 48px; }
.beast-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.beast-facts div { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.beast-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.beast-facts dd { margin: 0; font-weight: 600; font-size: .9rem; line-height: 1.35; }
.beast-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
    .beast { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 9px 10px; }
    .beast-pic { width: 48px; height: 48px; }
    .beast-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .beast-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.wiki-article .beast + p { margin-top: 8px; }

/* Bounties (Adventurers' Guild → Bounties, src/game/bounties.php) */
.bounty-form { max-width: 560px; }
.bounty-form-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bounty-reason { font-style: italic; color: var(--text); margin: 0 4px; overflow-wrap: anywhere; }
.bounty-mine li, .bounty-recent li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.bounty-mine li:last-child, .bounty-recent li:last-child { border-bottom: 0; }
.wanted-list { display: flex; flex-direction: column; gap: 10px; }
.wanted { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); padding: 10px 12px; scroll-margin-top: 12px; }
.wanted:target { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset; }
.wanted-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wanted-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wanted-who .plink { font-weight: 700; font-size: 1.05rem; }
.wanted-total { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.wanted-total b { color: var(--gold-2); font-size: 1.1rem; }
.wanted-bounties { margin: 8px 0 0; }
.wanted-bounties li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 4px 0; border-top: 1px dashed var(--border); }
.pill-wanted { border-color: var(--bad); color: #ff9b8f; }
.pill-wanted:hover { text-decoration: none; background: rgba(255, 68, 54, .12); }
.bounty-note { padding: 8px 10px; border: 1px solid rgba(255, 68, 54, .45); border-radius: var(--radius); background: rgba(255, 68, 54, .08); }
.bounty-form + h3, .card h3:has(+ .bounty-mine) { margin-top: 18px; }

/* Phones: the box a tapped meter, cooldown or timer shows in place of the hover title (app.js) */
.tap-tip {
    position: absolute; z-index: 60; max-width: min(300px, calc(100vw - 16px)); padding: 8px 11px; white-space: pre-line;
    font-size: .8rem; line-height: 1.4; color: var(--text); background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border-2); border-radius: 8px; box-shadow: 0 10px 26px rgba(0, 0, 0, .6); pointer-events: none;
}

/* Battle screen: the missions this fight counts towards (Xheres) */
.battle-missions { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-color: rgba(240, 198, 110, .55);
    background-image: linear-gradient(100deg, rgba(240, 198, 110, .09), rgba(240, 198, 110, 0) 60%); }
.battle-missions > .mission-flag-icon { width: 22px; height: 22px; margin-top: 2px; }
.battle-missions-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.battle-mission { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 4px 10px; align-items: center; font-size: .88rem; }
.battle-mission .bar { margin: 0; }
.battle-mission b { font-variant-numeric: tabular-nums; color: var(--gold-2); white-space: nowrap; }
.battle-mission.done b { color: var(--good); }
@media (max-width: 560px) { .battle-mission { grid-template-columns: minmax(0, 1fr) auto; } .battle-mission .bar { grid-column: 1 / -1; grid-row: 2; } }

/* One amount picked for a whole page: Training Hall sessions, Gathering gathers (app.js) */
.amount-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; }
.amount-picker-label { font-family: var(--display); }
.amount-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.amount-chips .btn { min-width: 44px; }
.amount-input { width: 84px; margin: 0; text-align: center; }
.train-go { width: 100%; }
/* Inventory: a consumable's Use box (remembered per item) */
.use-many .btn-max { padding-left: 8px; padding-right: 8px; }

/* Admin → Sign-ups (pages/admin_sources.php) */
.su-chart { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 18px; border-bottom: 1px solid var(--border-2); }
.su-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.su-col:hover .su-bar { background: var(--gold-2); }
.su-col:hover { background: rgba(255, 255, 255, .03); }
.su-bar { width: 100%; max-width: 28px; margin: 0 auto; background: var(--gold); border-radius: 4px 4px 0 0; }
.su-peak { position: absolute; top: 0; left: 0; }
.su-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.su-share { width: 22%; min-width: 80px; }
.su-share span { display: block; height: 8px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--gold); }
.su-links { margin: 8px 0 12px; padding-left: 18px; }
.su-links li { margin: 4px 0; }
.su-links code { user-select: all; word-break: break-all; }
.su-table th { white-space: nowrap; }
.su-periods { margin-bottom: 14px; }

/* Exterminations in the Depths and the guild hall (views/guild_depths.php, views/guild_hall.php) */
.depths-intro p:last-child { margin-bottom: 0; }
.depths-grade { margin-left: 4px; }
.depths-grade.grade-hard { border-color: rgba(227, 99, 44, .7); color: var(--ember-2); }
.depths-grade.grade-deadly { border-color: rgba(224, 93, 85, .8); color: #f19a94; background: rgba(224, 93, 85, .12); }
.depths-party { list-style: none; margin: 10px 0 0; padding: 0; }
.depths-party li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 7px 0; border-top: 1px solid var(--border); }
.depths-party li:first-child { border-top: 0; }
.depths-who { min-width: 150px; }
.depths-waves { display: inline-flex; gap: 3px; }
.depths-waves i { width: 14px; height: 8px; border-radius: 2px; background: var(--panel-2); border: 1px solid var(--border-2); }
.depths-waves i.done { background: var(--gold); border-color: var(--gold); }
.depths-waves i.fell { background: var(--bad); border-color: var(--bad); }
.depths-empty { font-style: italic; }
.depths-next { display: flex; gap: 14px; align-items: center; width: 100%; }
.depths-next .monster-portrait { flex: 0 0 auto; width: 96px; height: 96px; image-rendering: pixelated; }
.depths-next > div { flex: 1; min-width: 0; }
.depths-next form { margin-top: 8px; }
.depths-job + .depths-job { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-2); }
.depths-job-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.depths-board tr.taken td { opacity: .55; }
.depths-board tr.taken td:last-child { opacity: 1; }
.depths-faces { white-space: nowrap; }
.depths-faces .emo { width: 28px; height: 28px; }
.hall-renown { display: flex; gap: 24px; align-items: center; }
.hall-renown p { margin: 0; }
.hall-renown > div { white-space: nowrap; }
.hall-funds { display: flex; gap: 24px; }
.hall-up .hall-cost { margin: auto 0 6px; }
.hall-up .hall-cost + .inline { margin-top: 0; }
.hall-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.hall-up { margin: 0; display: flex; flex-direction: column; }
.hall-up .inline, .hall-up p:last-child { margin-top: auto; }
.hall-up-head { display: flex; align-items: center; gap: 8px; }
.hall-up-head h3 { margin: 0; flex: 1; }
.hall-icon .emo { width: 28px; height: 28px; }
.hall-pips { display: flex; gap: 3px; margin: 8px 0 4px; }
.hall-pips i { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border); }
.hall-pips i.on { background: var(--gold); border-color: var(--gold); }
.hall-up.maxed { border-color: rgba(217, 169, 78, .55); }
@media (max-width: 1000px) { .hall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .hall-grid { grid-template-columns: 1fr; } .hall-renown { flex-direction: column; align-items: flex-start; gap: 8px; } }

/* Guild → Log (views/guild_log.php) */
.guild-log td { vertical-align: top; }
.guild-log .guild-log-icon { width: 28px; text-align: center; }
.guild-log td:nth-child(2) { line-height: 1.5; }
@media (max-width: 920px) {
    /* Small screens: let each line wrap instead of scrolling sideways (tables don't wrap there, see above). */
    .table.guild-log { display: table; white-space: normal; }
    .guild-log td { padding-left: 4px; padding-right: 4px; }
    .guild-log td:nth-child(3), .guild-log td:nth-child(4) { font-size: .78rem; }
}

/* Guild → Exterminations → Who's ready (views/guild_depths.php) */
@media (max-width: 920px) {
    .table.depths-roster { display: table; white-space: normal; }
    .depths-roster td { padding-left: 4px; padding-right: 4px; vertical-align: top; }
    .depths-roster td.right { font-size: .85rem; }
}

/* Map emotes (views/realm_map.php, worldmap.js): a comic speech bubble over a dot, and the picker under the map. */
.map-dot.has-emote { z-index: 3; }
.map-emote {
    position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%); transform-origin: 50% 100%;
    display: flex; align-items: center; justify-content: center; width: 42px; height: 40px;
    background: #fffaf0; border: 2px solid #1a1209; border-radius: 12px; box-shadow: 2px 2px 0 rgba(0, 0, 0, .45);
    animation: emote-pop .35s cubic-bezier(.2, 1.6, .5, 1) both, emote-out .6s ease-in forwards;
}
.map-emote::after {   /* the tail, pointing down at the dot */
    content: ''; position: absolute; left: 50%; top: 100%; margin-left: -5px; width: 0; height: 0;
    border: 5px solid transparent; border-top: 7px solid #1a1209; border-bottom: 0;
}
.map-emote::before {
    content: ''; position: absolute; left: 50%; top: 100%; margin-left: -3px; margin-top: -3px; width: 0; height: 0; z-index: 1;
    border: 3px solid transparent; border-top: 5px solid #fffaf0; border-bottom: 0;
}
.map-emote img { width: 32px; height: 32px; image-rendering: pixelated; }   /* the pictures are 32×32: never scaled */
@keyframes emote-pop { from { transform: translateX(-50%) scale(.2); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes emote-out { from { opacity: 1; } to { opacity: 0; transform: translateX(-50%) translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .map-emote { animation: none; transform: translateX(-50%); } }

.realm-legend .map-emote-wrap { position: relative; }
.map-emote-btn img.emo { width: 18px; height: 18px; }
.map-emote-pick {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: max-content; max-width: calc(100vw - 32px); padding: 10px;
    display: grid; grid-template-columns: repeat(9, 36px); gap: 4px;   /* fixed cells: the box fits every picture */
    background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.map-emote-pick[hidden] { display: none; }
.map-emote-title, .map-emote-msg { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); line-height: 1.35; }
.map-emote-msg:empty { display: none; }
.map-emote-choice { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.map-emote-choice:hover, .map-emote-choice:focus-visible { border-color: var(--gold); background: rgba(217, 169, 78, .12); }
.map-emote-choice img { width: 32px; height: 32px; image-rendering: pixelated; }
@media (max-width: 480px) { .map-emote-pick { grid-template-columns: repeat(7, 36px); } }

/* Exterminations: the finish choice next to each contract's Open button, and the line under a party (views/guild_depths.php) */
.depths-open { display: inline-flex; align-items: stretch; gap: 6px; justify-content: flex-end; }
.depths-open select { width: auto; margin: 0; padding: 4px 8px; font-size: .82rem; }
.depths-goal { flex-basis: 100%; }

/* Settings → Notifications: the sections (General, Bars, Exterminations) */
.push-section { margin: 14px 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.push-prefs .push-section:first-of-type { margin-top: 4px; }

/* Sidebar menu groups fold away (views/layout_game.php; remembered by app.js in the nav_closed cookie) */
.nav-sec > summary.nav-group { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; user-select: none; border-radius: 6px; padding: 2px 0; }
.nav-sec > summary.nav-group::-webkit-details-marker { display: none; }
.nav-sec > summary.nav-group::after { content: '▾'; margin-left: auto; font-size: .8rem; transition: transform .15s; opacity: .7; }
.nav-sec:not([open]) > summary.nav-group::after { transform: rotate(-90deg); }
.nav-sec > summary.nav-group:hover { color: var(--gold-2); }
.nav-sec > summary.nav-group:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
/* A folded group with something waiting (unread messages, Boons to spend) shows an ember dot */
.nav-sec:not([open]):has(.nav-alert) > summary.nav-group::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 6px var(--ember); order: 2; }
@media (prefers-reduced-motion: reduce) { .nav-sec > summary.nav-group::after { transition: none; } }
/* The Supporter Shop and cosmetics (pages/store.php, src/game/store.php) */
.profile-portrait { position: relative; }
.profile-portrait.has-frame { padding: 16px; border-color: transparent; background: none; }
.portrait-frame { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
@media (max-width: 640px) { .profile-portrait.has-frame { padding: 12px; } }
.profile-hero.has-banner { background-color: var(--panel); background-size: auto, cover; background-position: center; background-repeat: no-repeat; image-rendering: pixelated; }
.store-intro p:last-child { margin-bottom: 0; }
.store-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.store-grid .store-item { align-items: center; text-align: center; }
.store-pic { min-height: 132px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.store-pic .store-icon { width: 96px; height: 96px; image-rendering: pixelated; }
.store-pic .profile-portrait { display: inline-block; }
.store-banner { width: 100%; max-width: 320px; height: auto; aspect-ratio: 4 / 1; object-fit: cover; border-radius: 8px; image-rendering: pixelated; }
.store-perks { text-align: left; margin: 0 0 8px; padding-left: 18px; font-size: .92rem; flex: 1; }
.store-perks li { margin: 2px 0; }
.store-item .price { font-size: 1.4rem; margin: 6px 0 8px; }
.store-item .btn { min-width: 120px; }
.store-legal { margin-top: 18px; }
.wardrobe-pic { image-rendering: pixelated; max-width: 240px; height: auto; }
.wardrobe-banner .wardrobe-pic { aspect-ratio: 4 / 1; object-fit: cover; border-radius: 6px; }
.wardrobe-none { display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; color: var(--muted); }
/* Guild announcements in Messages (pages/messages.php) */
.convo-guild-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
.convo-guild-icon .emo { width: 32px; height: 32px; }
.chat-line.guild-ann { max-width: 92%; }

/* The game's own pop-up (Nullvald.ask / Nullvald.tell in app.js), used for every data-confirm button. */
.nv-dialog {
    width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
    display: none; flex-direction: column;
    background: var(--panel); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(240, 198, 110, .08);
}
.nv-dialog[open] { display: flex; animation: nv-dialog-in .14s ease-out; }
.nv-dialog::backdrop { background: rgba(8, 6, 4, .72); }
.nv-dialog-title {
    margin: 0; padding: 18px 22px 12px; font-size: 1.1rem; color: var(--gold-2);
    border-bottom: 1px solid var(--border);
}
.nv-dialog-body { padding: 14px 22px 4px; overflow-y: auto; }
.nv-dialog-body p { margin: 0 0 .8em; }
.nv-dialog-body ul { margin: 0 0 .8em; padding-left: 1.2em; }
.nv-dialog-body li { padding: 2px 0; }
.nv-dialog-body li::marker { color: var(--gold); }
.nv-dialog-buttons {
    display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px;
    padding: 14px 22px 18px; border-top: 1px solid var(--border); background: var(--bg-2);
    border-radius: 0 0 var(--radius) var(--radius);
}
.nv-dialog-buttons .btn { min-width: 96px; }
.nv-dialog-buttons .btn[hidden] { display: none; }
.nv-dialog-buttons .btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
@keyframes nv-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nv-dialog[open] { animation: none; } }
@media (max-width: 600px) {
    .nv-dialog-title, .nv-dialog-body, .nv-dialog-buttons { padding-left: 16px; padding-right: 16px; }
    .nv-dialog-buttons .btn { flex: 1; }
}

/* Durability (src/game/durability.php): condition bars on gear, tools and the Forge's repairs. */
.condition { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: .85em; }
.condition-bar { display: inline-block; width: 56px; height: 6px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; vertical-align: middle; }
.condition-bar i { display: block; height: 100%; background: var(--good); }
.condition.low { color: var(--gold-2); }
.condition.low .condition-bar i { background: var(--gold); }
.condition.broken { color: var(--bad); }
.condition.broken .condition-bar i { background: var(--bad); }
.skill-tool { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 6px; }
.skill-tool .pix-icon, .skill-tool img { width: 20px; height: 20px; }
.forge-repairs .repair-table td { vertical-align: middle; }
.forge-repairs .actions { margin-top: 10px; }
.shop-subtitle { margin: 16px 0 8px; font-size: 1rem; }
.shop-subtitle .small { font-family: var(--font); font-weight: 400; }


/* Tolerance (src/game/tolerance.php) in the top bar: a line with the cooldowns on wider screens; on phones its own slim
   row under the strip, with a bar, so the strip of times keeps to one line. */
.top-tol-bar { display: none; }
@media (max-width: 920px) {
    .top-cds .top-tol { flex-basis: 100%; gap: 6px; padding: 2px 1px 0; }
    .top-cds .top-tol .top-cd-label { display: inline; font-size: .6rem; }
    .top-tol-bar { display: block; flex: 1; height: 5px; border-radius: 999px; background: #0d0b09; border: 1px solid var(--border); overflow: hidden; }
    .top-tol-bar span { display: block; height: 100%; background: linear-gradient(90deg, #6b4a8f, #b48be0); }
    .top-cds .top-tol .top-cd-val { min-width: 2.6em; text-align: right; }
}

/* ---------- First-week path (home page) ---------- */
.first-steps h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 1.1rem; margin: 0 0 4px; }
.first-steps-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.first-steps-list li { padding: 6px 10px; border-radius: 8px; background: var(--panel-2); }
.first-steps-list li.done { opacity: .6; text-decoration: line-through; }

/* ---------- Guild hall goal ---------- */
.hall-goal h3 { margin: 0 0 2px; font-size: 1rem; }
.hall-goal-why { margin: 0 0 8px; }
.hall-goal-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; margin: 6px 0; }
.hall-goal-row .bar { margin: 0; }
@media (max-width: 520px) { .hall-goal-row { grid-template-columns: 56px 1fr; } .hall-goal-row > span:last-child { grid-column: 2; } }
.hall-goal-bar .bar-fill { background: linear-gradient(90deg, #6b5a2a, var(--gold)); }
.hall-goal-bar.done .bar-fill { background: linear-gradient(90deg, #2f7d3a, var(--good)); }

/* ---------- Heralds' Hall: titles and name colours (src/game/heralds.php) ---------- */
.herald-title { font-weight: 400; font-style: italic; color: var(--gold-2); }
.name-silver { color: #d4dbe2; }
.name-emerald { color: #5fd18a; }
.name-azure { color: #66b2ff; }
.name-crimson { color: #ff6f6f; }
.name-amethyst { color: #bf98ff; }
.name-aurora { color: #7fe3d4; background: linear-gradient(90deg, #5ee7c5, #6aa8ff 35%, #c38bff 65%, #ff8ad1); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
/* Admin → Reports: each report's sender record, and marking one false (src/moderation.php report_mark_false). */
.report-line { margin-bottom: 6px; }
.report-false { display: inline-block; margin-left: 6px; }
.report-false > summary { cursor: pointer; color: var(--muted); }
.report-false form { margin: 6px 0; max-width: 420px; }

/* Messages: the safety note (views/messages_safety.php) and the real-money reminder (pages/messages.php). */
.msg-safety { border-color: rgba(121, 194, 125, .45); }
.msg-safety h2 { margin-top: 0; }
.msg-safety ul { margin: 0 0 10px; padding-left: 1.2em; line-height: 1.55; }
.notice-warn { background: rgba(224, 93, 85, .1); border-color: rgba(224, 93, 85, .5); color: #f6c2bd; line-height: 1.5; }
.notice-warn a { color: #ffd9a0; }
/* Admin → Reports: urgent cards (sexual messages or grooming) and the messages between reporter and reported. */
.report-urgent { border-color: rgba(224, 93, 85, .7); box-shadow: 0 0 0 1px rgba(224, 93, 85, .35); }
.report-msgs { display: inline-block; margin-left: 6px; }
.report-msgs > summary { cursor: pointer; color: var(--muted); }
.report-msg-list { max-height: 320px; overflow-y: auto; margin: 6px 0; padding: 8px 10px; background: var(--panel-2); border-radius: 6px; }
.report-msg-list li { padding: 3px 0; }

/* Admin → Illegal content (pages/admin_safety.php). */
.safety-step h2 { margin-top: 0; }
.safety-step ol, .safety-step ul { padding-left: 1.3em; line-height: 1.6; }
.safety-step li { margin: .3em 0; }
.safety-table td { vertical-align: top; white-space: normal; line-height: 1.5; }
.safety-rules-heading { margin: 28px 0 10px; }
.safety-rising td { color: var(--gold); font-weight: 600; }

/* Report forms (views/report_footer.php): what happens to a report, before it's sent. */
.report-info { margin: 6px 0 10px; padding-left: 1.2em; line-height: 1.5; }
.report-info li { margin: .2em 0; }
.report-notify { margin-top: 4px; }

/* ---------- Launch countdown (src/launch.php) ---------- */
.launch-countdown { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 12px 16px; margin-bottom: 14px;
    border: 1px solid var(--gold); border-radius: 10px; background: linear-gradient(135deg, rgba(217, 169, 78, .16), rgba(240, 120, 60, .08)); }
.launch-countdown .lc-text { display: flex; flex-direction: column; gap: 2px; }
.launch-countdown .lc-title { font-family: var(--display); font-size: 1.15rem; color: var(--gold-2); font-weight: 700; }
.launch-countdown .lc-when { color: var(--muted); font-size: .9rem; }
.launch-countdown .lc-clock { display: flex; gap: 8px; }
.launch-countdown .lc-unit { display: flex; flex-direction: column; align-items: center; min-width: 54px; padding: 6px 4px; border-radius: 8px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(217, 169, 78, .3); }
.launch-countdown .lc-unit b { font-size: 1.5rem; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.launch-countdown .lc-unit small { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.launch-countdown .lc-soon { display: none; font-weight: 700; color: var(--gold-2); }
.launch-countdown.lc-now .lc-clock { display: none; }
.launch-countdown.lc-now .lc-soon { display: block; }
.launch-countdown .lc-more { font-size: .9rem; white-space: nowrap; }
.hero .launch-countdown { max-width: 620px; margin: 16px auto 6px; text-align: left; }
@media (max-width: 560px) {
    .launch-countdown { justify-content: center; text-align: center; }
    .launch-countdown .lc-text { align-items: center; width: 100%; }
    .launch-countdown .lc-unit { min-width: 48px; }
    .launch-countdown .lc-unit b { font-size: 1.25rem; }
}

/* ---------- Deeds: search and filter (pages/deeds.php) ---------- */
.deeds-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.deeds-tools .deeds-search { flex: 1 1 260px; min-width: 0; }
.deeds-tools .deeds-filter { margin: 0; }
.deeds-tools .deeds-filter .chip { cursor: pointer; background: none; font: inherit; font-size: .85rem; }
.deeds-tools .deeds-filter .chip.active { background: var(--gold); }
.deeds-tools .deeds-count { width: 100%; margin: 0; }
.deeds-none { margin: 16px 0; }
.deed[hidden], .deeds-group[hidden] { display: none; }
