/* Fate of the North: shared styles. Colours are tokens so dark mode only swaps values. */

:root {
    --bg: #f3ede2;
    --surface: #fffdf8;
    --surface-2: #f8f2e7;
    --ink: #2b2118;
    --muted: #7b6a57;
    --border: #e3d7c4;
    --accent: #8f4a1c;
    --accent-hover: #74390f;
    --accent-ink: #fffaf2;
    --good: #3d7a36;
    --good-bg: #e7f2e3;
    --bad: #b3261e;
    --bad-bg: #fbe9e7;
    --warn-bg: #fdf3dc;
    --warn: #8a5a00;
    --topbar: #3a2a1c;
    --topbar-ink: #f5ebdc;
    --wood: #8b5a2b;
    --clay: #c0603a;
    --iron: #6b7b8c;
    --crop: #c9a227;
    --map-empty: #dfe9cf;
    --map-empty-hover: #cfdfb8;
    --map-own: #2f6fbf;
    --map-other: #c9772e;
    --map-edge: #b9b0a3;
    --shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 2px 8px rgba(60, 40, 20, .06);
    --radius: 10px;
    --vc-meadow: #cddcae;
    --vc-grass-1: #b9d58f;
    --vc-grass-2: #93b867;
    --vc-road: #d9c39a;
    --vc-square: #e3d0a8;
    --vc-wall: #8a7a66;
    --vc-pad: #a3864f;
    --vc-label: #3b2e1f;
    --sky-1: #7fb5de;
    --sky-2: #cfe6f2;
    --hill-1: #7aa84f;
    --hill-2: #5d8c3a;
    --frame: #7a5230;
    --btn-1: #6cb24a;
    --btn-2: #3f8a2a;
    --field-wood: #5d8a3c;
    --field-clay: #c78452;
    --field-iron: #9aa3ad;
    --field-crop: #e2c35a;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1c1712;
        --surface: #262019;
        --surface-2: #2e271f;
        --ink: #efe6d8;
        --muted: #a8977f;
        --border: #3d3328;
        --accent: #d0803f;
        --accent-hover: #e0955a;
        --accent-ink: #1c1712;
        --good: #7cc070;
        --good-bg: #1f3320;
        --bad: #f08a80;
        --bad-bg: #3a1f1c;
        --warn-bg: #3a2e15;
        --warn: #e6c068;
        --topbar: #120e0a;
        --topbar-ink: #efe6d8;
        --map-empty: #2f3a25;
        --map-empty-hover: #3b4a2e;
        --map-own: #4a88d4;
        --map-other: #c9803f;
        --map-edge: #3a332b;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
        --vc-meadow: #1f2a18;
        --vc-grass-1: #3a5226;
        --vc-grass-2: #2a3d1c;
        --vc-road: #5c4a33;
        --vc-square: #6a563b;
        --vc-wall: #a39580;
        --vc-pad: #7a6242;
        --vc-label: #efe6d8;
        --sky-1: #1b2a44;
        --sky-2: #34486a;
        --hill-1: #2e4a24;
        --hill-2: #22381b;
        --frame: #5a3c22;
        --btn-1: #5aa03c;
        --btn-2: #336f22;
        --field-wood: #3c5e27;
        --field-clay: #8a5634;
        --field-iron: #5f666e;
        --field-crop: #8f7a33;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 40%),
        radial-gradient(circle at 90% 30%, color-mix(in srgb, var(--crop) 8%, transparent), transparent 35%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }

/* ---- Banner: landscape header with round navigation buttons ---- */

.banner {
    position: relative;
    background:
        radial-gradient(120% 60px at 15% 100%, var(--hill-2) 98%, transparent 100%),
        radial-gradient(90% 70px at 75% 100%, var(--hill-1) 98%, transparent 100%),
        radial-gradient(70% 90px at 45% 100%, color-mix(in srgb, var(--hill-1) 70%, var(--sky-2)) 98%, transparent 100%),
        linear-gradient(180deg, var(--sky-1), var(--sky-2));
    border-bottom: 3px solid var(--frame);
}
.banner-inner {
    max-width: 1280px; margin: 0 auto; padding: 10px 16px 14px;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.brand {
    justify-self: start; color: #fff; font: 700 1.35rem Georgia, serif; text-decoration: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 0 12px rgba(0, 0, 0, .25);
}
.brand:hover { color: #fff; }
.navbtns { display: flex; gap: 14px; justify-content: center; }
.navbtn {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    text-decoration: none; color: #fff; font-size: .75rem; font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.navbtn-icon {
    width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    background: radial-gradient(circle at 35% 30%, #fffdf6, #e8d9b8 60%, #c9b184);
    border: 3px solid var(--frame);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .35), inset 0 -3px 6px rgba(120, 80, 30, .25);
    transition: transform .12s, box-shadow .12s;
}
.navbtn:hover { color: #fff; }
.navbtn:hover .navbtn-icon { transform: translateY(-2px); box-shadow: 0 5px 10px rgba(0, 0, 0, .35), inset 0 -3px 6px rgba(120, 80, 30, .25); }
.navbtn.active .navbtn-icon {
    border-color: var(--good);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 45%, transparent), 0 2px 5px rgba(0, 0, 0, .35);
}
.navbtn .badge { position: absolute; top: -2px; right: -4px; }
.badge {
    display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px;
    background: #d9442f; color: #fff; font-size: .75rem; text-align: center; line-height: 1.4em;
    text-shadow: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.banner-links { justify-self: end; display: flex; gap: 12px; }
.banner-links a {
    color: #fff; font-size: .85rem; text-decoration: none; padding: 3px 10px; border-radius: 999px;
    background: rgba(0, 0, 0, .28); text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}
.banner-links a:hover, .banner-links a.active { background: rgba(0, 0, 0, .45); color: #fff; }

/* ---- Resource bar: warehouse and granary groups ---- */

.resbar {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
    box-shadow: 0 2px 6px rgba(60, 40, 20, .08);
}
.resbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 7px 16px;
    display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; justify-content: center;
}
.store {
    display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); font-size: .8rem; color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.store:not(:first-child) { margin-left: 14px; }
.store-icon { font-size: 1rem; }
.res { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 7px; min-width: 118px; }
.res-icon { font-size: 1.35rem; grid-row: span 2; }
.res-text { white-space: nowrap; font-variant-numeric: tabular-nums; }
.res-amount { font-weight: 700; }
.res-rate { color: var(--good); font-size: .75rem; margin-left: 5px; }
.res-rate.neg { color: var(--bad); font-weight: 600; }
.res-fill { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.res-fill span { display: block; height: 100%; border-radius: 2px; transition: width .5s; }
.res-wood .res-fill span { background: var(--wood); }
.res-clay .res-fill span { background: var(--clay); }
.res-iron .res-fill span { background: var(--iron); }
.res-crop .res-fill span { background: var(--crop); }
.res.full .res-amount { color: var(--bad); }
.res-pop { min-width: 0; margin-left: 14px; }

/* ---- Two columns: page and sidebar ---- */

.shell {
    max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px;
    display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; align-items: start;
}
.shell.solo { display: block; }
@media (max-width: 980px) { .shell { grid-template-columns: minmax(0, 1fr); } }

.sidebar { display: grid; gap: 14px; }
.box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.box-title {
    margin: 0; padding: 8px 12px; font-size: .95rem;
    background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 70%, var(--border)));
    border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline;
}
.box-title .muted { font: 400 .8rem system-ui, sans-serif; }
.box > .empty, .box-note { margin: 0; padding: 8px 12px; font-size: .85rem; }
.box-note { padding-top: 0; }
table.mini td { padding: 5px 12px; font-size: .9rem; }
table.mini td.neg { color: var(--bad); font-weight: 600; }
.villages { list-style: none; margin: 0; padding: 4px 0; }
.villages a {
    display: flex; gap: 6px; align-items: baseline; padding: 6px 12px; text-decoration: none; color: var(--ink);
}
.villages a:hover { background: var(--surface-2); color: var(--ink); }
.villages .current a { background: color-mix(in srgb, var(--good) 14%, var(--surface)); font-weight: 700; box-shadow: inset 3px 0 0 var(--good); }
.villages .vname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.villages .vcoords { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.villages .threat { color: var(--bad); }

/* ---- Page and cards ---- */

.page { min-width: 0; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.page-head .meta { color: var(--muted); }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
.card h2 { display: flex; align-items: baseline; gap: 8px; }
.card h2 .level { font: 500 .85rem system-ui, sans-serif; color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid { margin-top: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack > .card { margin-bottom: 0; }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.stats { display: flex; gap: 20px; flex-wrap: wrap; margin: 0; }
.stats div { min-width: 90px; }
.stats dt { color: var(--muted); font-size: .8rem; }
.stats dd { margin: 0; font-weight: 600; }

/* ---- Messages ---- */

.flash, .alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.error, .alert.danger { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.flash.ok { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

/* ---- Tables ---- */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
.level-pill {
    display: inline-block; min-width: 2em; text-align: center; padding: 1px 8px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; font-weight: 600;
}

/* ---- Costs ---- */

.cost { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); font-size: .82rem; white-space: nowrap;
}
td .cost { flex-wrap: nowrap; }   /* tables scroll sideways on phones rather than growing tall */
.chip.short { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

/* ---- Forms ---- */

form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.form-row { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
label { display: inline-flex; align-items: center; gap: 5px; }
input[type=number], input[type=text], input[type=password], select {
    font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 5px 8px;
}
input[type=number] { width: 5.5em; }
input.coord { width: 4.5em; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
    font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 6px;
    background: linear-gradient(180deg, var(--btn-1), var(--btn-2));
    border: 1px solid color-mix(in srgb, var(--btn-2) 80%, #000);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 1px 2px rgba(0, 0, 0, .2);
    color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
    padding: 6px 14px; text-decoration: none; display: inline-block;
    transition: transform .08s, filter .15s;
}
button:active:not(:disabled), .button:active { transform: translateY(1px); }
button:hover:not(:disabled), .button:hover { filter: brightness(1.08); color: #fff; }
button:disabled { box-shadow: none; background: var(--surface-2); color: var(--muted); text-shadow: none; cursor: not-allowed; border: 1px solid var(--border); }
button.secondary, .button.secondary { background: var(--surface-2); color: var(--ink); text-shadow: none; border: 1px solid var(--border); }
button.secondary:hover:not(:disabled), .button.secondary:hover { background: var(--border); color: var(--ink); }

/* ---- Lists ---- */

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.list li:last-child { border-bottom: none; }
.list .when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.unread a { font-weight: 700; }
.empty { color: var(--muted); font-style: italic; }

.troops { display: flex; gap: 8px; flex-wrap: wrap; }
.troop { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.troop strong { font-size: 1.1rem; margin-right: 4px; }

/* ---- Village: field and building tiles ---- */

.crumbs { margin: 0 0 10px; }
.crumbs a { text-decoration: none; }

.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.field-head .muted { font-weight: 400; font-size: .85rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.tiles.centre { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 92px; padding: 10px 6px 8px; border-radius: 10px; text-decoration: none; color: var(--ink);
    background: var(--surface-2); border: 1px solid var(--border);
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); color: var(--ink); }
.tile-icon { font-size: 1.7rem; line-height: 1; }
.tile-name { font-size: .72rem; color: var(--muted); text-align: center; line-height: 1.2; }
.tile-level {
    position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); font-size: .78rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.tile-badge {
    position: absolute; top: 5px; right: 6px; font-size: .75rem; line-height: 1;
    padding: 3px 5px; border-radius: 999px;
}
.tile-badge.up { background: var(--good); color: #fff; }
.tile-badge.working { background: var(--warn-bg); }
.tile.working { border-color: var(--warn); border-style: dashed; }
.tile-wood { background: color-mix(in srgb, var(--wood) 12%, var(--surface)); }
.tile-clay { background: color-mix(in srgb, var(--clay) 12%, var(--surface)); }
.tile-iron { background: color-mix(in srgb, var(--iron) 14%, var(--surface)); }
.tile-crop { background: color-mix(in srgb, var(--crop) 14%, var(--surface)); }
.tile-centre { background: var(--surface); }
.tile.empty { background: transparent; border: 1.5px dashed var(--border); color: var(--muted); }
.tile.empty .tile-icon { font-size: 1.3rem; color: var(--muted); }
.tile.empty:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Village scenes: isometric islands (SVG, see village_view.php) ---- */

.scene { display: block; width: 100%; height: auto; border-radius: 14px; user-select: none; }
.scene-fallback { display: none; }
@media (max-width: 640px) {
    .scene { display: none; }
    .scene-fallback { display: grid; }
}
.scene-card { padding: 8px; overflow: hidden; }
.scene-hint { margin: 8px 4px 0; font-size: .82rem; color: var(--muted); text-align: center; }

/* Sea, island and ground */
.vc-sea { fill: url(#vc-sea-g); }
.vc-waves { animation: vc-waves 9s linear infinite; pointer-events: none; }
@keyframes vc-waves { to { transform: translateX(60px); } }
.vc-island-shadow { fill: #0c1c26; opacity: .45; filter: blur(6px); }
.vc-foam { fill: #d4e2ea; opacity: .35; }
.vc-cliff-l { fill: url(#vc-cliff-lg); stroke: #3d2412; stroke-opacity: .6; stroke-width: 1; stroke-linejoin: round; }
.vc-cliff-r { fill: url(#vc-cliff-rg); stroke: #3d2412; stroke-opacity: .6; stroke-width: 1; stroke-linejoin: round; }
.vc-strata { fill: url(#vc-strata-p); pointer-events: none; }
.vc-island { fill: url(#vc-island-g); stroke: #3a4a26; stroke-opacity: .5; stroke-width: 1; stroke-linejoin: round; }
.vc-lip { fill: none; stroke: #9fb06a; stroke-width: 2; stroke-linejoin: round; opacity: .8; }
.vc-texture, .vc-light, .vc-strata { pointer-events: none; }
.vc-blade { fill: none; stroke-width: .8; stroke-linecap: round; }
.vc-blade.dark { stroke: #3c5228; opacity: .5; }
.vc-blade.light { stroke: #d6dcae; opacity: .35; }
.vc-road-edge { fill: #5e4a32; opacity: .55; }
.vc-road { fill: url(#vc-road-g); }
.vc-path { fill: #8a7656; opacity: .55; }
.vc-town { fill: #8ba364; stroke: #4a5e30; stroke-opacity: .5; stroke-width: 1; }
.vc-plaza { fill: url(#vc-plaza-g); stroke: #8f8068; stroke-width: 1; stroke-linejoin: round; }
.vc-cobble { fill: url(#vc-cobble); pointer-events: none; }
.vc-pond { fill: #4f7a94; stroke: #c8d6dc; stroke-width: 2; stroke-opacity: .7; }

/* Wall: faces lit on the left, shaded on the right; wooden palisade or stone */
.vc-wf { stroke: #3a2a18; stroke-opacity: .55; stroke-width: .8; stroke-linejoin: round; }
.vc-wf-l { fill: url(#vc-wall-l); }
.vc-wf-r { fill: url(#vc-wall-r); }
.vc-wf.wood { fill: url(#vc-stakes); }
.vc-wf-r.wood { filter: brightness(.72); }
.vc-wt { fill: #d6d2c6; stroke: #3a2a18; stroke-opacity: .45; stroke-width: .6; stroke-linejoin: round; }
.vc-wt.wood { fill: #7a5a3c; }
.vc-tips { fill: none; stroke: #3a2616; stroke-width: 1.2; stroke-linejoin: round; }
.vc-wall-plan { fill: none; stroke: #fffbe6; stroke-width: 2; stroke-dasharray: 7 7; opacity: .7; }
.wall-hit { fill: none; stroke: transparent; stroke-width: 26; pointer-events: stroke; }
.wall-link { cursor: pointer; }
.wall-link:hover .vc-wf, .wall-link:focus-visible .vc-wf { filter: brightness(1.15); }
.wall-link:hover .vc-wall-plan { stroke: var(--accent); opacity: 1; }
.wall-link.working .vc-wall-plan { stroke: var(--warn); opacity: 1; }

/* Plots: raised pads; empty ones dashed with a plus */
.plot { cursor: pointer; }
.plot:focus { outline: none; }
.plot .hit { fill: transparent; }
.plot .pad { fill: #a39274; stroke: #4e4030; stroke-width: 1; stroke-linejoin: round; opacity: .75; transition: opacity .15s, stroke .15s; }
.plot .pad.built { fill: #a8987a; opacity: .9; }
.plot.empty .pad { fill: rgba(255, 255, 255, .14); stroke: #fffbe6; stroke-dasharray: 5 5; stroke-width: 1.5; opacity: .9; }
.plot.empty .plus { font: 800 22px system-ui, sans-serif; fill: #fffbe6; text-anchor: middle; opacity: .9; paint-order: stroke; stroke: rgba(40, 60, 20, .35); stroke-width: 2px; }
.plot.empty:hover .pad, .plot.empty:focus-visible .pad { fill: rgba(255, 220, 120, .3); stroke: #ffd34d; stroke-dasharray: none; }
.plot.empty:hover .plus { fill: #ffd34d; }
.plot.working .pad { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 5 4; animation: vc-dash 1.2s linear infinite; }
@keyframes vc-dash { to { stroke-dashoffset: -18; } }

/* Names appear on hover (the town's own name always shows), like floating game labels */
.plot .name { font: 800 12px system-ui, sans-serif; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(20, 30, 10, .75); stroke-width: 3.5px; stroke-linejoin: round;
    opacity: 0; transition: opacity .15s; pointer-events: none; }
.plot:hover .name, .plot:focus-visible .name, .plot .name.town { opacity: 1; }
.plot .name.town { font-size: 15px; }

/* Level and state badges: glossy coins */
.badge-link .lvl { fill: url(#vc-coin); stroke: #2e2010; stroke-width: 1.5; }
.badge-link .lvl-text { font: 700 13px "Palatino Linotype", "Book Antiqua", Georgia, serif; fill: #2a1a08; text-anchor: middle; }
.plot .state.up { fill: #5f7f34; stroke: #2a3a14; stroke-width: 1.5; }
.plot .state.working { fill: #c9a24a; stroke: #4e3a14; stroke-width: 1.5; }
.badge-link:hover .lvl { filter: brightness(1.12); }

/* Buildings lift a little under the pointer */
.plot use.icon { transition: transform .25s ease, filter 2s; transform-box: fill-box; transform-origin: 50% 85%; }
.plot:hover use.icon, .plot:focus-visible use.icon { transform: translateY(-4px) scale(1.04); }
.icon.tower { pointer-events: none; }

/* Life in the scenes: trees out of step, walkers, birds, drifting cloud shadows */
.ph1 { --sway-delay: -1.8s; } .ph2 { --sway-delay: -3.5s; } .ph3 { --sway-delay: -5.2s; }
.vc-life { pointer-events: none; }
.vc-cloud { animation: vc-drift 100s linear infinite; }
@keyframes vc-drift { from { transform: translateX(-320px); } to { transform: translateX(1120px); } }

/* Time of day (html[data-tod], set by layout.php and game.js). The ground gets a tint under
   the buildings; everything drawn above it gets a matching filter; lamps glow after dark. */
.vc-tod { fill: transparent; pointer-events: none; mix-blend-mode: multiply; transition: fill 2s, opacity 2s; }
.vc-glows { opacity: 0; pointer-events: none; mix-blend-mode: screen; transition: opacity 2s; }
.scene use, .scene .pad, .scene .vc-plaza, .scene .vc-wf, .scene .vc-wt, .scene .vc-tips, .scene .vc-path, .scene .vc-pond { transition: filter 2s; }
html[data-tod="dawn"] .vc-tod { fill: #ffc9a0; opacity: .35; }
html[data-tod="dawn"] :is(.scene use, .scene .pad, .scene .vc-plaza, .scene .vc-wf, .scene .vc-wt, .scene .vc-tips, .scene .vc-pond) { filter: sepia(.15) saturate(1.1) brightness(.97); }
html[data-tod="dusk"] .vc-tod { fill: #ff9a5c; opacity: .4; }
html[data-tod="dusk"] :is(.scene use, .scene .pad, .scene .vc-plaza, .scene .vc-wf, .scene .vc-wt, .scene .vc-tips, .scene .vc-pond) { filter: sepia(.25) saturate(1.15) brightness(.9); }
html[data-tod="dusk"] .vc-glows { opacity: .55; }
html[data-tod="dusk"] .scene { --vg-lights: .6; }
html[data-tod="night"] .vc-tod { fill: #22305e; opacity: .75; }
html[data-tod="night"] :is(.scene use, .scene .pad, .scene .vc-plaza, .scene .vc-wf, .scene .vc-wt, .scene .vc-tips, .scene .vc-pond) { filter: brightness(.55) saturate(.7) hue-rotate(-8deg); }
html[data-tod="night"] .vc-glows { opacity: 1; }
html[data-tod="night"] .scene { --vg-lights: 1; }
html[data-tod="night"] .vc-light:not(.vignette), html[data-tod="night"] .vc-cloud { display: none; }
html[data-tod="night"] .vc-foam { opacity: .2; }

@media (prefers-reduced-motion: reduce) {
    .vc-life { display: none; }
    .vc-waves, .plot.working .pad { animation: none; }
    .plot:hover use.icon, .plot:focus-visible use.icon { transform: none; }
}

/* ---- Progress ---- */

.progress { display: block; flex-basis: 100%; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--crop))); transition: width 1s linear; }
.queue li { align-items: center; }

/* ---- Building page ---- */

.building-hero { display: flex; gap: 18px; align-items: center; }
.building-hero h1 { margin-bottom: 4px; }
.building-hero p { margin: 0; }
.hero-icon {
    font-size: 3rem; width: 84px; height: 84px; flex: none; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--border);
}
.level-track { height: 6px; max-width: 320px; margin-top: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.level-track span { display: block; height: 100%; background: var(--good); border-radius: 3px; }

.build-head { display: flex; gap: 12px; align-items: flex-start; }
.build-head h2 { margin-bottom: 2px; }
.build-head p { margin: 0 0 8px; font-size: .9rem; }
.big-icon { font-size: 2rem; line-height: 1; }
.build-option.locked { opacity: .65; }

.segmented { gap: 0; }
.segmented label { gap: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { padding: 6px 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; margin-left: -1px; }
.segmented label:first-child span { border-radius: 6px 0 0 6px; margin-left: 0; }
.segmented label:last-child span { border-radius: 0 6px 6px 0; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); position: relative; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Map ---- */

.map-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.map-wrap { flex: 2 1 460px; max-width: 760px; padding: 10px; }
.map { border-collapse: separate; border-spacing: 2px; width: auto; }
.map td { width: 34px; height: 34px; padding: 0; text-align: center; border: 0; border-radius: 4px; font-size: 14px; }
.map tbody tr:hover td { background: none; }
.map td a { display: block; width: 100%; height: 100%; line-height: 34px; text-decoration: none; color: #fff; border-radius: 4px; }
.map .empty { background: var(--map-empty); }
.map .plain1 { background: color-mix(in srgb, var(--map-empty) 92%, #6a8a3a); }
.map .plain2 { background: color-mix(in srgb, var(--map-empty) 94%, #b8a060); }
.map .forest { background: color-mix(in srgb, var(--map-empty) 70%, #3f6b2a); }
.map .hill { background: color-mix(in srgb, var(--map-empty) 75%, #8a7a5a); }
.map .lake { background: color-mix(in srgb, var(--map-empty) 45%, #5b8fc0); }
.map .empty:hover { filter: brightness(.93); }
.map .decor { opacity: .55; font-size: 13px; }
.map .size1 a { font-size: 12px; }
.map .size2 a { font-size: 16px; }
.map .size3 a { font-size: 20px; }
.map .other { background: var(--map-other); }
.map .own { background: var(--map-own); }
.map .other:hover, .map .own:hover { filter: brightness(1.12); }
.map .edge { background: var(--map-edge); opacity: .5; }
.map .centre { box-shadow: 0 0 0 3px var(--ink) inset; }
.map .axis { background: none; color: var(--muted); font-size: 11px; }
.map-panel { flex: 1 1 260px; min-width: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

/* ---- Landing page ---- */

.banner-links a.play { background: linear-gradient(180deg, var(--btn-1), var(--btn-2)); font-weight: 700; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: center; margin: 12px 0 28px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.08; margin-bottom: 14px; }
.lead { font-size: 1.08rem; line-height: 1.6; color: color-mix(in srgb, var(--ink) 85%, var(--muted)); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 14px; }
.button.big { padding: 12px 22px; font-size: 1.05rem; border-radius: 8px; }
.hero-scene { width: 100%; height: auto; display: block; border-radius: 18px; box-shadow: 0 10px 30px rgba(60, 40, 20, .18); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.features .card { margin: 0; text-align: center; }
.art.feature-art { width: 84px; height: 84px; display: block; margin: 0 auto 6px; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }
.landing-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.landing-cols .card { margin: 0; }
.steps { margin: 0 0 14px; padding-left: 1.3em; display: grid; gap: 10px; }
.world-stats dd { font-size: 1.4rem; }
.landing-footer { text-align: center; margin-top: 28px; font-size: .9rem; }

.siege-result { margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.siege-result p { margin: 4px 0; }
.siege-result .art { width: 26px; height: 26px; vertical-align: middle; }

/* ---- Live notices ---- */

.bell { background: rgba(0, 0, 0, .28); border: 0; box-shadow: none; padding: 3px 8px; border-radius: 999px; line-height: 0; opacity: .55; }
.bell .art { width: 18px; height: 18px; }
.bell:hover:not(:disabled) { background: rgba(0, 0, 0, .45); filter: none; opacity: .85; }
.bell.on { opacity: 1; box-shadow: 0 0 0 2px var(--good); }
.toasts {
    position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px;
    width: min(380px, calc(100vw - 32px));
}
.toast {
    display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
    background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-left: 4px solid var(--good);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18); animation: toast-in .25s ease-out;
}
.toast.danger { border-left-color: var(--bad); }
.toast > a, .toast > span { flex: 1; }
.toast > a { color: var(--ink); text-decoration: none; }
.toast > a:hover { text-decoration: underline; }
.toast button { padding: 4px 10px; font-size: .85rem; }
.toast button.close { background: none; border: 0; box-shadow: none; color: var(--muted); font-size: 1.2rem; padding: 0 4px; text-shadow: none; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Alliance board ---- */

.post { border-top: 1px solid var(--border); padding: 10px 0; }
.post header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.post header form { margin-left: auto; }
.post > div { overflow-wrap: anywhere; line-height: 1.55; }
button.link { background: none; border: 0; box-shadow: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; text-shadow: none; }
button.link:hover:not(:disabled) { color: var(--bad); filter: none; }
.tag { font-weight: 700; color: var(--accent); text-decoration: none; }

/* ---- Admin ---- */

.ban-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ban-form input[type=text] { width: 12em; }
.status { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.status.banned { background: var(--bad-bg); color: var(--bad); }
.status.protected { background: color-mix(in srgb, #4f7fb0 18%, var(--surface)); color: #3a6189; }
.status.admin { background: var(--warn-bg); color: var(--warn); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.danger-zone h2 { color: var(--bad); }
button.danger { background: linear-gradient(180deg, #d9534a, #a8322a); border-color: #8e2a23; }

/* ---- Auth pages ---- */

.auth { max-width: 380px; margin: 8vh auto 0; }
.auth .brand-big { font: 700 2rem Georgia, serif; text-align: center; margin-bottom: 16px; color: var(--accent); }
.auth form { display: grid; gap: 10px; }
.auth input { width: 100%; padding: 9px 12px; }
.auth button { padding: 10px; }

@media (max-width: 760px) {
    .banner-inner { grid-template-columns: 1fr auto; }
    .navbtns { grid-column: 1 / -1; order: 3; gap: 8px; }
    .navbtn-icon { width: 44px; height: 44px; font-size: 1.3rem; }
    .navbtn-label { font-size: .68rem; }
    .store, .res-pop { display: none; }
    .fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
    .tile { min-height: 76px; }
    .res { min-width: 0; }
    .resbar-inner { gap: 6px 14px; }
    h1 { font-size: 1.5rem; }
}

@media (max-width: 520px) {
    .navbtns { gap: 4px; }
    .navbtn-icon { width: 40px; height: 40px; font-size: 1.15rem; border-width: 2px; }
    .navbtn-label { font-size: .6rem; }
}

/* ---- World map (SVG) ---- */

.worldmap { display: block; width: 100%; max-width: 720px; height: auto; }
.worldmap .cell { stroke: var(--surface); stroke-width: 2; }
.worldmap .plain0 { fill: var(--map-empty); }
.worldmap .plain1 { fill: color-mix(in srgb, var(--map-empty) 92%, #6a8a3a); }
.worldmap .plain2 { fill: color-mix(in srgb, var(--map-empty) 94%, #b8a060); }
.worldmap .forest { fill: color-mix(in srgb, var(--map-empty) 80%, #3f6b2a); }
.worldmap .hill { fill: color-mix(in srgb, var(--map-empty) 85%, #8a7a5a); }
.worldmap .lake { fill: color-mix(in srgb, var(--map-empty) 40%, #5b8fc0); }
.worldmap .edge { fill: var(--map-edge); opacity: .45; }
.worldmap .tile-link:hover .cell { filter: brightness(.92); }
.worldmap .base.own { fill: var(--map-own); opacity: .55; }
.worldmap .base.other { fill: var(--map-other); opacity: .55; }
.worldmap .cell-focus { fill: none; stroke: var(--ink); stroke-width: 3; rx: 5; }
.worldmap .axis { font: 11px system-ui, sans-serif; fill: var(--muted); }
.worldmap .route { stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; opacity: .85; animation: route-march 1s linear infinite; }
.worldmap .route.army { stroke: #d2463a; }
.worldmap .route.incoming { stroke: #8b1d14; stroke-width: 3.5; }
.worldmap .route.trade { stroke: #c29a26; }
.worldmap .route.settle { stroke: #4c8a33; }
@keyframes route-march { to { stroke-dashoffset: -11; } }
.worldmap .mover { transition: transform 1s linear; cursor: help; }
.worldmap .mover.incoming use { filter: drop-shadow(0 0 3px #d2463a); }
.route-swatch { background: repeating-linear-gradient(90deg, #8b1d14 0 6px, transparent 6px 10px); height: 4px; vertical-align: 3px; }
@media (prefers-reduced-motion: reduce) { .worldmap .route { animation: none; } .worldmap .mover { transition: none; } }

/* ---- Artwork (art.svg) sizes ---- */

.art { width: 1.35em; height: 1.35em; display: inline-block; vertical-align: -.3em; flex: none; overflow: visible; }
.navbtn-icon .art { width: 38px; height: 38px; }
.res-icon .art { width: 30px; height: 30px; vertical-align: middle; }
.store-icon .art { width: 20px; height: 20px; vertical-align: middle; }
.chip .art { width: 16px; height: 16px; vertical-align: -3px; margin-right: 1px; }
.tile-icon .art { width: 52px; height: 52px; }
.hero-icon .art { width: 76px; height: 76px; }
.big-icon .art { width: 56px; height: 56px; }
.art.unit { width: 30px; height: 30px; vertical-align: middle; }
.list .art, .mini .art, .field-head .art { width: 22px; height: 22px; vertical-align: -6px; }
.hero-icon { font-size: 0; }
@media (max-width: 520px) { .navbtn-icon .art { width: 30px; height: 30px; } }
.outcome .art { width: 16px; height: 16px; vertical-align: middle; }
.tile-badge .art { width: 12px; height: 12px; vertical-align: -2px; }
.tile-badge.up { padding: 3px 4px; }
.hint-up { display: inline-flex; background: var(--good); border-radius: 50%; padding: 2px; vertical-align: -3px; }
.hint-up .art { width: 11px; height: 11px; }
.threat .art { width: 16px; height: 16px; vertical-align: -3px; }
.art.medal { width: 26px; height: 26px; vertical-align: middle; }
.segmented span .art, .tabs .art, .alert .art, .box-title .art, h3 .art { width: 18px; height: 18px; vertical-align: -4px; }
.muted .art, small .art { width: 15px; height: 15px; vertical-align: -3px; }
table.ranking td.actions .art { width: 24px; height: 24px; }

/* Resource picker: a row of icon buttons backed by radio inputs */
.picker { display: inline-flex; border: 0; margin: 0; padding: 0; gap: 0; }
.picker label { gap: 0; }
.picker input { position: absolute; opacity: 0; pointer-events: none; }
.picker span {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); margin-left: -1px; font-size: .9rem;
}
.picker .art { width: 20px; height: 20px; }
.picker label:first-of-type span { border-radius: 6px 0 0 6px; margin-left: 0; }
.picker label:last-of-type span { border-radius: 0 6px 6px 0; }
.picker input:checked + span { background: color-mix(in srgb, var(--good) 18%, var(--surface)); border-color: var(--good); font-weight: 700; position: relative; }
.picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Tabs, inboxes, rankings ---- */

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: -4px 0 12px; flex-wrap: wrap; }
.tabs a {
    padding: 7px 14px; text-decoration: none; color: var(--muted); font-weight: 600;
    border-radius: 8px 8px 0 0; margin-bottom: -2px; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--good); background: var(--surface-2); }

table.inbox td, table.inbox th { padding: 6px 8px; }
table.inbox .check { width: 28px; }
table.inbox .icon-cell { width: 34px; }
table.inbox tr.unread td { font-weight: 700; }
table.inbox tr.unread td a { color: var(--ink); }
.new {
    font: 700 .65rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em;
    background: var(--good); color: #fff; padding: 1px 6px; border-radius: 999px; vertical-align: 1px;
}
.inbox-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.pager { margin-left: auto; display: flex; gap: 12px; align-items: center; }

.outcome {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
    font-size: .8rem; border: 2px solid transparent; background: var(--surface-2); vertical-align: middle;
}
.outcome.win { background: #d9f0d3; border-color: #3d8a33; }
.outcome.partial { background: #fbeebb; border-color: #c49a12; }
.outcome.loss { background: #f8d6d2; border-color: #c0392b; }
.outcome.neutral { border-color: var(--border); }
.verdict.win { color: var(--good); }
.verdict.partial { color: var(--warn); }
.verdict.loss { color: var(--bad); }
.report-view h2 { align-items: center; }

.battle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .battle { grid-template-columns: 1fr; } }
.battle .side { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.battle .side h3 { margin: 0; padding: 8px 12px; font-size: .95rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.battle .side p { margin: 8px 12px 4px; }
.battle .attacker h3 { box-shadow: inset 4px 0 0 #c0392b; }
.battle .defender h3 { box-shadow: inset 4px 0 0 #2f6fbf; }
.battle .winner { border-color: var(--good); }

table.ranking .rank { width: 48px; font-weight: 700; }
table.ranking tr.me td { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
table.ranking td.actions a { text-decoration: none; }

.compose { display: grid; gap: 10px; max-width: 720px; }
.compose label { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 8px; }
.compose label.stacked { grid-template-columns: 1fr; }
.compose input[type=text], .compose textarea { width: 100%; }
textarea {
    font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px; resize: vertical;
}
.message-body {
    white-space: normal; line-height: 1.6; padding: 14px 16px; margin: 10px 0 4px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere;
}


/* Smooth cross-fades between pages; the banner and resource bar stay put */
@view-transition { navigation: auto; }
.banner { view-transition-name: banner; }
.resbar { view-transition-name: resbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ==== Norse theme ===========================================================================
   A layer over everything above: weathered linen backdrop, parchment panels in dark timber frames
   with iron rivets and plank headers, a carved wooden top bar with a bronze knotwork band,
   navigation as round painted shields, forged buttons in blood red and iron, and small-caps
   serif lettering. Dark mode: charcoal timber with candle-warm parchment. */

:root {
    --bg: #d6c9ae;
    --surface: #f2e8d3;
    --surface-2: #e7d9bc;
    --ink: #2b1f14;
    --muted: #6f5c45;
    --border: #bba67f;
    --accent: #8e2a1c;
    --accent-hover: #6e1f14;
    --accent-ink: #f6ecd6;
    --good: #4f6e2c;
    --good-bg: #e1e6cc;
    --bad: #8e2a1c;
    --bad-bg: #f1d9cc;
    --warn: #7a5a14;
    --warn-bg: #efe1bd;
    --frame: #3e2c1e;
    --frame-dark: #1f160f;
    --ribbon-1: #4e3826;
    --ribbon-2: #2e2016;
    --gold: #c9a24a;
    --gold-2: #8a6a2a;
    --iron: #7a8088;
    --topbar-1: #3a2c20;
    --topbar-2: #1c150f;
    --panel-shadow: 0 2px 0 rgba(30, 20, 10, .3), 0 10px 22px rgba(30, 20, 10, .22);
    --game-font: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    --radius: 6px;
    --map-empty: #a1b574;
    --map-empty-hover: #8fa363;
    --map-edge: #3e6680;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #14110e;
        --surface: #241e18;
        --surface-2: #2d251d;
        --ink: #ebdfc8;
        --muted: #a8977c;
        --border: #4d3e2d;
        --accent: #d0664a;
        --accent-hover: #e07e62;
        --accent-ink: #1a120c;
        --good: #93b062;
        --good-bg: #26301c;
        --bad: #e07e62;
        --bad-bg: #3a1e16;
        --warn: #d8b468;
        --warn-bg: #3a2e18;
        --frame: #6e5236;
        --frame-dark: #0e0a07;
        --ribbon-1: #3e2e20;
        --ribbon-2: #241b13;
        --gold: #c9a24a;
        --gold-2: #8a6a2a;
        --panel-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 10px 22px rgba(0, 0, 0, .45);
        --map-empty: #6e8a4a;
        --map-edge: #26445a;
    }
}
:root[data-theme="dark"] {
    --bg: #14110e; --surface: #241e18; --surface-2: #2d251d; --ink: #ebdfc8; --muted: #a8977c; --border: #4d3e2d;
    --accent: #d0664a; --accent-hover: #e07e62; --accent-ink: #1a120c; --good: #93b062; --good-bg: #26301c;
    --bad: #e07e62; --bad-bg: #3a1e16; --warn: #d8b468; --warn-bg: #3a2e18;
    --frame: #6e5236; --frame-dark: #0e0a07; --ribbon-1: #3e2e20; --ribbon-2: #241b13;
    --panel-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 10px 22px rgba(0, 0, 0, .45);
    --map-empty: #6e8a4a; --map-edge: #26445a;
    color-scheme: dark;
}

body {
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 250, 235, .45), transparent 70%),
        repeating-linear-gradient(0deg, rgba(90, 70, 40, .035) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 85%, #fff), var(--bg) 40%, color-mix(in srgb, var(--bg) 88%, #3a2a1a));
    background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body {
        background: radial-gradient(ellipse 70% 40% at 50% 0%, #2a2219, transparent 70%), linear-gradient(180deg, #1a1612, var(--bg));
        background-attachment: fixed;
    }
}

h1, h2, h3, .brand, .box-title, .navbtn, th, .tabs a, button, .button { font-family: var(--game-font); }
h1, h2, h3 { font-weight: 700; letter-spacing: .03em; }
h1, .box-title, .card h2 { font-variant: small-caps; }
.page-head h1, .crumbs a, .hero h1 { text-shadow: 0 1px 0 rgba(255, 250, 235, .6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.page-head h1, .crumbs a, .hero h1) { text-shadow: 0 1px 0 rgba(0, 0, 0, .6); } }
.crumbs a { font-weight: 700; }
.page-head .meta { color: var(--muted); font-style: italic; }

/* ---- Top bar: carved dark timber with a bronze knotwork band ---- */
.banner {
    position: relative;
    background:
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 7px, rgba(255, 230, 190, .03) 7px 8px, transparent 8px 19px),
        linear-gradient(180deg, var(--topbar-1), var(--topbar-2));
    border-bottom: 0;
    box-shadow: 0 4px 12px rgba(10, 6, 2, .45);
    padding-bottom: 10px;
}
.banner::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
    background: #24190f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10'%3E%3Cpath d='M0 5 C6 -1 6 -1 12 5 S18 11 24 5' fill='none' stroke='%23c9a24a' stroke-width='1.6'/%3E%3Cpath d='M0 5 C6 11 6 11 12 5 S18 -1 24 5' fill='none' stroke='%238a6a2a' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x center;
    border-top: 1px solid #8a6a2a; border-bottom: 1px solid #120c07;
}
.banner-inner { padding: 10px 16px 12px; }
.brand {
    font: 700 1.5rem var(--game-font); color: #e0c27a; letter-spacing: .14em; text-transform: uppercase;
    text-shadow: 0 2px 0 #120c07, 0 0 10px rgba(0, 0, 0, .5);
}
.brand:hover { color: #f0d898; }
.navbtns { gap: 12px; }
.navbtn { font-size: .74rem; font-weight: 700; font-variant: small-caps; letter-spacing: .05em; color: #e8d6a8; text-shadow: 0 1px 0 #000, 0 0 4px rgba(0, 0, 0, .7); }
.navbtn:hover { color: #fff3d6; }
/* Each button is a round shield: planks inside an iron rim */
.navbtn-icon {
    width: 58px; height: 58px; border-radius: 50%;
    background:
        radial-gradient(circle at 38% 30%, rgba(255, 240, 210, .28), transparent 55%),
        repeating-linear-gradient(90deg, #7a5a3c 0 9px, #5e4430 9px 10px),
        #6e5236;
    border: 4px solid #7a8088;
    box-shadow: 0 0 0 1.5px #1c140d, inset 0 0 0 1.5px #2e2218, inset 0 -6px 10px rgba(0, 0, 0, .35), 0 4px 8px rgba(0, 0, 0, .45);
}
.navbtn:hover .navbtn-icon { transform: translateY(-2px) rotate(-4deg); box-shadow: 0 0 0 1.5px #1c140d, inset 0 0 0 1.5px #2e2218, inset 0 -6px 10px rgba(0, 0, 0, .35), 0 8px 12px rgba(0, 0, 0, .45); }
.navbtn:active .navbtn-icon { transform: translateY(1px); }
.navbtn.active .navbtn-icon {
    background:
        radial-gradient(circle at 38% 30%, rgba(255, 240, 210, .3), transparent 55%),
        conic-gradient(#8e2a1c 0 25%, #d8c9a8 0 50%, #8e2a1c 0 75%, #d8c9a8 0);
    border-color: #c9a24a;
    box-shadow: 0 0 0 1.5px #1c140d, inset 0 0 0 1.5px #2e2218, 0 0 14px rgba(201, 162, 74, .55), 0 4px 8px rgba(0, 0, 0, .45);
}
.navbtn.active { color: #f0d898; }
.navbtn-icon .art { width: 38px; height: 38px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .5)); }
.badge { background: radial-gradient(circle at 35% 30%, #c4483a, #7a1f14); border: 2px solid #e8d6a8; font-weight: 700; box-shadow: 0 2px 4px rgba(0, 0, 0, .45); }
.navbtn .badge { top: -6px; right: -8px; }
.banner-links a, .bell {
    background: linear-gradient(180deg, #4a3826, #2e2218); color: #e8d6a8;
    border: 1px solid #8a6a2a; font-weight: 700; font-variant: small-caps; letter-spacing: .04em;
}
.banner-links a:hover, .banner-links a.active { background: linear-gradient(180deg, #5a4430, #3a2c20); color: #fff3d6; }
.banner-links a.play { background: linear-gradient(180deg, #9a3424, #6e1f14); border-color: #c9a24a; color: #f6ecd6; box-shadow: none; }

/* ---- Resource bar: dark leather with carved plaques ---- */
.resbar {
    background: linear-gradient(180deg, #2c231b, #1a140f);
    border-bottom: 0; box-shadow: inset 0 -1px 0 #8a6a2a, 0 4px 10px rgba(10, 6, 2, .35);
}
.resbar-inner { padding: 8px 16px; gap: 8px 14px; }
.res {
    position: relative; display: block; min-width: 136px; padding: 4px 12px 5px 34px; border-radius: 4px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .2));
    border: 1px solid #5a4632; box-shadow: inset 0 1px 0 rgba(255, 230, 190, .06), inset 0 2px 4px rgba(0, 0, 0, .4);
    color: #ebdfc8;
}
.res-icon { position: absolute; left: -8px; top: 50%; transform: translateY(-50%); }
.res-icon .art { width: 38px; height: 38px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.res-amount { color: #f1e6cc; font: 700 .98rem var(--game-font); text-shadow: 0 1px 0 #000; }
.res-rate { color: #a8c878; font-weight: 700; }
.res-rate.neg { color: #e08a72; }
.res.full .res-amount { color: #e08a72; }
.res-fill { height: 4px; background: rgba(0, 0, 0, .5); border-radius: 2px; margin-top: 2px; }
.res-fill span { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.res-wood .res-fill span { background: linear-gradient(180deg, #b08458, #7a5a3c); }
.res-clay .res-fill span { background: linear-gradient(180deg, #c27a5a, #8e4a32); }
.res-iron .res-fill span { background: linear-gradient(180deg, #aab0b8, #6a7078); }
.res-crop .res-fill span { background: linear-gradient(180deg, #d8bc72, #a8873a); }
.store {
    background: linear-gradient(180deg, #c9a24a, #8a6a2a); color: #1f160f; border: 1px solid #4e3a14;
    font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 240, 200, .4);
}
.res-pop { min-width: 0; padding-left: 34px; }

/* ---- Panels: parchment in a dark timber frame, iron rivets in the corners ---- */
.card, .box, .battle .side {
    background:
        radial-gradient(circle at 9px 9px, #8a9098 0 2px, #2a2d31 2.3px, transparent 2.8px),
        radial-gradient(circle at calc(100% - 9px) 9px, #8a9098 0 2px, #2a2d31 2.3px, transparent 2.8px),
        radial-gradient(circle at 9px calc(100% - 9px), #8a9098 0 2px, #2a2d31 2.3px, transparent 2.8px),
        radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #8a9098 0 2px, #2a2d31 2.3px, transparent 2.8px),
        linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 3px solid var(--frame); border-radius: var(--radius);
    box-shadow: var(--panel-shadow), inset 0 0 0 1px color-mix(in srgb, var(--frame) 30%, transparent), inset 0 0 30px rgba(120, 90, 50, .12);
}
.box { background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.box-title, .battle .side h3 {
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, .1) 0 1px, transparent 1px 6px),
        linear-gradient(180deg, var(--ribbon-1), var(--ribbon-2));
    color: #e8d6a8; font-weight: 700; padding: 7px 14px; border-bottom: 2px solid var(--gold-2);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .7); letter-spacing: .04em;
}
.box-title .muted { color: rgba(232, 214, 168, .75); }
.card h2 { color: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.card h2::after { content: ""; display: block; flex: 1; height: 1px; margin-left: 10px; align-self: center;
    background: linear-gradient(90deg, color-mix(in srgb, var(--gold-2) 70%, transparent), transparent); }
.sidebar { gap: 16px; }
.villages .current a { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 28%, transparent), transparent); box-shadow: inset 4px 0 0 var(--accent); }

/* ---- Buttons: forged, blood red and iron ---- */
button, .button {
    font-weight: 700; letter-spacing: .05em; font-variant: small-caps; border-radius: 4px; padding: 6px 16px;
    background: linear-gradient(180deg, #a83a28, #82281a 55%, #6a1f14);
    border: 1px solid #2e0c06; border-bottom-width: 3px; color: #f6ecd6;
    box-shadow: inset 0 1px 0 rgba(255, 210, 180, .3), inset 0 0 0 1px rgba(201, 162, 74, .35), 0 2px 4px rgba(0, 0, 0, .25);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .55);
}
button:hover:not(:disabled), .button:hover { filter: brightness(1.12); color: #fff8e6; }
button:active:not(:disabled), .button:active { transform: translateY(2px); border-bottom-width: 1px; margin-bottom: 2px; }
button:disabled {
    background: linear-gradient(180deg, #d6c9ae, #b8a988); border: 1px solid #8a7a5c; border-bottom-width: 3px;
    color: #6f5f45; text-shadow: none; box-shadow: none;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button:disabled { background: linear-gradient(180deg, #3a3026, #2a221a); border-color: #4d3e2d; color: #8a7a62; } }
button.secondary, .button.secondary {
    background: linear-gradient(180deg, #7c838c, #5a6068 55%, #464b52); border-color: #1c1e21; color: #eef0f2; text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
button.secondary:hover:not(:disabled), .button.secondary:hover { background: linear-gradient(180deg, #8a9198, #646a72 55%, #50555c); color: #fff; }
button.danger { background: linear-gradient(180deg, #8a1f14, #5e140c); border-color: #2a0804; }
button.link, .toast button.close, .bell { border-bottom-width: 0; font-variant: normal; }
.button.big { padding: 12px 26px; font-size: 1.1rem; border-radius: 5px; }

/* ---- Inputs, chips, tables, tabs ---- */
input[type=number], input[type=text], input[type=password], select, textarea {
    border: 1px solid var(--border); border-radius: 3px; background: color-mix(in srgb, var(--surface) 70%, #fff);
    box-shadow: inset 0 1px 3px rgba(60, 40, 20, .18); padding: 6px 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(input[type=number], input[type=text], input[type=password], select, textarea) { background: #1a1511; } }
.chip { border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, #fff); font-weight: 700; padding: 1px 8px; border-radius: 3px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip { background: #1a1511; } }
.chip.short { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
th { background: linear-gradient(180deg, var(--ribbon-1), var(--ribbon-2)); color: #e8d6a8; font-weight: 700; letter-spacing: .05em; font-variant: small-caps; text-transform: none; font-size: .85rem; }
th:first-child { border-top-left-radius: 3px; } th:last-child { border-top-right-radius: 3px; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.level-pill { background: linear-gradient(180deg, #d8b868, #a8873a); border: 1px solid #4e3a14; color: #1f160f; font-weight: 700; border-radius: 3px; }
.tabs { border-bottom: 2px solid var(--frame); gap: 4px; }
.tabs a {
    border-radius: 4px 4px 0 0; border: 1px solid var(--border); border-bottom: 0; background: var(--surface-2); color: var(--muted); padding: 6px 16px; margin: 0;
    font-variant: small-caps; letter-spacing: .04em;
}
.tabs a.active { background: linear-gradient(180deg, var(--ribbon-1), var(--ribbon-2)); color: #e8d6a8; border-color: var(--frame); text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.segmented span, .picker span { border-width: 1px; font-weight: 700; }
.segmented input:checked + span { background: linear-gradient(180deg, var(--ribbon-1), var(--ribbon-2)); border-color: var(--frame); color: #e8d6a8; }
.picker input:checked + span { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); }

/* ---- Progress: a dark groove filling with burnished bronze ---- */
.progress, .level-track { height: 7px; border-radius: 2px; background: rgba(40, 25, 10, .25); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.progress span { border-radius: 2px; background: linear-gradient(180deg, #e0c27a, #a8873a 60%, #7a5e24); box-shadow: inset 0 1px 0 rgba(255, 240, 200, .5); }
.level-track span { background: linear-gradient(180deg, #8aa85a, #4f6e2c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }

/* ---- Building page, tiles, alerts, toasts ---- */
.hero-icon {
    width: 104px; height: 104px; border-radius: 50%; border: 5px solid #7a8088;
    background: radial-gradient(circle at 50% 60%, #9fb274, #6e8a4a 70%, #4e6634);
    box-shadow: 0 0 0 2px #1c140d, inset 0 0 0 2px #2e2218, inset 0 -8px 14px rgba(0, 0, 0, .3), 0 4px 8px rgba(0, 0, 0, .3);
}
.hero-icon .art { width: 92px; height: 92px; }
.big-icon .art { width: 64px; height: 64px; }
.tile { border: 2px solid var(--frame); border-radius: 5px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); box-shadow: 0 2px 0 rgba(30, 20, 10, .3); }
.tile:hover { border-color: var(--gold-2); transform: translateY(-2px); }
.tile-level { background: linear-gradient(180deg, #d8b868, #a8873a); border: 1px solid #4e3a14; color: #1f160f; font-weight: 700; }
.alert, .flash { border-radius: 4px; border-width: 1px; border-left-width: 5px; font-weight: 600; }
.toast { border: 3px solid var(--frame); border-left-width: 8px; border-radius: 6px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.toast.danger { border-left-color: var(--bad); }
.outcome { border-width: 2px; }
.new { background: linear-gradient(180deg, #a83a28, #6a1f14); }
.troop { border: 1px solid var(--border); border-radius: 4px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }

/* ---- Landing page ---- */
.hero-scene { border-radius: 8px; border: 4px solid var(--frame); box-shadow: var(--panel-shadow); overflow: hidden; pointer-events: none; }
.hero-scene .scene { display: block; border-radius: 0; }
.hero-scene .badge-link { display: none; }
.lead { color: var(--ink); }

@media (max-width: 760px) {
    .navbtn-icon { width: 46px; height: 46px; border-width: 3px; }
    .navbtn-icon .art { width: 30px; height: 30px; }
    .res { min-width: 0; padding-left: 30px; }
    .res-icon .art { width: 32px; height: 32px; }
}
@media (max-width: 520px) {
    .navbtns { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; width: 100%; }
    .navbtn { min-width: 0; }
    .navbtn-icon { width: 38px; height: 38px; border-width: 3px; }
    .navbtn-icon .art { width: 26px; height: 26px; }
    .navbtn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Island details: beach, surf, life on the sea */
.vc-beach { fill: #b3ad9f; stroke: #8a8578; stroke-width: .8; }
.vc-surf { fill: none; stroke: #dfe8ec; stroke-width: 2.4; stroke-linejoin: round; stroke-dasharray: 14 10; opacity: .75; animation: vc-surf 4s linear infinite; }
@keyframes vc-surf { to { stroke-dashoffset: -48; } }
.vc-sealife { pointer-events: none; }
html[data-tod="night"] .vc-surf { opacity: .3; }
html[data-tod="night"] .vc-sealife .sparkle { display: none; }
@media (prefers-reduced-motion: reduce) { .vc-surf { animation: none; } .vc-boat { display: none; } }
/* ---- Isometric world map ---- */
.map-wrap { flex: 3 1 520px; max-width: none; padding: 8px; overflow: hidden; }
.worldmap { max-width: none; border-radius: 12px; }
.worldmap .map-sea { fill: url(#mt-sea); }
.worldmap .mt-side { stroke: #3d2412; stroke-opacity: .5; stroke-width: .8; stroke-linejoin: round; }
.worldmap .mt-side.l { fill: url(#mt-side-l); }
.worldmap .mt-side.r { fill: url(#mt-side-r); }
.worldmap .mt-top { stroke-linejoin: round; transition: filter .12s; }
.worldmap .tile-link:hover .mt-top { filter: brightness(1.1); stroke: #e0c27a; stroke-opacity: 1; stroke-width: 1.6; }
.worldmap .base { stroke-width: 1.6; stroke-linejoin: round; }
.worldmap .base.own { fill: rgba(58, 90, 122, .55); stroke: #26405a; opacity: 1; }
.worldmap .base.other { fill: rgba(142, 42, 28, .45); stroke: #6e1f14; opacity: 1; }
.worldmap .map-pond { fill: url(#mt-water); stroke: #c8d6dc; stroke-width: 1.2; }
.worldmap .cell-focus { fill: rgba(201, 162, 74, .2); stroke: #e0c27a; stroke-width: 2.6; stroke-linejoin: round; rx: 0; animation: focus-pulse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes focus-pulse { 50% { stroke: #f6e8c0; fill: rgba(201, 162, 74, .34); } }
.worldmap .axis { font: 700 11px "Palatino Linotype", "Book Antiqua", Georgia, serif; fill: #f1e6cc; paint-order: stroke; stroke: #1a1410; stroke-width: 3px; stroke-linejoin: round; }
.worldmap .route { stroke-width: 3; }
.worldmap .mover use { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
@media (prefers-reduced-motion: reduce) { .worldmap .cell-focus { animation: none; } }
/* ---- The saga: sidebar box and chapter list ---- */
.saga-body { padding: 8px 12px 10px; }
.saga-title { margin: 0 0 2px; font: 700 1.02rem var(--game-font); font-variant: small-caps; letter-spacing: .03em; }
.saga-goal { margin: 0 0 6px; font-size: .9rem; }
.saga-count { margin: 2px 0 6px; font-size: .78rem; text-align: right; }
.saga-reward { margin: 0 0 8px; }
.saga-reward .cost { gap: 3px; }
.saga-links { margin: 0; font-size: .85rem; }
.saga-box form { margin: 0; }
.saga-box button { width: 100%; }
.saga-box.ready { border-color: var(--gold-2); box-shadow: var(--panel-shadow), 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 18px color-mix(in srgb, var(--gold) 45%, transparent); animation: saga-glow 2.4s ease-in-out infinite; }
@keyframes saga-glow { 50% { box-shadow: var(--panel-shadow), 0 0 0 2px color-mix(in srgb, var(--gold) 75%, transparent), 0 0 26px color-mix(in srgb, var(--gold) 65%, transparent); } }
.saga-intro .progress { max-width: 420px; }
.saga-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.saga-chapter {
    display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 2px solid var(--border);
}
.saga-chapter h2 { margin: 0 0 4px; font-size: 1.1rem; font-variant: small-caps; }
.saga-chapter p { margin: 0 0 6px; }
.saga-words { font-style: italic; color: color-mix(in srgb, var(--ink) 85%, var(--muted)); }
.saga-num {
    flex: none; width: 38px; height: 46px; display: flex; align-items: center; justify-content: center;
    font: 700 1.1rem var(--game-font); color: #f1e6cc; text-shadow: 0 1px 0 #000;
    background: linear-gradient(180deg, #8a857a, #5a564f); border: 2px solid #2e2c28; border-radius: 16px 16px 4px 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.saga-chapter.done .saga-num { background: linear-gradient(180deg, #7a8a5a, #4f6034); }
.saga-chapter.current { border-color: var(--frame); box-shadow: var(--panel-shadow); }
.saga-chapter.current .saga-num { background: linear-gradient(180deg, #a83a28, #6a1f14); border-color: #2e0c06; }
.saga-chapter.locked { opacity: .55; }
.saga-chapter.locked h2 { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .saga-box.ready { animation: none; } }
/* ---- Village overhaul: rampart, boardwalks, staked plots, harbour ---- */
.vc-bank { stroke: #2e3a1e; stroke-opacity: .5; stroke-width: .7; stroke-linejoin: round; }
.vc-bank.l { fill: url(#vc-bank-l); }
.vc-bank.r { fill: url(#vc-bank-r); }
.vc-bank.far { fill: #4a5a32; }
.vc-crest { fill: #7d8f52; stroke: #2e3a1e; stroke-opacity: .45; stroke-width: .6; stroke-linejoin: round; }
.vc-mud { fill: #5e4a34; opacity: .75; }
.vc-plank { fill: #8a6a48; stroke: #3a2a1a; stroke-width: .5; stroke-opacity: .7; stroke-linejoin: round; }
.vc-plank.b { fill: #7a5c3e; }
.vc-plank.c { fill: #96764f; }
.vc-plank-edge { fill: none; stroke: #2e2216; stroke-width: 1; opacity: .6; }
.vc-post { stroke: #3a2a1a; stroke-width: 2.4; stroke-linecap: round; }
.vc-stake { stroke: #4e3a26; stroke-width: 2; stroke-linecap: round; }
.vc-rope { fill: none; stroke: #d6c49a; stroke-width: 1; stroke-linejoin: round; opacity: .9; }
.plot .pad { fill: rgba(74, 58, 38, .32); stroke: none; opacity: 1; }
.plot .pad.built { fill: rgba(92, 72, 46, .4); }
.plot.empty .pad { fill: rgba(74, 58, 38, .2); stroke: none; stroke-dasharray: none; }
.plot.empty .plus { font-size: 17px; opacity: .75; }
.plot.empty:hover .pad, .plot.empty:focus-visible .pad { fill: rgba(201, 162, 74, .3); stroke: none; }
.plot.empty:hover .vc-rope, .plot.empty:focus-visible .vc-rope { stroke: #f0d898; stroke-width: 1.6; }
.plot.working .pad { fill: rgba(201, 162, 74, .28); stroke: #c9a24a; stroke-width: 1.4; stroke-dasharray: 4 4; }
.wall-link:hover .vc-bank, .wall-link:hover .vc-crest { filter: brightness(1.12); }
.vc-harbour { pointer-events: none; }
html[data-tod="night"] :is(.scene .vc-plank, .scene .vc-bank, .scene .vc-crest) { filter: brightness(.6) saturate(.7); }
html[data-tod="dusk"] :is(.scene .vc-plank, .scene .vc-bank, .scene .vc-crest) { filter: sepia(.2) brightness(.92); }
/* Plots sit in the ground: soft trampled soil, low rope, shadows under stakes and rope */
.plot .pad { fill: rgba(86, 66, 42, .42); filter: blur(1.4px); }
.plot .pad.built { fill: rgba(90, 70, 44, .48); filter: blur(1.6px); }
.plot.empty .pad { fill: rgba(86, 66, 42, .3); }
.plot .pad-core { fill: rgba(66, 50, 30, .3); filter: blur(2px); pointer-events: none; }
.vc-rope-shadow { fill: none; stroke: rgba(20, 14, 6, .3); stroke-width: 1.2; stroke-linejoin: round; filter: blur(.6px); pointer-events: none; }
.vc-stake-shadow { fill: rgba(20, 14, 6, .35); pointer-events: none; }
.vc-stake { stroke-width: 1.8; }
.plot.empty .plus { font-size: 15px; fill: #4a3826; opacity: .6; stroke: rgba(240, 228, 196, .4); stroke-width: 1.5px; }
.plot.empty:hover .plus, .plot.empty:focus-visible .plus { fill: #f0d898; opacity: 1; stroke: rgba(40, 28, 14, .6); }
.plot.empty:hover .pad, .plot.empty:focus-visible .pad { fill: rgba(201, 162, 74, .38); }
html[data-tod="night"] .scene .pad { filter: blur(1.4px) brightness(.6); }
/* Keep the title and the top-right buttons on one line at narrower widths */
.brand, .banner-links a { white-space: nowrap; }
@media (max-width: 900px) { .brand { font-size: 1.15rem; letter-spacing: .08em; } }@media (max-width: 1100px) {
    .banner-inner { grid-template-columns: 1fr auto; }
    .navbtns { grid-column: 1 / -1; order: 3; }
}
/* World map as a continuous landscape: full width, blended ground, the grid only on hover */
.map-layout { flex-direction: column; align-items: stretch; }
.map-layout .map-wrap { flex: none; width: 100%; max-width: none; }
.map-layout .map-panel { flex: none; }
.worldmap .mt-top { stroke-width: 1; stroke-opacity: 1; }
.worldmap .tile-link:hover .mt-top { filter: brightness(1.12); stroke: #e0c27a; stroke-width: 1.6; }
.worldmap .mt-marks, .worldmap .mt-items, .worldmap .mt-clouds, .worldmap .mt-vignette, .worldmap .mt-compass, .worldmap .mt-where { pointer-events: none; }
.worldmap .mt-items a { pointer-events: auto; }
.worldmap .shore { fill: #c9b98a; }
.worldmap .lake-water { fill: #557d95; }
.worldmap .map-village:hover use:first-of-type { filter: brightness(1.12) drop-shadow(0 0 4px #e0c27a); }
.worldmap .map-name { font: 700 12px "Palatino Linotype", "Book Antiqua", Georgia, serif; fill: #f6ecd2; paint-order: stroke; stroke: #1a1410; stroke-width: 3px; stroke-linejoin: round; }
.worldmap .mt-clouds ellipse { fill: #1a1a10; opacity: .1; }
.worldmap .mt-clouds { animation: mt-drift 90s ease-in-out infinite alternate; }
@keyframes mt-drift { to { transform: translate(120px, 40px); } }
.worldmap .mt-compass circle { fill: rgba(241, 230, 204, .85); stroke: #5a4128; stroke-width: 2; }
.worldmap .mt-compass .needle.n { fill: #8e2a1c; }
.worldmap .mt-compass .needle.s { fill: #4a3a28; }
.worldmap .mt-compass text, .worldmap .mt-where { font: 700 14px "Palatino Linotype", "Book Antiqua", Georgia, serif; fill: #f6ecd2; paint-order: stroke; stroke: #1a1410; stroke-width: 3px; }
@media (prefers-reduced-motion: reduce) { .worldmap .mt-clouds { animation: none; } }

/* The castle wall (wall near its top levels): moat, wall-walk, gate passages, slits */
.vc-moat { fill: #4e7088; stroke: #8a7a5a; stroke-width: 1.4; stroke-linejoin: round; }
.vc-walk { fill: #b4ae9f; stroke: #3a2a18; stroke-opacity: .45; stroke-width: .6; stroke-linejoin: round; }
.vc-wf.merlon { stroke-width: .6; }
.vc-gateway { fill: #1c140d; }
.vc-portcullis { fill: none; stroke: #4a4440; stroke-width: 1; stroke-linecap: round; }
.vc-slit { fill: none; stroke: #1c140d; stroke-width: 1.4; stroke-linecap: round; opacity: .85; }
.wall-link:hover .vc-walk { filter: brightness(1.12); }
.vc-ashlar { pointer-events: none; }
/* Castle wall detail */
.vc-wf-l.castle { fill: url(#vc-cwall-l); }
.vc-wf-r.castle { fill: url(#vc-cwall-r); }
.vc-grime { fill: url(#vc-grime-g); pointer-events: none; }
.vc-corbels { fill: none; stroke: #2a2218; stroke-width: 2.6; stroke-dasharray: 1.6 2.4; opacity: .7; }
.vc-cornice { fill: none; stroke: #d6cfbf; stroke-width: 1.1; opacity: .6; }
.vc-walk { fill: #9e9684; }
.vc-moat-edge { fill: #8a8272; stroke: #4a4236; stroke-width: .8; stroke-linejoin: round; }
.vc-moat { fill: #47697f; stroke: none; }
.vc-bridge { fill: #7a5a3c; stroke: #3a2a18; stroke-width: .8; stroke-linejoin: round; }
.vc-bridge-planks { fill: none; stroke: #3a2a18; stroke-width: .5; opacity: .6; }
.vc-chain { fill: none; stroke: #3e3a36; stroke-width: 1; stroke-dasharray: 1.4 .8; }
.vc-banner { fill: #8e2a1c; stroke: #4a140c; stroke-width: .6; stroke-linejoin: round; }
.vc-banner-pole { fill: none; stroke: #5a3517; stroke-width: 1.2; stroke-linecap: round; }

/* ---------- Marketplace ---------- */
.mk-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.mk-hero-art { flex: none; width: 200px; height: 160px; display: grid; place-items: center;
    background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--good) 22%, transparent), transparent 70%); border-radius: 8px; }
.mk-hero-art .art { width: 230px; height: 230px; margin-top: -30px; }
.mk-hero-body { flex: 1 1 320px; min-width: 0; }
.mk-hero-body .stats { margin-top: 10px; }
.mk-tip { margin: 10px 0 0; font-size: .85rem; }
.mk-pips { display: flex; flex-wrap: wrap; gap: 4px; }
.mk-pip { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 70%, #fff); }
.mk-pip .art { width: 26px; height: 26px; }
.mk-pip.busy { opacity: .35; filter: grayscale(.8); border-style: dashed; }
.mk-closed .mk-hero-art .art { filter: grayscale(.6) opacity(.7); }
.mk-reqs { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 4px; }
.mk-reqs li { display: flex; align-items: center; gap: 8px; }
.mk-reqs li .art { width: 26px; height: 26px; }
.mk-reqs li::before { content: "\2717"; color: var(--bad); font-weight: 700; width: 1em; }
.mk-reqs li.met::before { content: "\2713"; color: var(--good); }
.mk-forms { margin-top: 16px; }
.mk-label { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.mk-dest { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mk-dest .mk-label { display: inline; }
.mk-target { margin: 8px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mk-target .art { width: 24px; height: 24px; }
.mk-quick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; }
.mk-quick .chip { text-decoration: none; color: inherit; }
.mk-goods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 10px; }
.mk-good { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 6px;
    background: color-mix(in srgb, var(--surface) 75%, #fff); }
.mk-good-head { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.mk-good-head .art { width: 24px; height: 24px; }
.mk-good input { width: 100%; box-sizing: border-box; }
.mk-good-foot { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; gap: 4px; }
.mk-good .mk-add { padding: 1px 7px; font: 700 .72rem system-ui, sans-serif; letter-spacing: 0; text-transform: none; min-height: 0; line-height: 1.5; }
.mk-summary { margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.mk-summary.over { color: var(--bad); font-weight: 700; }
.mk-side { display: grid; gap: 6px; }
.mk-side input[type=number] { width: 150px; max-width: 100%; }
.mk-swap { text-align: center; font-size: 1.3rem; color: var(--muted); margin: 4px 0; }
.mk-offer .picker { flex-wrap: wrap; }
.mk-road, .mk-board { margin-top: 16px; }
.mk-road .list li { align-items: center; }
.mk-road .list .art { width: 22px; height: 22px; vertical-align: -6px; }
.mk-what { flex: 1; min-width: 200px; }
.mk-dir { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 3px; color: #f6ecd2; }
.mk-dir.out { background: #6e5226; }
.mk-dir.back { background: #5a6a72; }
.mk-dir.in { background: #4f6e2c; }
.mk-filters { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mk-chips, .mk-sort { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mk-chips a, .mk-sort a { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 14px;
    text-decoration: none; color: inherit; font-size: .85rem; background: color-mix(in srgb, var(--surface) 70%, #fff); }
.mk-chips a .art { width: 18px; height: 18px; }
.mk-chips a.on, .mk-sort a.on { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); font-weight: 700; }
.mk-list, .mk-mine { display: grid; gap: 8px; }
.mk-ticket { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.4fr) auto; gap: 12px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid #a8873a; border-radius: 6px;
    background: color-mix(in srgb, var(--surface) 80%, #fff); }
.mk-mine .mk-ticket { grid-template-columns: 1fr auto; border-left-color: #5a6a72; }
.mk-ticket.blocked { opacity: .75; border-left-color: var(--border); }
.mk-who { display: grid; gap: 1px; font-size: .9rem; min-width: 0; }
.mk-who a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-trade { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mk-arrow { font-size: 1.3rem; color: var(--muted); }
.mk-act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.mk-why { color: var(--muted); max-width: 160px; }
.mk-deal { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.mk-deal.great { background: #4f6e2c; color: #f2f6e4; }
.mk-deal.fair { background: #d8c9a0; color: #3a2a18; }
.mk-deal.steep { background: #c99a52; color: #2a1a08; }
.mk-deal.poor { background: #8e2a1c; color: #f6e4dc; }
@media (max-width: 640px) {
    .mk-ticket { grid-template-columns: 1fr; }
    .mk-act { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
    .mk-hero-art { width: 100%; }
}

/* ---------- Builders (construction card) ---------- */
.builders { display: inline-flex; align-items: center; gap: 4px; }
.builder { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, #fff); }
.builder .art { width: 15px; height: 15px; }
.builder.working { background: color-mix(in srgb, #c9a24a 35%, var(--surface)); border-color: #a8873a; }
.builder.locked { opacity: .45; border-style: dashed; }
.builders-tip { margin: -4px 0 8px; font-size: .82rem; }
.builders-tip .art { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Alliance hall ---------- */
.hall-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hall-art { flex: none; width: 220px; height: 170px; display: grid; place-items: center; border-radius: 8px;
    background: radial-gradient(ellipse at 50% 72%, color-mix(in srgb, var(--good) 25%, transparent), transparent 70%); }
.hall-art .art { width: 250px; height: 250px; margin-top: -40px; }
.hall-art .art.unbuilt { filter: grayscale(.8) opacity(.45); }
.hall-body { flex: 1 1 320px; min-width: 0; }
.hall-track { display: flex; gap: 4px; margin: 10px 0; }
.hall-track span { flex: 1; height: 9px; border-radius: 2px; background: rgba(40, 25, 10, .2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }
.hall-track span.done { background: linear-gradient(180deg, #e0c27a, #a8873a); }
.hall-track span.building { background: repeating-linear-gradient(45deg, #e0c27a 0 4px, #a8873a 4px 8px); animation: hall-build 1s linear infinite; background-size: 16px 16px; }
@keyframes hall-build { to { background-position: 16px 0; } }
.hall-benefits { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hall-benefits li { display: flex; gap: 8px; align-items: center; }
.hall-benefits .art { width: 24px; height: 24px; flex: none; }
.hall-next { margin-left: 6px; color: var(--good); font-weight: 700; font-size: .85rem; }
.hall-funds { display: grid; gap: 8px; }
.hall-fund > span:first-child { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.hall-fund .art { width: 18px; height: 18px; }
.hall-donors { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.hall-donors li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; }
.hall-donors li.me { background: color-mix(in srgb, var(--good) 14%, transparent); }
.hall-donors .rank { text-align: center; font-weight: 700; }
.hall-donors .rank .art { width: 24px; height: 24px; }

/* ---------- Jarl page ---------- */
.tier-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9a958a; }
.tier-dot.rare { background: #3a6a9a; }
.tier-dot.legendary { background: #c9a24a; }

/* The banner: a dark mead hall, torchlit from the left */
.jl-banner { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; margin-bottom: 16px;
    padding: 22px 26px; border-radius: 10px; color: #f1e6cc; overflow: hidden; border: 1px solid #1a110a;
    background:
        radial-gradient(ellipse at 12% 40%, rgba(255, 170, 70, .28), transparent 55%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 62px),
        linear-gradient(180deg, #3a2618, #24170e 70%, #1a110a);
    box-shadow: inset 0 0 0 2px rgba(201, 162, 74, .35), inset 0 0 60px rgba(0, 0, 0, .55), 0 4px 14px rgba(0, 0, 0, .3); }
.jl-banner::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
    background: repeating-linear-gradient(90deg, #8e2a1c 0 18px, #c9a24a 18px 22px, #3a5a7a 22px 40px, #c9a24a 40px 44px); opacity: .8; }
.jl-portrait { position: relative; width: 168px; height: 168px; }
.jl-ring { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
    background: radial-gradient(circle at 50% 38%, #f8eed4, #d8c494 62%, #a8873a 63%, #ecd79a 68%, #7a5e24 74%, #3a2a12 76%);
    box-shadow: 0 0 0 3px #1a110a, 0 0 26px rgba(255, 190, 90, .35); }
.jl-ring .art { width: 128px; height: 128px; margin-top: -8px; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.jl-banner.fallen .jl-ring .art { filter: grayscale(1) brightness(.7); transform: rotate(-14deg); }
.jl-level { position: absolute; right: -6px; bottom: 4px; width: 54px; height: 62px; display: grid; place-items: center; align-content: center;
    font: 700 1.5rem/1 "Palatino Linotype", Georgia, serif; color: #1f160f; background: linear-gradient(180deg, #f4e2a4, #b8902e);
    clip-path: polygon(0 0, 100% 0, 100% 64%, 50% 100%, 0 64%); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.jl-level small { font: 700 .55rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 1px; }
.jl-identity { min-width: 0; }
.jl-kicker { margin: 0; font: 700 .72rem system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #c9a24a; }
.jl-name { margin: 2px 0 6px; font: 700 2.1rem/1.1 "Palatino Linotype", "Book Antiqua", Georgia, serif; color: #f6ecd2; letter-spacing: .02em;
    text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 190, 90, .25); font-variant: small-caps; }
.jl-state { margin: 0 0 12px; color: #e0d4b4; }
.jl-state a { color: #ecd79a; }
.jl-pill { display: inline-block; padding: 1px 9px; margin-right: 4px; border-radius: 10px; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.jl-pill.home { background: #4f6e2c; color: #f2f6e4; }
.jl-pill.away { background: #a8873a; color: #1f160f; }
.jl-pill.fallen { background: #8e2a1c; color: #f6e4dc; }
.jl-xp { display: grid; gap: 4px; max-width: 460px; }
.jl-xp-bar { height: 12px; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, .45); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7), 0 0 0 1px rgba(201, 162, 74, .4); }
.jl-xp-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(180deg, #f8e6a8, #c9a24a 55%, #8a6a1a); box-shadow: 0 0 10px rgba(255, 210, 120, .6); transition: width 1s; }
.jl-xp-text { font-size: .8rem; color: #cbbd98; }
.jl-rename { margin-top: 10px; font-size: .8rem; }
.jl-rename summary { cursor: pointer; color: #c9a24a; width: max-content; }
.jl-rename form { margin-top: 6px; }
.jl-rename input { max-width: 220px; }
.jl-stones { display: grid; grid-template-columns: repeat(2, 84px); gap: 8px; }
.jl-stone { display: grid; place-items: center; align-content: center; height: 70px; border-radius: 40% 40% 12% 12% / 30% 30% 10% 10%;
    background: linear-gradient(180deg, #8e8a7e, #5e5a52); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), inset 0 -3px 6px rgba(0, 0, 0, .4), 0 3px 6px rgba(0, 0, 0, .45); }
.jl-stone-value { font: 700 1.2rem "Palatino Linotype", Georgia, serif; color: #f6ecd2; text-shadow: 0 1px 0 #000; }
.jl-stone-label { font: 700 .62rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: #2a2014; }

.jl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.jl-grid > .card { margin: 0; }

/* Arms and armour: the jarl in the middle, his slots around him */
.jl-doll { position: relative; display: grid; grid-template-columns: 1fr 120px 1fr; grid-template-rows: auto auto; gap: 10px 8px; align-items: center; }
.jl-figure { grid-column: 2; grid-row: 1; display: grid; place-items: end center; height: 170px;
    background: radial-gradient(ellipse at 50% 92%, rgba(40, 25, 10, .25), transparent 60%); }
.jl-figure .art { width: 150px; height: 150px; }
.jl-figure.fallen .art { filter: grayscale(1) opacity(.5); }
.jl-slot { display: grid; justify-items: center; text-align: center; gap: 2px; }
.jl-slot.weapon { grid-column: 1; grid-row: 1; }
.jl-slot.armour { grid-column: 3; grid-row: 1; }
.jl-slot.trinket { grid-column: 1 / -1; grid-row: 2; }
.jl-socket { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%;
    background: radial-gradient(circle at 50% 40%, #f6ecd2, #d8c9a0); border: 3px solid #9a958a; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25), 0 2px 4px rgba(0, 0, 0, .2); }
.jl-socket .art { width: 38px; height: 38px; }
.jl-slot.none .jl-socket { border-style: dashed; opacity: .55; }
.jl-slot.none .jl-socket .art { filter: grayscale(1) opacity(.5); }
.rare .jl-socket { border-color: #3a6a9a; box-shadow: 0 0 10px rgba(58, 106, 154, .45), inset 0 2px 4px rgba(0, 0, 0, .25); }
.legendary .jl-socket { border-color: #c9a24a; box-shadow: 0 0 14px rgba(236, 200, 110, .8), inset 0 2px 4px rgba(0, 0, 0, .25); }
.jl-slot-label { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.jl-slot-name { font-size: .9rem; }
.jl-slot-bonus { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.jl-bonus { font: 700 .72rem system-ui, sans-serif; color: #2f4a18; background: color-mix(in srgb, var(--good) 18%, var(--surface)); border-radius: 8px; padding: 0 6px; }
.jl-bonus.up { color: #5a3e08; background: #f0dc9a; }
.jl-bonus.down { color: #f6e4dc; background: #8e2a1c; }

/* Skills as carved stones */
.jl-points { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 700; color: #6a4e10; }
.jl-points span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 1rem; color: #1f160f;
    background: linear-gradient(180deg, #f4e2a4, #b8902e); box-shadow: 0 0 0 0 rgba(236, 200, 110, .7); animation: jl-glow 1.8s ease-in-out infinite; }
@keyframes jl-glow { 50% { box-shadow: 0 0 0 7px rgba(236, 200, 110, 0); } }
.jl-points-none { margin: 0 0 10px; font-size: .85rem; }
.jl-skill { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 10px; align-items: center; padding: 10px; margin-bottom: 8px; border-radius: 8px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, #fff), color-mix(in srgb, var(--surface) 90%, #000)); border: 1px solid var(--border); }
.jl-skill-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: linear-gradient(180deg, #8e8a7e, #5e5a52);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), inset 0 -2px 4px rgba(0, 0, 0, .35); }
.jl-skill-icon .art { width: 32px; height: 32px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.jl-skill-text { display: grid; gap: 2px; min-width: 0; }
.jl-skill-text .muted { font-size: .78rem; }
.jl-runes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.jl-runes span { width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid #a8873a; background: transparent; }
.jl-runes span.on { background: linear-gradient(135deg, #f4e2a4, #b8902e); box-shadow: 0 0 4px rgba(236, 200, 110, .7); }
.jl-skill-total { font: 700 1.1rem "Palatino Linotype", Georgia, serif; min-width: 52px; text-align: right; }
.jl-plus { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 1.2rem; line-height: 1; }
.jl-note { margin: 4px 0 0; font-size: .8rem; }

/* The treasure chest */
.jl-chest-card { margin-bottom: 16px; }
.jl-chest { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.jl-item { position: relative; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 16px 12px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, #fff), var(--surface)); overflow: hidden; }
.jl-item h3 { margin: 4px 0 0; font-size: 1rem; }
.jl-item em { font-size: .78rem; color: var(--muted); }
.jl-item-slot { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.jl-item-tier { position: absolute; top: 10px; right: -30px; width: 110px; transform: rotate(35deg); font: 700 .6rem system-ui, sans-serif;
    text-transform: uppercase; letter-spacing: .1em; padding: 2px 0; background: #9a958a; color: #fff; }
.jl-item.rare { border-color: #3a6a9a; }
.jl-item.rare .jl-item-tier { background: #3a6a9a; }
.jl-item.legendary { border-color: #c9a24a; background: radial-gradient(ellipse at 50% 20%, color-mix(in srgb, #f4e2a4 55%, var(--surface)), var(--surface) 70%);
    box-shadow: 0 0 16px rgba(236, 200, 110, .45); }
.jl-item.legendary .jl-item-tier { background: linear-gradient(90deg, #b8902e, #f4e2a4, #b8902e); color: #3a2a08; }
.jl-item-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.jl-chest-empty { display: flex; gap: 14px; align-items: center; }
.jl-chest-empty .art { width: 72px; height: 72px; flex: none; opacity: .7; }

/* Deeds */
.jl-deeds { list-style: none; margin: 0; padding: 0 0 0 6px; border-left: 2px solid var(--border); display: grid; gap: 10px; }
.jl-deeds li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 8px; }
.jl-deed-mark { width: 12px; height: 12px; margin: 4px 0 0 -14px; border-radius: 50%; border: 2px solid var(--surface); background: #9a958a; }
.jl-deeds li.won .jl-deed-mark { background: #4f6e2c; }
.jl-deeds li.lost .jl-deed-mark { background: #a8873a; }
.jl-deeds li.fell .jl-deed-mark { background: #8e2a1c; }
.jl-deed-text { display: grid; gap: 2px; min-width: 0; }
.jl-deed-text .muted { font-size: .75rem; }
.jl-deed-bits { display: flex; flex-wrap: wrap; gap: 4px; }
.jl-deed-bits .find { font-size: .8rem; }

@media (max-width: 760px) {
    .jl-banner { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 20px 16px 24px; }
    .jl-xp { margin: 0 auto; }
    .jl-stones { grid-template-columns: repeat(4, 1fr); width: 100%; }
    .jl-name { font-size: 1.7rem; }
    .jl-doll { grid-template-columns: 1fr 1fr; }
    .jl-figure { grid-column: 1 / -1; grid-row: 1; }
    .jl-slot.weapon, .jl-slot.armour { grid-row: 2; }
    .jl-slot.weapon { grid-column: 1; } .jl-slot.armour { grid-column: 2; }
    .jl-slot.trinket { grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { .jl-points span { animation: none; } }
/* ---------- Profile and achievements ---------- */
.profile-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.profile-shield { flex: none; width: 120px; height: 140px; display: grid; place-items: center;
    background: linear-gradient(180deg, #8e2a1c, #5a1a10); clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); }
.profile-shield .art { width: 92px; height: 92px; margin-top: -14px; }
.profile-body { flex: 1 1 320px; min-width: 0; }
.profile-body h1 { margin: 0 0 4px; }
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.achievement { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; padding: 8px; border-radius: 6px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 80%, #fff); }
.achievement-shield { width: 52px; height: 58px; display: grid; place-items: center;
    background: linear-gradient(180deg, #ecd79a, #a8873a); clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); }
.achievement-shield .art { width: 34px; height: 34px; margin-top: -6px; }
.achievement-text { display: grid; gap: 1px; min-width: 0; }
.achievement-text .muted { font-size: .8rem; }
.achievement-date { font-size: .72rem; color: var(--muted); }
.achievement .progress { margin-top: 3px; }
.achievement.locked { opacity: .78; }
.achievement.locked .achievement-shield { background: linear-gradient(180deg, #b8b2a4, #8a8478); }
.achievement.locked .achievement-shield .art { filter: grayscale(1) opacity(.55); }
.deeds div { min-width: 120px; }
.player-link { color: inherit; text-decoration: none; }
.player-link:hover { text-decoration: underline; }

/* ---------- Wilds at the rally point ---------- */
.wilds td .art { width: 20px; height: 20px; vertical-align: -5px; }
.danger-pip { color: #8e2a1c; letter-spacing: -1px; font-size: .75rem; margin-left: 4px; }

/* ---------- Battle report picture ---------- */
.battle-scene { position: relative; margin: 6px 0 14px; border-radius: 8px; overflow: hidden; border: 1px solid #5a4128; min-height: 230px;
    background: linear-gradient(180deg, #b9cbd3 0%, #dfe2d4 42%, #9aac68 42%, #7e9452 100%); box-shadow: inset 0 0 40px rgba(20, 14, 8, .35); }
.battle-scene.wild { background: linear-gradient(180deg, #a9c0c8 0%, #d6dccc 42%, #7f9a5a 42%, #5f7a40 100%); }
.bs-banner { position: relative; z-index: 3; width: max-content; max-width: 90%; margin: 10px auto 0; padding: 4px 22px; text-align: center;
    font: 700 1rem "Palatino Linotype", Georgia, serif; letter-spacing: .04em; color: #f6ecd2; background: #8e2a1c;
    clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%); }
.def-won .bs-banner { background: #3a5a7a; }
.bs-backdrop { position: absolute; right: 2%; top: 14%; width: 46%; max-width: 300px; opacity: .9; z-index: 0; }
.bs-backdrop .art { width: 100%; height: auto; aspect-ratio: 1; }
.bs-wall { position: absolute; right: 30%; top: 30%; width: 22%; max-width: 150px; z-index: 1; }
.bs-wall .art { width: 100%; height: auto; aspect-ratio: 1; }
.bs-field { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 60px 1fr; align-items: end; gap: 8px; padding: 14px 14px 12px; min-height: 170px; }
.bs-side { display: grid; gap: 6px; }
.bs-def { justify-items: end; }
.bs-label { font: 700 .9rem "Palatino Linotype", Georgia, serif; color: #1f160f; background: rgba(246, 236, 210, .85); padding: 2px 8px; border-radius: 3px; width: max-content; max-width: 100%;
    display: grid; }
.bs-label small { font: 600 .72rem system-ui, sans-serif; color: var(--muted); }
.bs-army { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: end; }
.bs-def .bs-army { justify-content: flex-end; }
.bs-troop { display: grid; justify-items: center; }
.bs-figures { display: flex; }
.bs-fig { width: 34px; height: 34px; margin-left: -14px; }
.bs-fig:first-child { margin-left: 0; }
.bs-fig .art { width: 34px; height: 34px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .3)); }
.bs-def .bs-fig .art { transform: scaleX(-1); }
.bs-fig.fallen .art { filter: grayscale(1) brightness(.75); opacity: .6; transform: rotate(80deg) translate(10px, 2px) scale(.85); }
.bs-def .bs-fig.fallen .art { transform: scaleX(-1) rotate(80deg) translate(10px, 2px) scale(.85); }
.bs-count { font-size: .75rem; font-weight: 700; background: rgba(246, 236, 210, .9); border-radius: 8px; padding: 0 6px; }
.bs-count b { color: var(--bad); }
.bs-clash { display: grid; place-items: center; align-self: center; }
.bs-clash .art { width: 52px; height: 52px; filter: drop-shadow(0 0 6px rgba(255, 230, 160, .8)); }
.bs-empty { margin: 0; font-style: italic; color: #3a2a18; background: rgba(246, 236, 210, .7); padding: 2px 6px; border-radius: 3px; }
.bs-loot { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 14px 10px; font-weight: 700; color: #1f160f; }
.bs-loot > .art { width: 26px; height: 26px; }
.jarl-line { margin: 0 0 8px; line-height: 1.6; }
.jarl-line .art { width: 26px; height: 26px; vertical-align: -8px; margin-right: 2px; }
.find { font-weight: 700; }
.find.rare { color: #3a6a9a; }
.find.legendary { color: #8a6a1a; text-shadow: 0 0 6px rgba(236, 215, 154, .9); }
@media (max-width: 640px) {
    .bs-field { grid-template-columns: 1fr; }
    .bs-clash { display: none; }
    .bs-def, .bs-def .bs-army { justify-items: start; justify-content: flex-start; }
    .bs-backdrop { opacity: .45; }
    .jarl-skills li { grid-template-columns: 1fr auto auto; }
    .jarl-pips { display: none; }
}

/* Achievement tiers and groups */
.achievement-tally { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 6px; }
.tally { display: inline-flex; align-items: center; gap: 6px; }
.tally-shield { width: 16px; height: 18px; clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); }
.tally.bronze .tally-shield, .achievement.bronze.earned .achievement-shield { background: linear-gradient(180deg, #e0b88a, #9a6438); }
.tally.silver .tally-shield, .achievement.silver.earned .achievement-shield { background: linear-gradient(180deg, #eef0f2, #8e969e); }
.tally.gold .tally-shield, .achievement.gold.earned .achievement-shield { background: linear-gradient(180deg, #f4e2a4, #b8902e); }
.achievement.gold.earned { border-color: #c9a24a; box-shadow: 0 0 0 1px rgba(201, 162, 74, .35), 0 2px 8px rgba(201, 162, 74, .25); }
.achievement-group { margin: 16px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.achievement-group .muted { font: 600 .8rem system-ui, sans-serif; }

/* ---------- The countryside round the fields and the village ---------- */
.vc-land { fill: url(#vc-island-g); }
.vc-ridges { pointer-events: none; filter: blur(.6px); }
.vc-meadows { filter: blur(14px); pointer-events: none; }
.vc-meadow.lush { fill: #8fb05a; opacity: .45; }
.vc-meadow.dry { fill: #b8b878; opacity: .35; }
.vc-meadow.dark { fill: #4f6a30; opacity: .35; }.vc-track { fill: none; stroke: #9a8260; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .9; pointer-events: none; }
.vc-track.edge { stroke: #6a5a3e; stroke-width: 12; opacity: .45; filter: blur(1.5px); }
.vc-track.ruts { stroke: #6e5a3e; stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .6; }
.vc-patch { stroke-width: 14; stroke-linejoin: round; filter: blur(3px); opacity: .55; pointer-events: none; }
.vc-patch.wood { fill: #3f5a2a; stroke: #3f5a2a; }
.vc-patch.clay { fill: #9a6e48; stroke: #9a6e48; }
.vc-patch.iron { fill: #7a776e; stroke: #7a776e; }
.vc-patch.crop { fill: #b49a50; stroke: #b49a50; }
html[data-tod="night"] .vc-foam-line { opacity: .25; }
@media (prefers-reduced-motion: reduce) { .vc-foam-line { animation: none; } }

/* Level badges: a dark disc with a thin gold rim, quieter than a coin */
.badge-link .lvl { fill: rgba(34, 24, 14, .88); stroke: #c9a24a; stroke-width: 1.6; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .45)); }
.badge-link .lvl-text { font: 700 12px system-ui, "Segoe UI", sans-serif; fill: #f4e6c2; }
.badge-link.up .lvl { stroke: #8fc06a; }
.badge-link.working .lvl { stroke: #e0b04a; }



/* ---------- A seamless scene: edge to edge, haze, soft ground, overlays ---------- */
.scene-card { padding: 0; overflow: hidden; }
.scene-wrap { position: relative; }
.scene-wrap::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(30, 20, 10, .35), inset 0 0 50px rgba(30, 40, 20, .35); }
.scene-card .scene { border-radius: 0; }
.vc-haze { pointer-events: none; }
.vc-ridges { filter: blur(1.5px); }
.vc-town { fill: #8fa868; stroke: none; filter: blur(3px); opacity: .9; }
.scene-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; }
.scene-queue { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sq-chip { pointer-events: auto; display: grid; grid-template-columns: 30px auto; gap: 7px; align-items: center; min-width: 170px; max-width: 250px;
    padding: 5px 10px 5px 6px; border-radius: 10px; text-decoration: none; color: #f4eadb; font-size: .8rem;
    background: rgba(28, 20, 12, .72); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(236, 210, 150, .18); }
a.sq-chip:hover { background: rgba(28, 20, 12, .85); }
.sq-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: rgba(255, 240, 210, .1); }
.sq-icon .art { width: 28px; height: 28px; }
.sq-text { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: baseline; min-width: 0; }
.sq-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sq-to { color: #ecd79a; font-weight: 700; }
.sq-time { grid-column: 1 / -1; color: #d8ccb2; font-variant-numeric: tabular-nums; font-size: .74rem; }
.sq-chip .progress { grid-column: 1 / -1; height: 4px; margin-top: 3px; background: rgba(255, 255, 255, .15); box-shadow: none; }
.sq-chip.idle { color: #f4eadb; background: rgba(46, 70, 30, .65); }
.sq-chip.idle .sq-icon .art { opacity: .8; }
.sq-chip.locked { min-width: 0; opacity: .8; }
.sq-chip.locked .sq-icon .art { width: 18px; height: 18px; opacity: .7; }
.scene-overlay .scene-hint { align-self: center; margin: 0; padding: 4px 14px; border-radius: 12px; font-size: .76rem; color: #f4eadb;
    background: rgba(28, 20, 12, .55); backdrop-filter: blur(3px); }
.scene-overlay .scene-hint .art { width: 14px; height: 14px; vertical-align: -2px; }
/* The scene shows the queue; the Construction card is only needed where the scene gives way to tiles */
@media (min-width: 641px) { .construction-card { display: none; } }
@media (max-width: 640px) { .scene-card { padding: 8px; } }
.worldmap .mt-labels { pointer-events: none; }

/* ---------- World map markers, Travian style: who holds a field, at a glance ---------- */
:root { --rel-own: #e8b830; --rel-alliance: #3d7bd6; --rel-ally: #3ea055; --rel-nap: #3aa6a0; --rel-war: #d23c2c; --rel-neutral: #e6dfcc; }
.rel-own { --rel: var(--rel-own); } .rel-alliance { --rel: var(--rel-alliance); } .rel-ally { --rel: var(--rel-ally); }
.rel-nap { --rel: var(--rel-nap); } .rel-war { --rel: var(--rel-war); } .rel-neutral { --rel: var(--rel-neutral); }
.worldmap .mt-ring { fill: var(--rel); fill-opacity: .18; stroke: var(--rel); stroke-width: 2; stroke-opacity: .85; filter: drop-shadow(0 0 3px rgba(0, 0, 0, .35)); }
.worldmap .mt-flag .pole { stroke: #3a2616; stroke-width: 1.6; stroke-linecap: round; }
.worldmap .mt-flag .cloth { fill: var(--rel); stroke: rgba(20, 12, 4, .6); stroke-width: .8; stroke-linejoin: round; }
.worldmap .mt-flag .knob { fill: #d8b860; }
.worldmap .map-village:hover .mt-ring, .worldmap .map-village:focus-visible { filter: brightness(1.1); }
.worldmap .map-name.rel-own { fill: #ffe9a8; }
.worldmap .map-name.rel-war { fill: #ffc4b8; }
.worldmap .map-name.rel-alliance { fill: #d4e4ff; }
.worldmap .mt-badge circle { stroke: #1a1006; stroke-width: 1.2; }
.worldmap .mt-badge.war circle { fill: #8e2a1c; }
.worldmap .mt-badge.shield circle { fill: #3a5a7a; }
.worldmap .mt-oasis-badge rect { fill: rgba(28, 20, 12, .82); stroke: #c9a24a; stroke-width: 1; }
.worldmap .mt-oasis-badge text { font: 700 9.5px system-ui, "Segoe UI", sans-serif; fill: #f4e6c2; }
.worldmap .mt-oasis-badge text.count { fill: #ffb8a8; }
.paw { fill: #e8d8b8; }
.worldmap .mt-oasis-badge .paw { fill: #ffb8a8; }
.legend .swatch[class*="rel-"] { background: var(--rel); border: 1px solid rgba(20, 12, 4, .4); }
.legend-paw { vertical-align: -2px; }
.legend-paw .paw { fill: #8e2a1c; }

/* The hover card */
.map-tip { position: fixed; z-index: 50; pointer-events: none; display: grid; gap: 2px; min-width: 170px; max-width: 260px; padding: 8px 11px 9px;
    border-radius: 8px; font-size: .8rem; color: #efe4cc; background: rgba(24, 17, 10, .94); border-top: 3px solid var(--rel, #c9a24a);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.map-tip[hidden] { display: none; }
.map-tip strong { font: 700 .95rem "Palatino Linotype", Georgia, serif; color: #fff4d8; margin-bottom: 2px; }
.map-tip span:last-child { color: #b8a888; font-variant-numeric: tabular-nums; }
.worldmap .mt-beast { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45)); }

/* ---------- Map terrain: one blended ground, see-through fields, melted lakes ---------- */
.worldmap .mt-paint { pointer-events: none; }
.worldmap .mt-top { fill: transparent; stroke: none; }
.worldmap .tile-link:hover .mt-top { fill: rgba(255, 244, 210, .16); stroke: #e0c27a; stroke-width: 1.6; filter: none; }
.worldmap .mt-lakes { pointer-events: none; }
.worldmap .lake-deep { fill: #3e6478; }

/* ---------- The map as one window: toolbar and arrows over the map, the field below it ---------- */
.map-window { padding: 0; overflow: hidden; }
.map-stage { position: relative; }
.map-stage .worldmap { border-radius: 0; }
.map-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(30, 20, 10, .35), inset 0 0 40px rgba(20, 14, 8, .3); }
.map-hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 2; }
.map-hud > * { pointer-events: auto; }
.map-search, .map-moving, .map-legend summary { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 10px; color: #f4eadb; font-size: .8rem;
    background: rgba(28, 20, 12, .78); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(236, 210, 150, .18); }
.map-search label { display: flex; align-items: center; gap: 3px; }
.map-search label span { color: #c9b98a; font-weight: 700; }
.map-search input { width: 56px; padding: 2px 4px; border-radius: 5px; border: 1px solid rgba(236, 210, 150, .3); background: rgba(255, 248, 230, .92); font-size: .8rem; }
.map-search button { padding: 3px 10px; font-size: .75rem; min-height: 0; }
.map-home { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: rgba(255, 240, 210, .1); }
.map-home:hover { background: rgba(255, 240, 210, .25); }
.map-home .art { width: 22px; height: 22px; }
.map-moving { padding: 4px 10px; }
.map-moving .art { width: 18px; height: 18px; }
.map-legend { margin-left: auto; position: relative; }
.map-legend summary { cursor: pointer; list-style: none; padding: 5px 12px; font-weight: 700; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend summary::after { content: "\25BE"; margin-left: 4px; opacity: .7; }
.map-legend[open] summary::after { content: "\25B4"; }
.map-legend .legend { position: absolute; right: 0; top: calc(100% + 6px); width: 250px; display: grid; gap: 5px; margin: 0; padding: 10px 12px; border-radius: 10px;
    color: #efe4cc; font-size: .78rem; background: rgba(24, 17, 10, .94); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.map-legend .legend small { color: #b8a888; margin-top: 4px; }
.map-legend .legend .art { width: 16px; height: 16px; vertical-align: -3px; }
.map-nav { position: absolute; z-index: 2; display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px; padding: 5px 10px; border-radius: 18px;
    color: #f4eadb; text-decoration: none; font-weight: 700; background: rgba(28, 20, 12, .7); backdrop-filter: blur(3px); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.map-nav:hover { background: rgba(140, 100, 40, .9); color: #fff; }
.map-nav .arrow { font-size: 1.1rem; line-height: 1; }
.map-nav .dir { font-size: .72rem; letter-spacing: .08em; }
.map-nav.nw { left: 10px; top: 52px; } .map-nav.ne { right: 10px; top: 52px; }
.map-nav.sw { left: 10px; bottom: 10px; } .map-nav.se { right: 10px; bottom: 10px; }
.map-nav.ne .arrow, .map-nav.se .arrow { order: 2; }

/* The field below the map */
.map-info { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px 14px; border-top: 3px solid #a8873a;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 80%, #fff), var(--surface)); }
.mi-thumb { width: 96px; height: 80px; display: grid; place-items: center; border-radius: 10px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 70%, #9fb06a, #7d9452); box-shadow: inset 0 0 0 2px rgba(40, 25, 10, .2); }
.mi-thumb[class*="rel-"] { box-shadow: inset 0 0 0 3px var(--rel); }
.mi-thumb svg { width: 110px; height: 96px; }
.mi-main { min-width: 0; display: grid; gap: 3px; }
.mi-kicker { margin: 0; font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mi-rel { display: inline-block; padding: 1px 7px; margin-right: 4px; border-radius: 8px; color: #1f160f; background: var(--rel); }
.mi-rel.rel-war, .mi-rel.rel-alliance { color: #fff; }
.mi-title { margin: 0; font-size: 1.25rem; }
.mi-title::after { display: none; }
.mi-sub { margin: 0; color: var(--muted); font-size: .88rem; }
.mi-sub a { font-weight: 700; }
.mi-facts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.mi-label { font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mi-beast { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 2px; border-radius: 10px; font-size: .8rem; font-weight: 700;
    background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.mi-beast .art { width: 22px; height: 22px; }
.mi-note { margin: 4px 0 0; font-size: .78rem; color: var(--muted); }
.mi-alert { margin: 2px 0 0; font-size: .82rem; font-weight: 700; color: #8a5a10; }
.mi-alert .art { width: 18px; height: 18px; vertical-align: -4px; }
.mi-travel { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mi-travel span { display: inline-flex; align-items: center; gap: 2px; padding: 0 6px 0 1px; border-radius: 8px; font: 600 .72rem system-ui, sans-serif;
    font-variant-numeric: tabular-nums; background: rgba(40, 25, 10, .07); }
.mi-travel .art { width: 20px; height: 20px; }
.mi-actions { display: grid; gap: 6px; justify-items: stretch; }
.mi-actions .button, .mi-actions button { text-align: center; white-space: nowrap; }
@media (max-width: 760px) {
    .map-info { grid-template-columns: 72px 1fr; }
    .mi-thumb { width: 72px; height: 64px; }
    .mi-actions { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
    .map-nav .dir { display: none; }
    .map-search input { width: 46px; }
}
.map-info .mi-title { display: block; } .map-info .mi-title::after { display: none; }

/* ---------- Reports ---------- */
.rp-bar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.rp-step { display: flex; gap: 6px; }
.report-view { border-top: 4px solid #a8873a; }
.report-view.rp-win { border-top-color: #4f6e2c; }
.report-view.rp-partial { border-top-color: #c9a24a; }
.report-view.rp-loss { border-top-color: #8e2a1c; }
.rp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.outcome.big { width: 56px; height: 56px; flex: none; }
.outcome.big .art { width: 36px; height: 36px; }
.rp-verdict { margin: 0; font: 700 .8rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; }
.rp-verdict.win { color: #3f6a24; } .rp-verdict.partial { color: #8a6a1a; } .rp-verdict.loss { color: #8e2a1c; }
.rp-verdict span { color: var(--muted); font-weight: 600; letter-spacing: .04em; margin-left: 6px; }
.rp-title { margin: 2px 0; display: block; }
.report-view .rp-title::after { display: none; }
.rp-when { margin: 0; font-size: .82rem; }
.rp-small { font-size: .8rem; margin: 6px 0; }
.rp-strength { display: flex; height: 30px; margin: 4px 0 6px; border-radius: 15px; overflow: hidden; font: 700 .82rem system-ui, sans-serif; color: #fff;
    background: linear-gradient(90deg, #3a5a7a, #2a4560); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35); }
.rp-strength span { display: flex; align-items: center; gap: 5px; padding: 0 12px; white-space: nowrap; }
.rp-strength .att { justify-content: flex-start; background: linear-gradient(90deg, #8e2a1c, #b8402a); min-width: 90px; }
.rp-strength .def { flex: 1; justify-content: flex-end; }
.rp-strength .art { width: 18px; height: 18px; }
.rp-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.rp-side { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, #fff); min-width: 0; }
.rp-side.attacker { border-top: 4px solid #8e2a1c; } .rp-side.defender { border-top: 4px solid #3a5a7a; }
.rp-side.winner { box-shadow: 0 0 0 2px rgba(201, 162, 74, .45); }
.rp-side h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.rp-crown { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; padding: 1px 7px; border-radius: 8px; background: linear-gradient(180deg, #f4e2a4, #b8902e); color: #3a2a08; }
.rp-place { margin: 0 0 8px; font-size: .88rem; }
.rp-army { border-collapse: collapse; width: auto; min-width: 100%; font-variant-numeric: tabular-nums; }
.rp-army th, .rp-army td { padding: 3px 6px; text-align: center; border-bottom: 1px solid var(--border); font-size: .85rem; }
.rp-army thead th { background: none; padding-bottom: 2px; }
.rp-army thead .art { width: 30px; height: 30px; }
.rp-army tbody th { text-align: left; font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: none; white-space: nowrap; }
.rp-army td.neg { color: var(--bad); font-weight: 700; }
.rp-army td.zero { color: var(--muted); }
.rp-none { color: var(--muted); font-style: italic; margin: 4px 0; }
.rp-section { margin: 14px 0 6px; font-size: .95rem; }
.rp-outcome { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rp-outcome li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: rgba(40, 25, 10, .05); }
.rp-outcome li > .art { width: 24px; height: 24px; flex: none; }
.rp-outcome li.rp-jarls { display: block; }
.rp-outcome .jarl-line { margin: 0; }
.rp-trade { display: flex; gap: 12px; align-items: center; }
.rp-trade > .art { width: 48px; height: 48px; flex: none; }
.rp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.rp-actions .rp-delete { margin-left: auto; }

/* The list */
.rp-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.rp-count { font: 700 .7rem system-ui, sans-serif; padding: 0 6px; border-radius: 8px; background: rgba(40, 25, 10, .12); }
.rp-unread { font: 700 .66rem system-ui, sans-serif; padding: 0 6px; border-radius: 8px; color: #fff; background: #8e2a1c; }
.rp-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0 4px; }
.rp-tools button { padding: 3px 10px; font-size: .75rem; }
.rp-all { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); margin-right: 6px; }
.rp-day { margin: 14px 0 4px; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.rp-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px;
    border: 1px solid transparent; border-left: 4px solid transparent; }
.rp-row:hover { background: rgba(40, 25, 10, .05); border-color: var(--border); }
.rp-row.win { border-left-color: #6e8a46; } .rp-row.partial { border-left-color: #c9a24a; } .rp-row.loss { border-left-color: #a8442c; }
.rp-row.unread { background: color-mix(in srgb, #f4e2a4 30%, transparent); }
.rp-row.unread .rp-row-title { font-weight: 700; }
.rp-row .outcome { width: 34px; height: 34px; }
.rp-row-main { display: grid; gap: 2px; min-width: 0; text-decoration: none; color: inherit; }
.rp-row-title { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-row-main:hover .rp-row-title { text-decoration: underline; }
.rp-row-sum { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rp-row-sum .cost { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.rp-row-sum .chip { font-size: .7rem; padding: 0 5px; }
.rp-row-sum .chip .art { width: 12px; height: 12px; }
.rp-row-time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-legend { margin-top: 12px; }
@media (max-width: 640px) {
    .rp-row { grid-template-columns: auto 1fr auto; }
    .rp-row .outcome { display: none; }
    .rp-row-title { white-space: normal; }
}

/* ---------- Marketplace: the square, the storehouse and the tabs ---------- */
.mk-square { display: grid; grid-template-columns: 190px minmax(0, 1.2fr) minmax(0, 1fr); gap: 6px 22px; align-items: center;
    background: linear-gradient(180deg, color-mix(in srgb, #e8dcb8 55%, var(--surface)), var(--surface) 60%); }
.mk-square h2 { margin: 0 0 8px; }
.mk-square h2::after { display: none; }
.mk-square-art { position: relative; height: 150px; display: grid; place-items: center; border-radius: 12px; overflow: hidden;
    background: radial-gradient(ellipse 70% 38% at 50% 74%, rgba(80, 60, 30, .28), transparent 70%),
                linear-gradient(180deg, #cdd6c2 0%, #b7c39b 48%, #9fae7c 49%, #8d9c6a 100%);
    box-shadow: inset 0 0 0 1px rgba(60, 40, 15, .25), inset 0 -18px 30px rgba(40, 30, 10, .18); }
.mk-square-art .art { width: 210px; height: 210px; margin-top: -26px; }
.mk-square-level { position: absolute; left: 8px; bottom: 8px; font: 700 .68rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em;
    padding: 2px 8px; border-radius: 8px; background: rgba(40, 25, 10, .72); color: #f0e2bc; }
.mk-crew { min-width: 0; }
.mk-crew-line { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.mk-crew-line strong { color: var(--ink); }
.mk-crew-road { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 10px 3px 4px; border-radius: 14px;
    font-size: .82rem; text-decoration: none; color: var(--ink); background: rgba(40, 25, 10, .07); border: 1px solid var(--border); }
.mk-crew-road .art { width: 22px; height: 22px; }
.mk-crew-road:hover { background: rgba(40, 25, 10, .12); }
.mk-store { display: grid; gap: 7px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 252, 240, .45); min-width: 0; }
.mk-store h2 { margin-bottom: 2px; font-size: .95rem; }
.mk-gauge { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.mk-gauge .art { width: 20px; height: 20px; }
.mk-gauge-bar { height: 9px; border-radius: 5px; background: rgba(40, 25, 10, .12); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.mk-gauge-bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(180deg, #a3b06c, #6e8a46); }
.mk-gauge.full .mk-gauge-bar span { background: linear-gradient(180deg, #d0814a, #a8442c); }
.mk-gauge.low .mk-gauge-bar span { background: linear-gradient(180deg, #d8c08a, #b89a52); }
.mk-gauge-num { font-size: .8rem; font-weight: 700; min-width: 92px; text-align: right; }
.mk-gauge-num small { font-weight: 400; color: var(--muted); }
.mk-gauge.full .mk-gauge-num { color: var(--bad); }
.mk-advice { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 8px 12px;
    border-radius: 10px; border: 1px dashed #b89a52; background: color-mix(in srgb, #f4e2a4 32%, transparent); }
.mk-advice > .art { width: 30px; height: 30px; flex: none; }
.mk-advice p { flex: 1 1 280px; margin: 0; font-size: .88rem; }
.mk-advice-acts, .mk-ratios { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mk-square .button.small, .mk-dest .button.small { padding: 4px 12px; font-size: .78rem; min-height: 0; }
.mk-dest .button.small { display: inline-flex; align-items: center; gap: 5px; }
.mk-dest .button.small .art { width: 16px; height: 16px; }
.mk-tabs { margin-top: 16px; }
.mk-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.mk-tabs a .art { width: 20px; height: 20px; }
.mk-tabs a.active .rp-count { background: rgba(255, 240, 210, .2); }

/* Send */
.mk-route { padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.mk-target:empty { margin: 0; }
.mk-quick .mk-label { display: inline; margin-left: 4px; }
.mk-quick .chip { display: inline-flex; align-items: center; gap: 4px; }
.mk-quick .chip .art { width: 16px; height: 16px; }
.mk-quick .chip.ally { border-color: #6e8a46; }
.mk-quick .chip.on { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); font-weight: 700; }
.mk-panel .mk-goods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mk-good-foot > span:last-child { display: inline-flex; gap: 3px; }
.mk-caravan { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: rgba(40, 25, 10, .05); }
.mk-caravan .mk-summary { flex: 1 1 220px; margin: 0; }
.mk-load .mk-pip { width: 28px; height: 28px; }
.mk-load .mk-pip .art { width: 21px; height: 21px; }
.mk-load .mk-pip.loaded { background: linear-gradient(180deg, #f4e2a4, #c9a24a); border-color: #8a6a1a; box-shadow: 0 0 0 2px rgba(201, 162, 74, .35); }
.mk-load .mk-pip.over { background: #e8c4b8; border-color: var(--bad); }

/* Sell */
.mk-sell { margin-top: 0; align-items: start; }
.mk-swap { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.mk-rate { margin: 10px 0 4px; font-size: .82rem; min-height: 1.2em; }
.mk-rate strong { color: var(--ink); }

@media (max-width: 860px) {
    .mk-square { grid-template-columns: 150px minmax(0, 1fr); }
    .mk-square-art { height: 130px; }
    .mk-square-art .art { width: 170px; height: 170px; }
    .mk-store { grid-column: 1 / -1; }
    .mk-panel .mk-goods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .mk-square { grid-template-columns: 1fr; }
    .mk-square-art { height: 120px; }
    .mk-tabs { flex-wrap: nowrap; overflow-x: auto; }
    .mk-tabs a { white-space: nowrap; }
}
.mk-send button[hidden], .mk-offer [hidden] { display: none; }
.mk-ratios button { padding: 2px 9px; font: 700 .74rem system-ui, sans-serif; letter-spacing: 0; text-transform: none; min-height: 0; line-height: 1.5;
    background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); box-shadow: none; text-shadow: none; }
.mk-ratios button:hover { background: color-mix(in srgb, var(--good) 18%, var(--surface)); }
.mk-sell { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
@media (max-width: 860px) { .mk-sell { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .mk-long, .mk-advice > .art { display: none; } .mk-tabs a { padding-left: 10px; padding-right: 10px; } }

/* ---------- Jarl adventures ---------- */
.rel-adventure { --rel: #9a6ad0; }
.worldmap .mt-adv-ring { fill: #b890e8; fill-opacity: .16; stroke: #b890e8; stroke-width: 1.6; stroke-dasharray: 4 3; stroke-opacity: .9; }
.worldmap .mt-adv-badge rect { fill: rgba(28, 20, 12, .85); stroke: #b890e8; stroke-width: 1; }
.worldmap .mt-adv-badge path { fill: #e8d4ff; }
.worldmap .mt-adv-badge.d3 path { fill: #ffb8a8; }
.mi-thumb.adv { background: radial-gradient(ellipse at 50% 70%, #a8b878, #7d8c56); box-shadow: inset 0 0 0 3px #9a6ad0; }
.mi-rel.rel-adventure { color: #fff; }
.adv-danger { display: inline-block; padding: 0 8px; border-radius: 8px; font: 700 .7rem system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
.adv-danger.d1 { background: #d8e0b8; color: #3a4a1a; }
.adv-danger.d2 { background: #e8c890; color: #4a3008; }
.adv-danger.d3 { background: #8e2a1c; color: #fbe6dc; }
.jl-adventures { margin-top: 16px; }
.jl-adv-intro { margin: -4px 0 10px; font-size: .85rem; }
.jl-adv-list { display: grid; gap: 10px; }
.jl-adv { display: grid; grid-template-columns: 112px 1fr auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--border); border-left: 4px solid #9a6ad0; background: color-mix(in srgb, var(--surface) 85%, #fff); }
.jl-adv.d2 { border-left-color: #c9a24a; } .jl-adv.d3 { border-left-color: #8e2a1c; }
.jl-adv-art { display: block; height: 84px; border-radius: 8px; overflow: hidden; background: radial-gradient(ellipse at 50% 70%, #a8b878, #7d8c56); }
.jl-adv-art svg { width: 100%; height: 100%; }
.jl-adv-art:hover { filter: brightness(1.08); }
.jl-adv-body { min-width: 0; }
.jl-adv-body h3 { margin: 0 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jl-adv-body p { margin: 2px 0; font-size: .85rem; }
.jl-adv-facts { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.jl-adv-facts .art { width: 18px; height: 18px; vertical-align: -4px; }
.jl-adv-gain { color: #5a4a2a; }
.jl-adv-next { margin: 10px 0 0; font-size: .82rem; }
@media (max-width: 640px) {
    .jl-adv { grid-template-columns: 80px 1fr; }
    .jl-adv-art { height: 64px; }
    .jl-adv-go { grid-column: 1 / -1; }
    .jl-adv-go button { width: 100%; }
}
/* An adventure's report */
.adv-scene { display: flex; gap: 16px; align-items: center; padding: 12px; margin-bottom: 12px; border-radius: 12px;
    background: linear-gradient(180deg, #c8d2b4, #a8b884); box-shadow: inset 0 0 0 1px rgba(60, 40, 15, .25); }
.adv-scene.fell { background: linear-gradient(180deg, #c8bcb0, #a89a84); }
.adv-scene-art { position: relative; flex: none; width: 180px; height: 150px; }
.adv-scene-art svg { width: 100%; height: 100%; }
.adv-scene-jarl { position: absolute; left: 6px; bottom: 6px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
    background: rgba(255, 248, 230, .85); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.adv-scene-jarl .art { width: 38px; height: 38px; }
.adv-scene.fell .adv-scene-jarl { filter: grayscale(.8); transform: rotate(-70deg); }
.adv-scene-text p { margin: 4px 0; }
.adv-scene-kicker { font: 700 .75rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: #3a2a18; }
@media (max-width: 560px) { .adv-scene { flex-direction: column; text-align: center; } }

/* ---------- Attack warning strip under the top bar ---------- */
.raid-alert { position: sticky; top: 0; z-index: 30; background: linear-gradient(180deg, #8e2a1c, #6a1c12); color: #fbe6dc;
    box-shadow: inset 0 -1px 0 #c9a24a, 0 4px 12px rgba(60, 10, 4, .35); }
.raid-alert[hidden] { display: none; }
.raid-alert-inner { max-width: 1240px; margin: 0 auto; padding: 7px 16px; display: flex; gap: 10px; align-items: center; }
.ra-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .25);
    animation: ra-pulse 1.6s ease-in-out infinite; }
.ra-icon .art { width: 20px; height: 20px; }
.ra-text { flex: 1; min-width: 0; font-size: .9rem; }
.ra-text strong { font-family: var(--game-font); letter-spacing: .03em; margin-right: 6px; }
.ra-text .muted { color: #e8b8a8; }
.ra-text .countdown { font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.ra-go { flex: none; padding: 4px 14px; border-radius: 4px; text-decoration: none; font: 700 .8rem var(--game-font); letter-spacing: .05em; text-transform: uppercase;
    color: #2a1406; background: linear-gradient(180deg, #f4e2a4, #c9a24a); border: 1px solid #3a1a08; }
.ra-go:hover { filter: brightness(1.08); }
@keyframes ra-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 180, .55); } 50% { box-shadow: 0 0 0 7px rgba(255, 200, 180, 0); } }
@media (prefers-reduced-motion: reduce) { .ra-icon { animation: none; } }
@media (max-width: 560px) { .raid-alert-inner { flex-wrap: wrap; } .ra-text { font-size: .82rem; } }

/* ---------- Alliance war room ---------- */
.button.small { padding: 4px 12px; font-size: .78rem; min-height: 0; }
.wr-tab { display: inline-flex; align-items: center; gap: 6px; }
.wr-tab .art { width: 18px; height: 18px; }
.wr-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wr-stat { display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: rgba(255, 252, 240, .45); }
.wr-stat > .art { grid-row: span 2; width: 36px; height: 36px; opacity: .8; }
.wr-stat strong { font: 700 1.5rem var(--game-font); margin-right: 4px; }
.wr-stat small { color: var(--muted); }
.wr-stat.hot { border-color: #a8442c; background: linear-gradient(180deg, #f6dcd2, #ecc8bc); }
.wr-stat.hot strong { color: #8e2a1c; }
.wr-stat.war { border-color: #8e2a1c; }
.wr-threats, .wr-grid { margin-top: 16px; }
.wr-target { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid #c89a8a; border-left: 4px solid #8e2a1c;
    background: color-mix(in srgb, #f6dcd2 40%, var(--surface)); }
.wr-target.me { border-left-color: #e8b830; }
.wr-target-head { display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.wr-target-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.wr-target-name .art { width: 24px; height: 24px; }
.wr-target-acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.wr-waves { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wr-waves li { display: grid; grid-template-columns: 96px 1fr auto auto; gap: 4px 12px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(255, 252, 240, .6); }
.wr-waves li .progress { grid-column: 1 / -1; height: 5px; }
.wr-type { display: inline-flex; align-items: center; gap: 5px; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.wr-type .art { width: 20px; height: 20px; }
.wr-waves li.attack .wr-type { color: #8e2a1c; } .wr-waves li.raid .wr-type { color: #8a4a1a; } .wr-waves li.scout .wr-type { color: #3a5a7a; }
.wr-from { min-width: 0; font-size: .88rem; }
.wr-when { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.wr-when small { font-weight: 400; }
.wr-scout { font-size: .8rem; white-space: nowrap; }
.wr-tag { font-size: .8rem; font-weight: 700; padding: 0 5px; border-radius: 6px; background: rgba(40, 25, 10, .08); text-decoration: none; color: inherit; }
.wr-tag.war { background: #8e2a1c; color: #fbe6dc; }
.wr-out { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wr-out li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); }
.wr-out .wr-type .art { width: 22px; height: 22px; }
.wr-out-text { min-width: 0; font-size: .88rem; }
@media (max-width: 760px) {
    .wr-head { grid-template-columns: 1fr; }
    .wr-waves li { grid-template-columns: 1fr auto; }
    .wr-from { grid-column: 1 / -1; order: 3; }
    .wr-scout { order: 4; }
}

/* ---------- Installable app ---------- */
.banner-links .install-app { padding: 3px 10px; font: 700 .72rem var(--game-font); letter-spacing: .05em; text-transform: uppercase; min-height: 0;
    color: #2a1406; background: linear-gradient(180deg, #f4e2a4, #c9a24a); border: 1px solid #3a1a08; border-radius: 4px; box-shadow: none; }
.banner-links .install-app[hidden] { display: none; }
.offline-page .card { max-width: 460px; margin: 40px auto; text-align: center; }
.offline-page img { border-radius: 22px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
/* Installed and opened on a phone with a notch: keep clear of it */
@media (display-mode: standalone) { .banner { padding-top: env(safe-area-inset-top); } }

/* ---------- Messages ---------- */
.ms-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.ms-write-tab .art { width: 18px; height: 18px; }
.ms-avatar { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    font: 700 1.05rem var(--game-font); color: #fbf0d8; text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--paint) 70%, #fff), var(--paint) 60%, color-mix(in srgb, var(--paint) 70%, #000));
    box-shadow: inset 0 0 0 3px rgba(201, 162, 74, .85), inset 0 0 0 4px rgba(30, 18, 8, .5), 0 2px 4px rgba(0, 0, 0, .3); }
.ms-avatar.big { width: 52px; height: 52px; font-size: 1.35rem; }
.ms-online { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #5aa03a; border: 2px solid #f6ecd2; }

/* Conversations: a list on the left, the open one on the right */
.ms-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); padding: 0; overflow: hidden; min-height: 560px; }
.ms-list { border-right: 1px solid var(--border); background: rgba(255, 252, 240, .35); display: flex; flex-direction: column; min-width: 0; max-height: 720px; overflow-y: auto; }
.ms-search { padding: 10px; border-bottom: 1px solid var(--border); }
.ms-search input { width: 100%; box-sizing: border-box; }
.ms-search.wide { padding: 0 0 10px; border: 0; }
.ms-list .empty { padding: 14px; }
.ms-chat { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; text-decoration: none; color: inherit;
    border-bottom: 1px solid rgba(60, 40, 15, .1); border-left: 3px solid transparent; }
.ms-chat:hover { background: rgba(40, 25, 10, .05); }
.ms-chat.on { background: color-mix(in srgb, #f4e2a4 45%, transparent); border-left-color: #c9a24a; }
.ms-chat-main { display: grid; gap: 1px; min-width: 0; }
.ms-chat-top { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.ms-chat-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-tag { font-size: .75rem; color: var(--muted); }
.ms-chat-time { margin-left: auto; font-size: .72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ms-chat-subject { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chat-snippet { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-chat.unread .ms-chat-subject { font-weight: 700; color: var(--ink); }
.ms-badge { min-width: 20px; padding: 1px 6px; border-radius: 10px; text-align: center; font: 700 .7rem system-ui, sans-serif; color: #fff; background: #8e2a1c; }
.ms-list-foot { padding: 10px 12px; margin-top: auto; text-align: center; font-size: .8rem; }

.ms-thread { display: flex; flex-direction: column; min-width: 0; max-height: 720px; }
.ms-pick { margin: auto; padding: 30px; text-align: center; max-width: 360px; }
.ms-pick .art { width: 72px; height: 72px; opacity: .8; }
.ms-pick h2 { margin: 8px 0 4px; }
.ms-pick h2::after { display: none; }
.ms-thread-head { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 252, 240, .7), rgba(255, 252, 240, .2)); }
.ms-back { display: none; font-size: 1.3rem; text-decoration: none; color: inherit; padding: 0 4px; }
.ms-who { display: grid; min-width: 0; }
.ms-who-name { font: 700 1.1rem var(--game-font); color: var(--ink); text-decoration: none; }
.ms-who-name:hover { text-decoration: underline; }
.ms-who .muted { font-size: .8rem; }
.ms-thread-del { margin-left: auto; font-size: .8rem; }
.ms-scroll { flex: 1; overflow-y: auto; padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 280px;
    background: radial-gradient(ellipse at 50% 0, rgba(255, 252, 240, .5), transparent 70%); }
.ms-older { text-align: center; font-size: .8rem; }
.ms-day { text-align: center; margin: 12px 0 4px; font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ms-day span { padding: 2px 10px; border-radius: 10px; background: rgba(40, 25, 10, .07); }
.ms-msg { max-width: 76%; display: grid; gap: 2px; }
.ms-msg.in { align-self: flex-start; }
.ms-msg.out { align-self: flex-end; justify-items: end; }
.ms-subject { margin: 6px 4px 0; font: 700 .78rem var(--game-font); letter-spacing: .03em; color: #6e5226; }
.ms-bubble { padding: 9px 13px; border-radius: 14px; line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(40, 25, 10, .15); }
.ms-msg.in .ms-bubble { background: #fffaf0; border: 1px solid #ddcfae; border-bottom-left-radius: 4px; }
.ms-msg.out .ms-bubble { background: linear-gradient(180deg, #e9dcb4, #dccb98); border: 1px solid #c9b47c; border-bottom-right-radius: 4px; }
.ms-msg.focus .ms-bubble { box-shadow: 0 0 0 3px rgba(201, 162, 74, .6); }
.ms-bubble blockquote { margin: 4px 0 6px; padding: 4px 10px; border-left: 3px solid #c9a24a; background: rgba(40, 25, 10, .05); color: #5a4a32; font-size: .9em; border-radius: 0 6px 6px 0; }
.ms-coords { font-weight: 700; font-variant-numeric: tabular-nums; }
.ms-meta { margin: 0 6px; font-size: .7rem; color: var(--muted); }
.ms-reply { border-top: 1px solid var(--border); padding: 8px 12px 12px; background: rgba(255, 252, 240, .55); }
.ms-reply-subject { font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.ms-reply-subject summary { cursor: pointer; }
.ms-reply-subject summary span { color: var(--ink); }
.ms-reply-subject input { width: 100%; box-sizing: border-box; margin-top: 4px; }
.ms-reply-row { display: flex; gap: 8px; align-items: flex-end; }
.ms-reply-row textarea { flex: 1; resize: none; min-height: 44px; max-height: 220px; box-sizing: border-box; }

/* Writing a new message */
.ms-compose { display: grid; gap: 12px; max-width: 760px; }
.ms-to { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.ms-to .ms-field { flex: 1 1 260px; }
.ms-field { display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center; }
.ms-field > span:first-child { font: 700 .75rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ms-field.stacked { grid-template-columns: 1fr; }
.ms-field.off { opacity: .45; }
.ms-field textarea { width: 100%; box-sizing: border-box; resize: vertical; line-height: 1.5; }
.ms-circular { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 16px; border: 1px solid var(--border); background: rgba(255, 252, 240, .6); cursor: pointer; font-size: .88rem; }
.ms-circular .art { width: 20px; height: 20px; }
.ms-circular:has(input:checked) { border-color: #3d7bd6; background: color-mix(in srgb, #3d7bd6 14%, var(--surface)); }
.ms-send-row { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.ms-send-row button { display: inline-flex; align-items: center; gap: 6px; }
.ms-send-row button .art { width: 18px; height: 18px; }
.ms-hint { font-size: .78rem; margin-right: auto; }
.ms-count { font-size: .78rem; }
.ms-count.low { color: var(--bad); font-weight: 700; }

/* Inbox and Sent */
.ms-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; }
.ms-row:hover { background: rgba(40, 25, 10, .05); border-color: var(--border); }
.ms-row.unread { background: color-mix(in srgb, #f4e2a4 30%, transparent); }
.ms-row.unread .ms-row-subject { font-weight: 700; color: var(--ink); }
.ms-row .ms-avatar { width: 34px; height: 34px; font-size: .9rem; }
.ms-row-main { display: grid; gap: 1px; min-width: 0; text-decoration: none; color: inherit; }
.ms-row-top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.ms-row-top strong { white-space: nowrap; }
.ms-row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #5a4a32; }
.ms-row-main:hover .ms-row-subject { text-decoration: underline; }

@media (max-width: 760px) {
    .ms-shell { grid-template-columns: 1fr; min-height: 0; }
    .ms-shell.has-thread .ms-list { display: none; }
    .ms-shell:not(.has-thread) .ms-thread { display: none; }
    .ms-list { border-right: 0; max-height: none; }
    .ms-thread { max-height: none; }
    .ms-scroll { max-height: 60vh; padding: 10px; }
    .ms-back { display: block; }
    .ms-msg { max-width: 88%; }
    .ms-thread-del { display: none; }
    .ms-field { grid-template-columns: 1fr; gap: 4px; }
    .ms-hint { display: none; }
}

/* ---------- Admin ---------- */
button.small { padding: 4px 12px; font-size: .78rem; min-height: 0; }
.adm-flag { display: inline-block; padding: 2px 10px; border-radius: 10px; font: 700 .72rem system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.adm-flag.ok { background: #d8e8c4; color: #2e4a14; } .adm-flag.bad { background: #8e2a1c; color: #fbe6dc; }
.adm-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.adm-tabs a .art { width: 20px; height: 20px; }
.adm-intro { margin: 0 0 12px; font-size: .88rem; }
.adm-small { font-size: .78rem; margin: 6px 0 0; }

/* Health: one lamp per system */
.adm-health { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.adm-light { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: rgba(255, 252, 240, .55); }
.adm-light form, .adm-light .button { grid-column: 2; justify-self: start; }
.adm-lamp { width: 16px; height: 16px; border-radius: 50%; align-self: start; margin-top: 3px; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .3), 0 0 0 3px rgba(255, 255, 255, .5); }
.adm-light.ok .adm-lamp { background: #5aa03a; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .3), 0 0 8px #8fd06a; }
.adm-light.warn .adm-lamp { background: #e0a83a; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .3), 0 0 8px #f0c86a; }
.adm-light.bad .adm-lamp { background: #c23a26; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .3), 0 0 10px #f07a5a; animation: ra-pulse 1.6s ease-in-out infinite; }
.adm-light.bad { border-color: #c89a8a; background: color-mix(in srgb, #f6dcd2 55%, var(--surface)); }
.adm-light.warn { border-color: #d8bc80; }
.adm-light-text { display: grid; min-width: 0; }
.adm-light-name { display: inline-flex; align-items: center; gap: 5px; font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.adm-light-name .art { width: 16px; height: 16px; }
.adm-light-text strong { font: 700 1.05rem var(--game-font); }
.adm-light-text small { color: var(--muted); overflow-wrap: anywhere; }

/* Numbers */
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.adm-tile { position: relative; display: grid; padding: 12px 14px; border-radius: 10px; overflow: hidden;
    background: linear-gradient(180deg, #3a2c1e, #241a10); color: #f0e2bc; box-shadow: inset 0 0 0 1px #6e5226, 0 3px 8px rgba(0, 0, 0, .25); }
.adm-tile > .art { position: absolute; right: -6px; bottom: -8px; width: 64px; height: 64px; opacity: .22; }
.adm-tile-label { font: 700 .68rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: #c9a24a; }
.adm-tile strong { font: 700 1.9rem var(--game-font); line-height: 1.1; }
.adm-tile small { color: #b8a888; }

/* Charts */
.adm-charts { margin-bottom: 16px; }
.adm-chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.adm-chart { margin: 0; }
.adm-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; color: var(--muted); }
.adm-chart figcaption strong { font: 700 1.3rem var(--game-font); color: var(--ink); }
.adm-chart svg { display: block; width: 100%; height: 64px; margin-top: 4px; border-bottom: 1px solid var(--border); }
.adm-chart rect { fill: #a8822e; }
.adm-chart rect:hover { fill: #6e5226; }
.adm-chart.battles rect { fill: #a8442c; } .adm-chart.battles rect:hover { fill: #6a1c12; }
.adm-chart.letters rect { fill: #3a5a7a; } .adm-chart.letters rect:hover { fill: #22384e; }
.adm-chart-axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); margin-top: 2px; }

/* Lists of people and happenings */
.adm-grid { margin-bottom: 16px; }
.adm-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.adm-people li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-people .ms-avatar { width: 32px; height: 32px; font-size: .85rem; }
.adm-people-num { margin-left: auto; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-rank { width: 18px; text-align: center; font: 700 .85rem var(--game-font); color: var(--muted); }
.adm-online { color: #3f7a24; font-weight: 700; }
.adm-feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.adm-feed-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 6px; font-size: .88rem; }
.adm-feed-list li:nth-child(odd) { background: rgba(40, 25, 10, .04); }
.adm-feed-list .art { width: 20px; height: 20px; }
.adm-feed-list .muted { font-size: .78rem; white-space: nowrap; }

/* Players */
.adm-list-tools { display: grid; gap: 10px; margin-bottom: 12px; }
.adm-list-tools .ms-search { padding: 0; border: 0; max-width: 360px; }
.adm-list-tools nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.adm-rows { display: grid; gap: 4px; }
.adm-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 8px;
    text-decoration: none; color: inherit; border: 1px solid transparent; border-left: 4px solid transparent; }
.adm-row:hover { background: rgba(40, 25, 10, .05); border-color: var(--border); }
.adm-row.on { background: color-mix(in srgb, #f4e2a4 40%, transparent); border-left-color: #c9a24a; }
.adm-row.banned { border-left-color: #8e2a1c; opacity: .8; }
.adm-row-main { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; min-width: 0; }
.adm-row-main small { flex-basis: 100%; }
.adm-row-num { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.adm-player { margin-bottom: 16px; border-top: 4px solid #c9a24a; }
.adm-player.banned { border-top-color: #8e2a1c; }
.adm-player-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.adm-player-head .ms-avatar { width: 56px; height: 56px; font-size: 1.5rem; }
.adm-player-head h2 { margin: 0; }
.adm-player-head h2::after { display: none; }
.adm-player-head .ms-back { display: block; }
.adm-id { font: 400 .8rem system-ui, sans-serif; }
.adm-pills { margin: 4px 0 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.adm-reason { margin: 4px 0 0; font-size: .85rem; color: #8e2a1c; }
.adm-player-links { margin-left: auto; display: flex; gap: 6px; }
.adm-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 0 0 14px; }
.adm-facts div { padding: 6px 10px; border-radius: 8px; background: rgba(40, 25, 10, .05); }
.adm-facts dt { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.adm-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.adm-villages { font-size: .88rem; }
.adm-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.adm-action { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 252, 240, .5); }
.adm-action.danger { border-color: #c89a8a; }
.adm-action.wide { grid-column: 1 / -1; }
.adm-action h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; font-size: .95rem; }
.adm-action h3 .art { width: 20px; height: 20px; }
.adm-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.adm-form input[type=text] { flex: 1 1 160px; }
.adm-form input[type=number] { width: 90px; }
.adm-grant { display: inline-flex; align-items: center; gap: 4px; }
.adm-grant .art { width: 22px; height: 22px; }

/* World and security */
.adm-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.adm-presets button { min-width: 52px; }
.adm-queue { width: 100%; border-collapse: collapse; font-size: .88rem; }
.adm-queue th, .adm-queue td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.adm-queue .num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-queue td.neg { color: var(--bad); font-weight: 700; }
.adm-queue tr.adm-locked { background: color-mix(in srgb, #f6dcd2 50%, transparent); }
.adm-queue small { display: block; }
@media (max-width: 640px) {
    .adm-player-links { margin-left: 0; }
    .adm-row-main small { font-size: .72rem; }
}
.adm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } @media (max-width: 520px) { .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Privacy and account ---------- */
.privacy { max-width: 860px; line-height: 1.6; }
.privacy h1 { margin: 2px 0 8px; }
.privacy h2 { margin-top: 26px; scroll-margin-top: 20px; }
.privacy-kicker { margin: 0; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.privacy-lead { font-size: 1.05rem; padding: 10px 14px; border-left: 4px solid #c9a24a; background: rgba(244, 226, 164, .3); border-radius: 0 8px 8px 0; }
.privacy-toc { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.privacy-toc a { padding: 3px 10px; border-radius: 14px; border: 1px solid var(--border); font-size: .82rem; text-decoration: none; color: inherit; background: rgba(255, 252, 240, .6); }
.privacy-toc a:hover { border-color: #c9a24a; }
.privacy-table { font-size: .9rem; }
.privacy-table td { vertical-align: top; }
.privacy-table td:last-child { white-space: nowrap; }
.privacy ul { padding-left: 20px; }
.privacy li { margin: 4px 0; }
.privacy-back { max-width: 860px; margin: 12px auto; }
.auth-privacy { margin: 10px 0 0; line-height: 1.4; }
.farewell { max-width: 1100px; margin: 12px auto; }
.acc-grid { margin-bottom: 16px; }
.acc-note { font-size: .82rem; margin: 10px 0 0; }
.acc-delete { max-width: none; }
.acc-list { padding-left: 20px; line-height: 1.5; }
.acc-list li { margin: 3px 0; }
.acc-form { display: grid; gap: 10px; max-width: 520px; margin-top: 12px; }
.acc-check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.acc-check input { margin-top: 4px; }
@media (max-width: 640px) { .privacy-table td:last-child { white-space: normal; } }
.privacy-table { table-layout: fixed; width: 100%; } .privacy-table th:nth-child(1) { width: 46%; } .privacy-table th:nth-child(2) { width: 30%; } .privacy-table td:last-child { white-space: normal; }

/* ---------- Map terrain: relief, rivers, farmland, tracks ---------- */
.worldmap .mt-rivers path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.worldmap .mt-rivers .bank path { stroke: #6a6e3e; opacity: .75; }
.worldmap .mt-rivers .flow path { stroke: #5d879e; }
.worldmap .mt-rivers .glint path { stroke: #d6e6ec; opacity: .45; stroke-dasharray: 3 9; animation: mt-flow 3s linear infinite; }
.worldmap .mt-rivers .flow circle { fill: #7aa0b4; }
.worldmap .mt-rivers .bank .pond { fill: #6a6e3e; opacity: .75; }
.worldmap .mt-rivers .flow .pond { fill: #557d95; }
@keyframes mt-flow { to { stroke-dashoffset: -24; } }
.worldmap .mt-tracks path { fill: none; stroke-linecap: round; }
.worldmap .mt-tracks .edge path { stroke: #5e4a2e; stroke-width: 6.5; opacity: .45; }
.worldmap .mt-tracks .top path { stroke: #d6c294; stroke-width: 3.2; opacity: .85; }
.worldmap .mt-field { stroke: #6e5a3c; stroke-width: .7; stroke-opacity: .5; opacity: .82; }
.worldmap .mt-furrow { stroke: #3e3018; stroke-width: .7; opacity: .22; }
.worldmap .mt-flower { opacity: .85; }
.worldmap .mt-reeds path { fill: none; stroke: #4e6230; stroke-width: 1.1; stroke-linecap: round; }
.worldmap .mt-reeds rect { fill: #6e4a2a; }
@media (prefers-reduced-motion: reduce) { .worldmap .mt-rivers .glint path { animation: none; } }

/* ---------- Gold ---------- */
.chip.gold { background: linear-gradient(180deg, #fbefc4, #e8cf82); border-color: #b8902e; color: #4a3008; font-weight: 700; }
.res.res-gold { text-decoration: none; min-width: 96px; background: linear-gradient(180deg, rgba(120, 84, 20, .55), rgba(60, 40, 8, .45)); box-shadow: inset 0 0 0 1px rgba(232, 200, 110, .45); }
.res.res-gold .res-amount { color: #ffe08a; }
.res.res-gold:hover { box-shadow: inset 0 0 0 1px #f0d070, 0 0 8px rgba(240, 208, 112, .35); }
.res.res-gold.gained { animation: gd-gain 1.4s ease-out; }
@keyframes gd-gain { 0% { box-shadow: 0 0 0 0 rgba(255, 220, 120, .9); } 100% { box-shadow: 0 0 0 14px rgba(255, 220, 120, 0); } }
.gd-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 6px; min-height: 0; font: 700 .78rem system-ui, sans-serif; letter-spacing: 0; text-transform: none;
    color: #3a2406; background: linear-gradient(180deg, #fbefc4, #dcb456); border: 1px solid #8a6a1a; border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); text-shadow: none; }
.gd-btn .art { width: 18px; height: 18px; }
.gd-btn span { font-weight: 600; opacity: .8; }
.gd-btn:hover:not(:disabled) { filter: brightness(1.06); }
.gd-btn:disabled { opacity: .5; cursor: not-allowed; }
.gd-finish { margin-left: 6px; }
.scene-queue .gd-finish { pointer-events: auto; margin: -2px 0 2px 6px; }
.scene-queue .gd-btn { padding: 2px 8px 2px 4px; font-size: .72rem; }
.scene-queue .gd-btn span { display: none; }
.jl-item.sold { opacity: .6; }
.gd-give { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.gd-give .art { width: 22px; height: 22px; }
.gd-give input { width: 90px; }
.hall-gold { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.rp-outcome li.rp-gold { background: color-mix(in srgb, #f4e2a4 45%, transparent); }

/* The hoard page */
.gd-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; background: radial-gradient(ellipse at 15% 50%, rgba(244, 220, 140, .55), transparent 60%), var(--surface); }
.gd-hero-art .art { width: 150px; height: 150px; filter: drop-shadow(0 6px 10px rgba(80, 50, 0, .35)); }
.gd-hero-body { flex: 1 1 280px; }
.gd-kicker { margin: 0; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: #8a6a1a; }
.gd-amount { margin: 2px 0 8px; font: 700 2.6rem var(--game-font); color: #6e4a0a; }
.gd-amount span { font-size: 1.1rem; color: var(--muted); }
.gd-facts { display: flex; gap: 10px; margin: 0 0 8px; }
.gd-facts div { padding: 6px 12px; border-radius: 8px; background: rgba(40, 25, 10, .06); }
.gd-facts dt { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gd-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.gd-note { font-size: .85rem; margin: 0; }
.gd-ways { margin: 16px 0; }
.gd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gd-list li { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; }
.gd-list li > span:last-child { display: grid; gap: 1px; font-size: .88rem; }
.gd-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6d8, #e8d4a0); box-shadow: inset 0 0 0 1px rgba(138, 106, 26, .4); }
.gd-icon .art { width: 26px; height: 26px; }
.gd-icon.small { width: 28px; height: 28px; }
.gd-icon.small .art { width: 18px; height: 18px; }
.gd-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gd-rows li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 8px; font-size: .88rem; }
.gd-rows li:nth-child(odd) { background: rgba(40, 25, 10, .04); }
.gd-reason { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-when { font-size: .78rem; white-space: nowrap; }
.gd-delta { font: 700 .95rem var(--game-font); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.gd-rows li.in .gd-delta { color: #6e4a0a; } .gd-rows li.out .gd-delta { color: #8e2a1c; }

/* ---------- Empty plots: pegged out in the ground ---------- */
.plot.empty .vc-earth { fill: #7c6c46; opacity: .5; filter: url(#vc-rough); transition: fill .15s, opacity .15s; }
.plot.empty .vc-earth-in { fill: #9c8656; opacity: .45; filter: url(#vc-rough); }
.plot.empty .vc-earth-tex { fill: url(#vc-soil-tex); opacity: .9; filter: url(#vc-rough); }
.plot.empty .vc-pebble { fill: #a49c8a; stroke: #5e5648; stroke-width: .4; }
.plot.empty .vc-tuft { stroke: #5e7a34; stroke-width: .8; stroke-linecap: round; fill: none; }
.plot.empty .vc-peg-mound { fill: #6a5634; opacity: .7; }
.plot.empty .vc-peg { stroke: #5a3e22; stroke-width: 2.2; stroke-linecap: round; }
.plot.empty .vc-peg.thin { stroke-width: 1.5; }
.plot.empty .vc-peg-lit { stroke: #a6845a; stroke-width: .6; opacity: .8; }
.plot.empty .vc-line { fill: none; stroke: #cdb47c; stroke-width: 1; stroke-linecap: round; }
.plot.empty .vc-line-shadow { fill: none; stroke: rgba(30, 20, 8, .22); stroke-width: 1.1; filter: blur(.5px); pointer-events: none; }
.plot.empty .vc-tag { fill: #a83a24; stroke: #4a1a0e; stroke-width: .35; }
.plot.empty .plus { opacity: 0; transition: opacity .15s; }
.plot.empty:hover .plus, .plot.empty:focus-visible .plus { opacity: 1; }
.plot.empty:hover .vc-earth, .plot.empty:focus-visible .vc-earth { fill: #c9a24a; opacity: .6; }
.plot.empty:hover .vc-line, .plot.empty:focus-visible .vc-line { stroke: #f0d898; stroke-width: 1.4; }
.plot.empty:hover .vc-tag { fill: #d0502e; }
.plot.empty .vc-earth { fill: #84703f; opacity: .78; } .plot.empty .vc-earth-in { fill: #a58d5a; opacity: .62; } .plot.empty .vc-line { stroke: #a88c58; stroke-width: .8; } .plot.empty .vc-line-shadow { stroke: rgba(30, 20, 8, .28); }

/* ---------- Statistics ---------- */
.st-standing { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin-bottom: 14px; }
.st-stand { display: grid; justify-items: center; gap: 1px; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: inherit; text-align: center;
    border: 1px solid var(--border); background: rgba(255, 252, 240, .55); transition: transform .12s, box-shadow .12s; }
.st-stand:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(40, 25, 10, .15); }
.st-stand.on { border-color: #c9a24a; background: color-mix(in srgb, #f4e2a4 45%, var(--surface)); }
.st-stand .art { width: 26px; height: 26px; }
.st-stand-label { font: 700 .66rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.st-stand strong { font: 700 1.2rem var(--game-font); line-height: 1.1; }
.st-stand.medal strong { color: #8a6a1a; }
.st-stand small { font-size: .7rem; color: var(--muted); }
.st-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.st-tabs a { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px 4px 6px; border-radius: 16px; text-decoration: none; color: inherit; font-size: .85rem;
    border: 1px solid var(--border); background: rgba(255, 252, 240, .6); }
.st-tabs a .art { width: 20px; height: 20px; }
.st-tabs a.on { background: linear-gradient(180deg, var(--ribbon-1, #5a3a22), var(--ribbon-2, #3a2414)); color: #f0e2bc; border-color: #2a1a0c; font-weight: 700; }
.st-board-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.st-board-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.st-board-head h2 .art { width: 28px; height: 28px; }
.st-board-head h2::after { display: none; }
.st-board-head p { margin: 2px 0 0; font-size: .88rem; }
.st-search { padding: 0; border: 0; min-width: 220px; }

/* The podium: second, first, third */
.st-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; margin: 6px 0 16px; padding: 12px 10px 0;
    border-radius: 12px; background: radial-gradient(ellipse at 50% 100%, rgba(244, 226, 164, .55), transparent 70%); }
.st-step { display: grid; justify-items: center; gap: 3px; text-align: center; min-width: 0; }
.st-step .st-medal { width: 34px; height: 34px; }
.st-step .ms-avatar.big { width: 52px; height: 52px; font-size: 1.35rem; }
.st-step.p1 .ms-avatar.big { width: 62px; height: 62px; font-size: 1.6rem; box-shadow: inset 0 0 0 3px #e8c870, inset 0 0 0 4px rgba(30, 18, 8, .5), 0 0 14px rgba(232, 200, 112, .55); }
.st-step-name { font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-step-value { font: 700 1.05rem var(--game-font); font-variant-numeric: tabular-nums; }
.st-step-value small { font: 400 .72rem system-ui, sans-serif; color: var(--muted); }
.st-step-block { width: 100%; display: grid; place-items: center; font: 700 1.4rem var(--game-font); color: #f0e2bc; border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #7a5a34, #4a3218); box-shadow: inset 0 1px 0 rgba(255, 240, 200, .3); }
.st-step.p1 .st-step-block { height: 62px; background: linear-gradient(180deg, #c9a24a, #8a6a1a); }
.st-step.p2 .st-step-block { height: 44px; background: linear-gradient(180deg, #a8aeb4, #6e747a); }
.st-step.p3 .st-step-block { height: 32px; background: linear-gradient(180deg, #b07a46, #7a4e24); }
.st-step.me .st-step-name { font-weight: 700; }

/* The list */
.st-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.st-row { display: grid; grid-template-columns: 40px auto 1fr minmax(120px, 30%); gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; }
.st-row:nth-child(odd) { background: rgba(40, 25, 10, .035); }
.st-row:hover { border-color: var(--border); background: rgba(40, 25, 10, .06); }
.st-row.me { background: color-mix(in srgb, #f4e2a4 45%, transparent); border-color: #c9a24a; }
.st-row.found { box-shadow: 0 0 0 2px #3d7bd6; }
.st-rank { text-align: center; font: 700 .95rem var(--game-font); color: var(--muted); font-variant-numeric: tabular-nums; }
.st-rank .medal { width: 26px; height: 26px; }
.st-row .ms-avatar { width: 32px; height: 32px; font-size: .85rem; }
.st-who { display: grid; min-width: 0; }
.st-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-value { display: grid; gap: 3px; text-align: right; font-variant-numeric: tabular-nums; }
.st-bar { height: 5px; border-radius: 3px; background: rgba(40, 25, 10, .1); overflow: hidden; }
.st-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #a8822e, #e2c06a); margin-left: auto; }
.st-note { margin: 12px 0 0; }
@media (max-width: 600px) {
    .st-row { grid-template-columns: 30px auto 1fr auto; gap: 8px; }
    .st-bar { display: none; }
    .st-podium { gap: 6px; padding: 8px 4px 0; }
    .st-step .ms-avatar.big { width: 42px; height: 42px; }
    .st-step.p1 .ms-avatar.big { width: 50px; height: 50px; }
    .st-search { min-width: 0; width: 100%; }
}
.st-standing { grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); } .st-stand { padding: 7px 4px; }
.st-bar span { margin-left: 0; }

/* ---------- Profile ---------- */
.pf-banner { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 18px 24px; align-items: center; padding: 22px 24px; margin-bottom: 14px;
    border-radius: 14px; color: #f0e2bc; overflow: hidden;
    background: radial-gradient(ellipse at 15% 20%, rgba(232, 200, 112, .18), transparent 55%), repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 2px, transparent 2px 46px),
                linear-gradient(180deg, #4a3220, #2a1c10);
    box-shadow: inset 0 0 0 2px #1c120a, inset 0 0 0 3px rgba(201, 162, 74, .45), 0 6px 16px rgba(30, 18, 8, .35); }
.pf-banner::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px;
    background: repeating-linear-gradient(90deg, #8e2a1c 0 14px, #c9a24a 14px 18px, #3a5a7a 18px 32px, #c9a24a 32px 36px); opacity: .85; }
.pf-shield { position: relative; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--paint) 70%, #fff), var(--paint) 60%, color-mix(in srgb, var(--paint) 65%, #000));
    box-shadow: inset 0 0 0 5px #c9a24a, inset 0 0 0 7px rgba(30, 18, 8, .55), inset 0 -10px 16px rgba(0, 0, 0, .25), 0 6px 14px rgba(0, 0, 0, .45); }
.pf-shield span { font: 700 3rem var(--game-font); color: #fbf0d8; text-shadow: 0 2px 2px rgba(0, 0, 0, .55); }
.pf-online { position: absolute; right: 6px; bottom: 6px; width: 18px; height: 18px; border-radius: 50%; background: #5aa03a; border: 3px solid #2a1c10; }
.pf-id { min-width: 0; }
.pf-kicker { margin: 0; font: 700 .74rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .14em; color: #e2c06a; }
.pf-name { margin: 2px 0 8px; font: 700 2.2rem var(--game-font); color: #fbf0d8; text-shadow: 0 2px 3px rgba(0, 0, 0, .5); line-height: 1.05; }
.pf-name span { font-size: 1rem; color: #c9b48a; }
.pf-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.pf-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 14px; font-size: .8rem; color: #f0e2bc; text-decoration: none;
    background: rgba(255, 240, 210, .1); border: 1px solid rgba(232, 200, 112, .3); }
.pf-pill .art { width: 16px; height: 16px; }
.pf-pill em { font-style: normal; font-weight: 700; color: #e2c06a; margin-left: 2px; }
.pf-pill.alliance:hover { background: rgba(255, 240, 210, .18); }
.pf-pill.online { border-color: #6ab04a; color: #c8f0a8; }
.pf-pill.shield { border-color: #6a8ab0; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.pf-actions .button { display: inline-flex; align-items: center; gap: 6px; }
.pf-actions .button .art { width: 18px; height: 18px; }
.pf-big { display: grid; gap: 8px; }
.pf-big div { display: grid; justify-items: center; padding: 8px 16px; border-radius: 10px; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(232, 200, 112, .25); min-width: 96px; }
.pf-big strong { font: 700 1.5rem var(--game-font); color: #fbf0d8; line-height: 1.1; }
.pf-big span { font: 700 .64rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: #c9b48a; }
.pf-ranks { margin-bottom: 16px; }

.pf-shelf-card, .pf-villages-card, .pf-ach { margin-bottom: 16px; }
.pf-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.pf-trophy { display: grid; justify-items: center; gap: 3px; padding: 10px 6px 8px; text-align: center; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 252, 240, .55); }
.pf-trophy.gold { background: radial-gradient(ellipse at 50% 20%, rgba(244, 220, 140, .6), rgba(255, 252, 240, .5)); border-color: #c9a24a; }
.pf-trophy.silver { border-color: #a8b0b6; }
.pf-trophy.bronze { border-color: #b07a46; }
.pf-trophy .achievement-shield { width: 52px; height: 52px; }
.pf-trophy strong { font-size: .86rem; line-height: 1.2; }
.pf-trophy small { font-size: .7rem; color: var(--muted); }

.pf-grid { margin-bottom: 16px; }
.pf-deeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.pf-deed { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border-radius: 10px; text-align: center; background: rgba(40, 25, 10, .05); }
.pf-deed .art { width: 28px; height: 28px; }
.pf-deed strong { font: 700 1.15rem var(--game-font); font-variant-numeric: tabular-nums; }
.pf-deed span { font-size: .72rem; color: var(--muted); }
.pf-deed.none { opacity: .5; }
.pf-jarl-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.pf-jarl-face { position: relative; flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 40% 35%, #fbf0d8, #e2cfa0); box-shadow: inset 0 0 0 3px #c9a24a, 0 2px 5px rgba(0, 0, 0, .3); }
.pf-jarl-face .art { width: 50px; height: 50px; }
.pf-jarl-face b { position: absolute; right: -4px; bottom: -4px; min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 12px;
    font: 700 .8rem var(--game-font); color: #2a1406; background: linear-gradient(180deg, #f4e2a4, #c9a24a); border: 1px solid #6e4a12; }
.pf-jarl-head > div { display: grid; gap: 2px; min-width: 0; flex: 1; }
.pf-jarl-name { font: 700 1.1rem var(--game-font); }
.pf-xp { height: 6px; border-radius: 3px; background: rgba(40, 25, 10, .12); overflow: hidden; }
.pf-xp span { display: block; height: 100%; background: linear-gradient(90deg, #a8822e, #e2c06a); }
.pf-skills { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
.pf-skills span { padding: 2px 10px; border-radius: 10px; font-size: .8rem; background: rgba(40, 25, 10, .06); }
.pf-items { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.pf-items li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 8px; border-radius: 8px; background: rgba(40, 25, 10, .04); font-size: .88rem; }

.pf-villages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pf-village { display: grid; justify-items: center; gap: 2px; padding: 8px; border-radius: 10px; text-align: center; text-decoration: none; color: inherit;
    border: 1px solid var(--border); background: linear-gradient(180deg, rgba(160, 178, 106, .35), rgba(255, 252, 240, .5) 70%); }
.pf-village:hover { border-color: #c9a24a; }
.pf-village-art svg { width: 110px; height: 92px; display: block; }
.pf-village small em { font-style: normal; font-weight: 700; color: #8a6a1a; }

.pf-ach-bar { height: 8px; border-radius: 4px; background: rgba(40, 25, 10, .1); overflow: hidden; margin: 2px 0 10px; }
.pf-ach-bar span { display: block; height: 100%; background: linear-gradient(90deg, #a8822e, #e2c06a); }
.pf-group { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.pf-group summary { display: flex; gap: 10px; align-items: center; cursor: pointer; font: 700 .95rem var(--game-font); list-style: none; }
.pf-group summary::-webkit-details-marker { display: none; }
.pf-group summary::before { content: "\25B8"; color: var(--muted); transition: transform .15s; }
.pf-group[open] summary::before { transform: rotate(90deg); }
.pf-group-bar { flex: 1; max-width: 160px; height: 5px; border-radius: 3px; background: rgba(40, 25, 10, .1); overflow: hidden; margin-left: auto; }
.pf-group-bar span { display: block; height: 100%; background: #c9a24a; }
.pf-group .achievements { margin-top: 8px; }
@media (max-width: 760px) {
    .pf-banner { grid-template-columns: auto 1fr; padding: 18px; }
    .pf-big { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
    .pf-shield { width: 78px; height: 78px; }
    .pf-shield span { font-size: 2.2rem; }
    .pf-name { font-size: 1.7rem; }
}
@media (max-width: 480px) {
    .pf-banner { grid-template-columns: 1fr; justify-items: start; }
}
.pf-shelf { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } .pf-trophy .achievement-shield { width: 46px; height: 46px; }

/* ---------- Alliance ---------- */
.al-shield span { font-size: 1.5rem; letter-spacing: .02em; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.pf-pill.al-war { border-color: #c0503a; color: #ffd0c0; background: rgba(142, 42, 28, .35); }
.pf-actions .button.al-alarm { background: linear-gradient(180deg, #a8382a, #6e1a10); border-color: #3a0c06; color: #fff2e0; animation: al-pulse 1.6s ease-in-out infinite; }
@keyframes al-pulse { 50% { box-shadow: 0 0 0 4px rgba(200, 70, 40, .35); } }
@media (prefers-reduced-motion: reduce) { .pf-actions .button.al-alarm { animation: none; } }
.al-badge { flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 5px; border-radius: 50%; box-sizing: border-box;
    font: 700 .62rem system-ui, sans-serif; letter-spacing: .02em; color: #fbf0d8; text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--paint) 70%, #fff), var(--paint) 60%, color-mix(in srgb, var(--paint) 65%, #000));
    box-shadow: inset 0 0 0 2px #c9a24a, 0 1px 3px rgba(0, 0, 0, .3); }

.al-overview { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.al-col { display: grid; gap: 16px; min-width: 0; }
.al-col > .card { margin: 0; }
.al-saga { line-height: 1.6; padding: 10px 14px; border-left: 3px solid #c9a24a; background: rgba(201, 162, 74, .08); border-radius: 0 8px 8px 0; font-style: italic; }
.al-count { font: 700 .8rem system-ui, sans-serif; padding: 1px 8px; border-radius: 10px; background: rgba(40, 25, 10, .08); color: var(--muted); }

.al-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.al-member { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; border: 1px solid transparent; background: rgba(40, 25, 10, .035); }
.al-member:hover { border-color: var(--border); }
.al-member.me { background: rgba(201, 162, 74, .14); border-color: rgba(201, 162, 74, .45); }
.al-m-id { flex: 1; min-width: 0; display: grid; gap: 2px; }
.al-m-name { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-weight: 700; }
.al-m-name a { color: inherit; text-decoration: none; }
.al-m-name a:hover { text-decoration: underline; }
.al-m-id small { font-size: .76rem; }
.al-share { height: 4px; border-radius: 2px; background: rgba(40, 25, 10, .1); overflow: hidden; max-width: 220px; }
.al-share span { display: block; height: 100%; background: linear-gradient(90deg, #a8822e, #e2c06a); }
.al-role { font: 700 .62rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; padding: 1px 7px; border-radius: 8px; color: #fbf0d8; background: #6e5226; }
.al-role.leader { background: linear-gradient(180deg, #c9a24a, #8a6a1a); color: #2a1406; }
.al-m-acts { flex: none; display: flex; gap: 4px; align-items: center; position: relative; }
.al-icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 1.1rem; line-height: 1;
    text-decoration: none; border: 1px solid transparent; list-style: none; }
.al-icon-btn::-webkit-details-marker { display: none; }
.al-icon-btn:hover, .al-m-menu[open] > .al-icon-btn { border-color: var(--border); background: rgba(255, 252, 240, .7); }
.al-icon-btn .art { width: 18px; height: 18px; }
.al-m-pop { position: absolute; right: 0; top: 36px; z-index: 5; display: grid; gap: 8px; padding: 10px; min-width: 220px; border-radius: 10px;
    background: #fbf3e0; border: 1px solid var(--border); box-shadow: 0 6px 16px rgba(30, 18, 8, .25); }
.al-m-pop form { margin: 0; }
.al-m-pop button { width: 100%; }
.al-m-pop .form-row button { width: auto; }
.al-leave { margin: 12px 0 0; text-align: right; }

.al-hall-peek { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.al-hall-peek:hover { border-color: #c9a24a; }
.al-hall-art svg { width: 96px; height: 80px; display: block; }
.al-hall-text { display: grid; gap: 4px; flex: 1; min-width: 0; }
.al-hall-text strong { font: 700 1.1rem var(--game-font); }
.al-hall-text .hall-track { margin: 2px 0 0; }

.al-rel-head { margin: 10px 0 6px; font: 700 .72rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.al-rel-head.war { color: #a8322a; }
.al-rel-head.offer_in { color: #8a6a1a; }
.al-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.al-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 20px; text-decoration: none; color: inherit; font-size: .86rem;
    border: 1px solid var(--border); background: rgba(255, 252, 240, .6); }
.al-tag .al-badge { min-width: 26px; height: 26px; font-size: .5rem; }
.al-tag.war { border-color: #c0705a; background: rgba(168, 50, 42, .08); }
.al-tag.ally { border-color: #7a9a5a; }
.al-tag:hover { border-color: #c9a24a; }

.al-peek-post { display: flex; gap: 10px; padding: 8px 4px; text-decoration: none; color: inherit; border-top: 1px dashed var(--border); }
.al-peek-post:first-of-type { border-top: 0; }
.al-peek-post .ms-avatar { width: 32px; height: 32px; font-size: .9rem; }
.al-peek-post > span { min-width: 0; }
.al-peek-body { display: block; font-size: .86rem; overflow-wrap: anywhere; }
.al-peek-post:hover strong { text-decoration: underline; }

.al-board h2 small { font: 400 .8rem system-ui, sans-serif; margin-left: 4px; }
.al-compose { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; margin-bottom: 8px; }
.al-compose label { margin: 0; }
.al-compose textarea { width: 100%; box-sizing: border-box; }
.al-day { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; font: 700 .7rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.al-day::before, .al-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.al-post { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.al-post:target { background: rgba(201, 162, 74, .18); }
.al-post.officer .al-post-main { border-left: 3px solid #c9a24a; padding-left: 10px; }
.al-post-main { flex: 1; min-width: 0; }
.al-post-main header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.al-post-main header a { color: inherit; text-decoration: none; }
.al-post-main time { font-size: .76rem; }
.al-post-del { margin-left: auto; opacity: 0; transition: opacity .15s; }
.al-post:hover .al-post-del, .al-post-del:focus-within { opacity: 1; }
.al-post-body { margin-top: 3px; line-height: 1.5; overflow-wrap: anywhere; }
.al-post.me .al-post-body { color: #3a2a14; }

.al-rels { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.al-rel { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 7px 10px; border-radius: 10px; background: rgba(40, 25, 10, .035); border: 1px solid transparent; }
.al-rel.war { background: rgba(168, 50, 42, .07); border-color: rgba(168, 50, 42, .25); }
.al-rel.offer_in { background: rgba(201, 162, 74, .14); border-color: rgba(201, 162, 74, .5); }
.al-rel-text { flex: 1; min-width: 140px; display: grid; }
.al-rel-text a { color: inherit; text-decoration: none; }
.al-propose label { display: grid; gap: 4px; margin-bottom: 10px; }
.al-kinds { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.al-kinds legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
.al-kind { display: flex !important; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; margin: 0 !important; }
.al-kind input { margin-top: 3px; accent-color: #8a6a1a; }
.al-kind span { display: grid; gap: 1px; }
.al-kind small { color: var(--muted); font-size: .78rem; }
.al-kind:has(input:checked) { border-color: #c9a24a; background: rgba(201, 162, 74, .14); }
.al-kind.war:has(input:checked) { border-color: #c0503a; background: rgba(168, 50, 42, .1); }

.al-hero { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; background: linear-gradient(120deg, rgba(160, 178, 106, .25), rgba(255, 252, 240, .4) 55%); }
.al-hero-art svg { width: 190px; height: 160px; display: block; }
.al-hero-body h2 { margin-top: 0; }
.al-perks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.al-perks li { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; }
.al-perks .art { flex: none; width: 24px; height: 24px; }
.al-invited { border-color: #c9a24a; box-shadow: 0 0 0 2px rgba(201, 162, 74, .3); }
.al-invites { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.al-invites li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: rgba(201, 162, 74, .1); }
.al-inv-text { flex: 1; min-width: 150px; display: grid; }
.al-inv-text a { color: inherit; text-decoration: none; }
.al-browse .st-row .al-badge { min-width: 34px; }

@media (max-width: 860px) {
    .al-overview { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .al-hero { flex-direction: column; align-items: flex-start; }
    .al-hero-art svg { width: 140px; height: 118px; }
    .al-compose { grid-template-columns: 1fr; }
    .al-compose .ms-avatar { display: none; }
    .al-post-del { opacity: 1; }
}
.al-m-pop { min-width: 250px; } .al-m-pop .form-row { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; } .al-m-pop select { flex: 1; min-width: 0; } .al-m-pop button { white-space: nowrap; }

/* ---------- Map: calmer, flatter ---------- */
.worldmap .mt-field { stroke: none; opacity: .55; }
.worldmap .mt-tracks .edge path { stroke-width: 5; opacity: .25; }
.worldmap .mt-tracks .top path { stroke: #dccba0; stroke-width: 2.4; opacity: .7; stroke-dasharray: 7 5; }
.worldmap .mt-relief { opacity: .8; }
.worldmap .mt-vignette { opacity: .55; }
.worldmap .mt-oasis-badge rect { fill: rgba(28, 20, 12, .7); stroke: rgba(201, 162, 74, .7); }
.worldmap .map-name { font-size: 11.5px; letter-spacing: .02em; stroke-width: 2.6px; stroke: rgba(26, 20, 16, .85); }
.worldmap .mt-woods { fill: #3e5e26; opacity: .42; } .worldmap .mt-rocks { fill: #a39a84; opacity: .5; }
.res[data-rate] { padding-left: 44px; } .res[data-rate] .res-icon { left: 6px; } .res[data-rate] .res-icon .art { width: 32px; height: 32px; }
.res[data-rate] { min-width: 126px; } @media (max-width: 760px) { .res[data-rate] { min-width: 0; padding-left: 40px; } .res[data-rate] .res-icon { left: 5px; } .res[data-rate] .res-icon .art { width: 28px; height: 28px; } }
@media (max-width: 760px) { .res[data-rate] { padding-left: 35px; padding-right: 9px; } .res[data-rate] .res-icon { left: 4px; } .res[data-rate] .res-icon .art { width: 27px; height: 27px; } }
@media (max-width: 760px) { .resbar-inner { column-gap: 10px; } }
/* each drawing sits differently in its frame: nudge so the visible part is centred in the slot */ .res-wood .res-icon .art { transform: translate(5%, -22%); } .res-clay .res-icon .art { transform: translate(0, -13%); } .res-iron .res-icon .art { transform: translate(1%, -16%); } .res-crop .res-icon .art { transform: translate(-5%, 5%); }
.res[data-rate] .res-icon { line-height: 0; } .res[data-rate] .res-icon .art { display: block; vertical-align: top; }
.res-pop, .res.res-gold { padding-left: 44px; } .res-pop .res-icon, .res-gold .res-icon { left: 6px; line-height: 0; } .res-pop .res-icon .art, .res-gold .res-icon .art { display: block; width: 32px; height: 32px; } @media (max-width: 760px) { .res-pop, .res.res-gold { padding-left: 35px; } .res-pop .res-icon, .res-gold .res-icon { left: 4px; } .res-pop .res-icon .art, .res-gold .res-icon .art { width: 27px; height: 27px; } }
.res-pop .res-icon .art { transform: translate(-5%, 1.5%); } .res-gold .res-icon .art { transform: translate(-2%, -17%); }
.res-crop .res-icon .art { transform: translate(-5%, 5%) scale(.74); }
.res-crop .res-icon .art { transform: translate(-5%, 3.3%) scale(.74); }
/* The resource page: nothing changes under the pointer */ .fields-card .plot:hover use.icon, .fields-card .plot:focus-visible use.icon { transform: none; } .fields-card .plot use.icon { transition: none; } .fields-card .plot:hover .name:not(.town), .fields-card .plot:focus-visible .name:not(.town) { opacity: 0; } .fields-card .badge-link:hover .lvl { filter: none; } .fields-card a.sq-chip:hover { background: rgba(28, 20, 12, .72); } .fields-card .tile:hover { transform: none; box-shadow: 0 2px 0 rgba(30, 20, 10, .3); border-color: var(--frame); color: var(--ink); } .fields-card .tile { transition: none; }
/* Buildings in both scenes stay still under the pointer: no lift, no name, no glow (empty plots still light up) */ .scene .plot:not(.empty):hover use.icon, .scene .plot:not(.empty):focus-visible use.icon { transform: none; } .scene .plot:not(.empty):hover .name:not(.town), .scene .plot:not(.empty):focus-visible .name:not(.town) { opacity: 0; } .scene .badge-link:hover .lvl { filter: none; }

/* ---------- Watchtower reports and longships ---------- */
.intel { display: inline-flex; align-items: center; gap: 5px; font-style: italic; }
.intel .art { width: 20px; height: 20px; flex: none; }
.alert .intel { display: flex; margin-top: 4px; font-weight: 400; }
.ra-intel { font-style: italic; color: #ffe0c8; }
.wt-sightings .intel { display: block; margin-top: 3px; color: var(--ink); }
.wt-tiers li { color: var(--muted); }
.wt-tiers li.reached { color: var(--ink); font-weight: 600; }
.wt-tiers li > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.wt-tiers .art { width: 14px; height: 14px; }
.wr-intel { display: flex; align-items: center; gap: 5px; flex-basis: 100%; font-style: italic; font-size: .84rem; color: var(--ink); }
.wr-intel .art { width: 18px; height: 18px; }
.ship-note { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; font-size: .85rem; }
.ship-note .art { width: 30px; height: 30px; flex: none; }
/* the planned wall's outline in the resource view is only a shape, never a click target or a fill */ .wall-plan-hit { fill: none; stroke: none; pointer-events: none; }
/* Room between a progress bar and the gold "finish now" button under it */ .progress + .gd-finish { display: block; margin: 12px 0 0; } .scene-queue .gd-finish { margin: 6px 0 4px 6px; } .queue li .gd-finish { margin-left: 8px; }
/* The town's grass (lawn() in village_view.php) */ .vc-lawn { fill: #000; pointer-events: none; } .vc-lawn-blades { fill: url(#vc-grass-tex); opacity: .9; pointer-events: none; } .vc-lawn-light { fill: url(#vc-lawn-light); pointer-events: none; }
/* Brick-paved streets in the village centre */ .vc-brick { fill: url(#vc-bricks); stroke: #4e3a2a; stroke-width: 1.2; stroke-linejoin: round; stroke-opacity: .8; pointer-events: none; }
/* The earthen bank under the wall: grassy slopes, a lighter crest, a soft shadow at its foot */ .vc-bank.far { fill: url(#vc-bank-far); } .vc-bank-tex { fill: url(#vc-grass-tex); opacity: .75; pointer-events: none; } .vc-bank-foot { fill: #1a2410; opacity: .28; filter: blur(2px); pointer-events: none; } .vc-crest { fill: #8a9c5c; }
/* The town's streets are stone setts now */ .vc-brick { fill: url(#vc-stones); stroke: #3a3732; }
/* The wild meadow outside the town (filter #vc-meadow); the old blurred colour blobs sit lightly on top */ .vc-meadow-real { fill: #000; pointer-events: none; } .vc-meadows { opacity: .5; }

/* ---------- Avatars: chosen shields (profiles.php) ---------- */
.ms-avatar.sigil { background: none; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.ms-avatar.sigil > .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-step.p1 .ms-avatar.sigil { box-shadow: 0 0 14px rgba(232, 200, 112, .6); }
.pf-shield.sigil { background: none; box-shadow: 0 6px 14px rgba(0, 0, 0, .45); }
.pf-shield.sigil > .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.pf-shield.sigil .pf-online { z-index: 1; }
.pf-motto { margin: -4px 0 10px; font: italic 400 1rem var(--game-font); color: #e2d2a8; }
.pf-edit { margin-bottom: 16px; }
.pf-edit summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.pf-edit summary::-webkit-details-marker { display: none; }
.pf-edit summary h2 { margin: 0; }
.pf-edit summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.pf-edit:not([open]) summary::after { transform: rotate(-90deg); }
.pf-edit-form { margin-top: 12px; display: grid; gap: 12px; }
.pf-shields { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.pf-pick { display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 252, 240, .5); cursor: pointer; text-align: center; }
.pf-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pf-pick > .art, .pf-pick > .ms-avatar { width: 50px; height: 50px; }
.pf-pick > .ms-avatar { font-size: 1.3rem; }
.pf-pick small { font-size: .74rem; line-height: 1.2; }
.pf-pick:hover { border-color: #c9a24a; }
.pf-pick:has(input:checked) { border-color: #a8822e; background: rgba(201, 162, 74, .22); box-shadow: 0 0 0 2px rgba(201, 162, 74, .45); }
.pf-pick:has(input:focus-visible) { outline: 2px solid #a8822e; outline-offset: 2px; }
.pf-motto-field { display: grid; gap: 4px; font-weight: 600; }
.pf-motto-field .muted { font-weight: 400; font-size: .82rem; }
.pf-motto-field input { width: 100%; box-sizing: border-box; }

/* ==========================================================================
   Phones: a slim top bar, a tab bar along the bottom, a compact resource bar
   ========================================================================== */
.nav-more { display: none; }
@media (max-width: 640px) {
    body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
    /* the top bar: the name on the left, the bell (and install) on the right */
    .banner .banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
    .banner .brand { font-size: 1.02rem; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; }
    .banner .banner-links { gap: 6px; }
    .banner.in-game .banner-links > a { display: none; }
    .banner .banner-links .bell { padding: 5px 9px; }

    /* the nav becomes a tab bar fixed to the bottom of the screen */
    .banner .navbtns { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; order: initial; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0; width: auto; margin: 0; padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, #33281e, #1a140f); border-top: 1px solid #8a6a2a; box-shadow: 0 -4px 14px rgba(10, 6, 2, .45); }
    .banner .navbtn { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; padding: 2px 0; }
    .banner .navbtn.nav-more-item { display: none; }
    .banner .navbtn-icon { width: 36px; height: 36px; border-width: 2px; }
    .banner .navbtn-icon .art { width: 24px; height: 24px; }
    .banner .navbtn-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: .62rem; letter-spacing: .02em; line-height: 1; }
    .banner .navbtn .badge { top: -3px; right: calc(50% - 26px); }
    .banner .navbtn:hover .navbtn-icon { transform: none; }

    /* "More": a panel of the other pages that opens above the tab bar */
    .nav-more { display: block; min-width: 0; }
    .nav-more summary { list-style: none; cursor: pointer; }
    .nav-more summary::-webkit-details-marker { display: none; }
    .nav-more-icon { display: grid !important; place-items: center; align-content: center; gap: 3px; }
    .nav-more-icon i { display: block; width: 16px; height: 2.5px; border-radius: 2px; background: #e8d6a8; }
    .nav-more[open] .nav-more-icon { background: #8a6a2a; }
    .nav-more-panel { position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 61; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
        padding: 10px; border-radius: 14px; background: linear-gradient(180deg, #3a2e22, #241b13); border: 1px solid #8a6a2a; box-shadow: 0 -6px 24px rgba(0, 0, 0, .55); }
    .nav-more-panel a { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 10px; text-decoration: none; color: #e8d6a8;
        font: 700 .74rem var(--game-font); font-variant: small-caps; letter-spacing: .04em; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 162, 74, .2); }
    .nav-more-panel a .art { width: 30px; height: 30px; }
    .nav-more-panel a.active { border-color: #c9a24a; color: #f0d898; background: rgba(201, 162, 74, .15); }
    .nav-more-panel a.logout { color: #e8a090; }
    .nav-more-panel .badge { position: absolute; top: 4px; right: 8px; }

    /* the resource bar: two short rows, amounts only (rates are in each one's tooltip) */
    .resbar .resbar-inner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 6px 8px; }
    .resbar .res, .resbar .res[data-rate], .resbar .res-pop, .resbar .res.res-gold { min-width: 0; margin: 0; padding: 4px 6px 5px 30px; }
    .resbar .res .res-icon { left: 3px; }
    .resbar .res .res-icon .art, .resbar .res[data-rate] .res-icon .art { width: 24px; height: 24px; }
    .resbar .res-rate { display: none; }
    .resbar .res-amount { font-size: .9rem; }
    .resbar .res-pop { display: block; }
}
@media (max-width: 640px) { .banner { z-index: 60; } }

/* Phones: the whole village picture fits the screen (game.js crops it to the fields and buildings) */
@media (max-width: 640px) {
    .scene-card .scene-wrap { border-radius: 10px; overflow: hidden; }
    .scene-card .scene-scroll { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; }
    .scene-card .scene-scroll::-webkit-scrollbar { display: none; }
    .scene-card .scene { display: block; width: 100%; max-width: none; height: auto; }
    /* edge to edge, like the apps: every pixel of the width goes to the picture */
    .scene-card { margin-left: -16px; margin-right: -16px; padding: 0; border-left: 0; border-right: 0; border-radius: 0; }
    .scene-card .scene-wrap { border-radius: 0; }
    .scene-card .scene-fallback { display: none; }
}
@media (max-width: 640px) { .banner:not(.in-game) .brand { font-size: .84rem; letter-spacing: .03em; } .banner:not(.in-game) .banner-links a { padding: 4px 9px; font-size: .74rem; } }

/* ==========================================================================
   Phones, the app way (after Travian's apps): the village and its switcher in the top bar,
   the building queue laid over the picture, a map you swipe, side panels that fold away
   ========================================================================== */
.vswitch, .jarl-quick { display: none; }
@media (max-width: 640px) {
    /* top bar: [village ▾] ........ [jarl] [bell] */
    .banner.in-game .brand { display: none; }
    .banner.in-game .banner-inner { padding: 6px 10px; }
    .vswitch { display: block; position: relative; flex: 1; min-width: 0; }
    .vswitch summary { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 4px 10px 4px 5px; border-radius: 22px; cursor: pointer; list-style: none;
        color: #f0e2c0; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 162, 74, .45); box-shadow: inset 0 1px 0 rgba(255, 230, 170, .08); }
    .vswitch summary::-webkit-details-marker { display: none; }
    .vswitch summary > .art { flex: none; width: 30px; height: 30px; padding: 2px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #5a4632, #2a2016); border: 1px solid #8a6a2a; box-sizing: border-box; }
    .vswitch-text { display: grid; min-width: 0; line-height: 1.1; }
    .vswitch-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 700 .92rem var(--game-font); letter-spacing: .03em; }
    .vswitch-xy { font-size: .68rem; color: #c9b98a; font-variant-numeric: tabular-nums; }
    .vswitch-caret { margin-left: auto; color: #c9a24a; font-size: .8rem; transition: transform .15s; }
    .vswitch[open] .vswitch-caret { transform: rotate(180deg); }
    .vswitch-list { position: absolute; left: 0; top: calc(100% + 6px); z-index: 62; width: min(300px, calc(100vw - 20px)); max-height: 60vh; overflow-y: auto;
        display: grid; gap: 4px; padding: 6px; border-radius: 12px; background: linear-gradient(180deg, #3a2e22, #241b13); border: 1px solid #8a6a2a; box-shadow: 0 8px 24px rgba(0, 0, 0, .55); }
    .vswitch-list a { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; padding: 8px 10px; border-radius: 8px; text-decoration: none;
        color: #e8d6a8; background: rgba(0, 0, 0, .2); border: 1px solid transparent; }
    .vswitch-list a > span { grid-column: 2; font: 700 .9rem var(--game-font); }
    .vswitch-list a small { grid-column: 2; color: #b8a888; font-size: .72rem; }
    .vswitch-list a .art { grid-row: span 2; width: 18px; height: 18px; }
    .vswitch-list a.current { border-color: #c9a24a; background: rgba(201, 162, 74, .14); color: #f0d898; }
    .banner.in-game .banner-links { flex: none; }
    .banner.in-game .banner-links > a.jarl-quick { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%;
        background: radial-gradient(circle at 50% 40%, #5a4632, #2a2016); border: 1px solid #8a6a2a; }
    .jarl-quick .art { width: 28px; height: 28px; }

    /* the building queue sits on the picture, as in the apps: just what is being built and when it is done */
    .scene-overlay { padding: 6px; }
    .scene-overlay .scene-hint, .sq-chip.locked, .sq-chip.idle, .scene-overlay .gd-finish, .scene-overlay form { display: none; }
    .scene-queue { gap: 4px; }
    .sq-chip { grid-template-columns: 24px auto; gap: 5px; min-width: 0; max-width: 175px; padding: 3px 8px 3px 4px; font-size: .72rem; }
    .sq-icon, .sq-icon .art { width: 24px; height: 24px; }
    .sq-time { font-size: .68rem; }

    /* the world map: a wider map in a frame you swipe, with the search and arrows staying put */
    .map-scroll { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; }
    .map-scroll::-webkit-scrollbar { display: none; }
    .map-scroll .worldmap { width: 720px; max-width: none; }
    .map-hud { top: 6px; left: 6px; right: 6px; gap: 5px; }
    .map-search { padding: 3px 4px 3px 8px; }
    .map-search input { width: 46px; }
    .map-nav { padding: 4px 8px; }
    .map-nav .dir { display: none; }
    .map-nav.nw, .map-nav.ne { top: 48px; }

    /* side panels fold to their titles; the village list lives in the top bar now */
    .sidebar .villages-box { display: none; }
    .sidebar { gap: 8px; }
    .sidebar .box.fold > .box-title { position: relative; padding-right: 32px; cursor: pointer; user-select: none; }
    .sidebar .box.fold > .box-title::after { content: "\25BE"; position: absolute; right: 12px; top: 50%; translate: 0 -50%; color: #c9a24a; transition: transform .15s; }
    .sidebar .box.fold.open > .box-title::after { transform: rotate(180deg); }
    .sidebar .box.fold:not(.open) > :not(.box-title) { display: none; }

    /* the raid warning: one slim line */
    .raid-alert-inner { flex-wrap: nowrap; gap: 8px; padding: 5px 10px; }
    .ra-icon { width: 24px; height: 24px; }
    .ra-icon .art { width: 16px; height: 16px; }
    .ra-text { font-size: .76rem; line-height: 1.25; }
    .ra-go { padding: 3px 9px; font-size: .7rem; }

    /* how full each store is, under the amount */
    .resbar .res .res-fill { display: block; height: 3px; margin-top: 2px; }
}

/* Buildings you can put on a plot come first; the locked ones follow */
.build-option.locked { order: 1; }

/* ==========================================================================
   Phones, round three: tables become cards, big buttons for the thumb, rates in the resource bar
   ========================================================================== */
@media (max-width: 640px) {
    /* the resource bar: the amount on the left, what comes in each hour on the right */
    .resbar .res[data-rate] .res-text { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
    .resbar .res[data-rate] .res-rate { display: inline; font-size: .62rem; opacity: .85; white-space: nowrap; }

    /* upgrade and build: one wide button, and the note under it */
    .card form[action="build.php"] { display: grid; gap: 6px; }
    .card form[action="build.php"] button { width: 100%; padding-top: 11px; padding-bottom: 11px; font-size: .95rem; }
    .card form[action="build.php"] small { text-align: center; color: var(--muted); }

    /* training: each unit a card (picture and name, its numbers, the cost, then train) */
    .table-wrap:has(> .train-table), .table-wrap:has(> .wilds-table) { overflow: visible; }
    .train-table, .train-table tbody { display: block; }
    .train-table thead, .wilds-table thead { display: none; }
    .train-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; align-items: center; padding: 10px 2px 12px; border-bottom: 1px solid var(--border); }
    .train-table tr:last-child { border-bottom: 0; }
    .train-table td { display: block; padding: 0; border: 0; text-align: left; }
    .train-table td.unit-cell { grid-column: 1 / 4; display: flex; align-items: center; gap: 8px; }
    .train-table td.unit-cell .art { width: 40px; height: 40px; }
    .train-table td.train-time { grid-column: 4; text-align: right; font-variant-numeric: tabular-nums; }
    .train-table td.train-time::before { content: "\23F1  "; }
    .train-table td[data-label] { padding: 4px 6px; border-radius: 8px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(40, 25, 10, .06); }
    .train-table td[data-label]::before { content: attr(data-label); display: block; font: 700 .62rem system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
    .train-table td.train-cost, .train-table td.actions { grid-column: 1 / -1; }
    .train-table td.unit-cell, .train-table td.train-time { grid-row: 1; }
    .train-table td[data-label] { grid-row: 2; }
    .train-table td.train-cost { grid-row: 3; }
    .train-table td.actions { grid-row: 4; }
    .train-table td:not([data-label]) { background: none; }
    .train-table td.actions form { display: grid; grid-template-columns: 76px 1fr auto; gap: 8px; align-items: center; }
    .train-table td.actions input[type=number] { width: 100%; box-sizing: border-box; padding: 9px 6px; font-size: 1rem; text-align: center; }
    .train-table td.actions button { padding: 10px; }

    /* wild oases: a card each, the fight and the hoard under the place and distance */
    .wilds-table, .wilds-table tbody { display: block; }
    .wilds-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--border); }
    .wilds-table tr:last-child { border-bottom: 0; }
    .wilds-table td { display: block; padding: 0; border: 0; }
    .wilds-table td:first-child { font-weight: 700; }
    .wilds-table td.wilds-dist { text-align: right; color: var(--muted); }
    .wilds-table td.wilds-dist::after { content: " fields"; }
    .wilds-table td:nth-child(2), .wilds-table td:nth-child(3) { grid-column: 1 / -1; }
    .wilds-table td, .wilds-table tr, .train-table tr { background: none; }
    .wilds-table td:first-child, .wilds-table td.wilds-dist { grid-row: 1; }
    .wilds-table td:nth-child(2) { grid-row: 2; }
    .wilds-table td:nth-child(3) { grid-row: 3; }
    .wilds-table td.actions { grid-column: 1 / -1; grid-row: 4; }
    .wilds-table td.actions .button { display: block; text-align: center; padding: 9px; }
}

/* ==========================================================================
   Phones: feeling like an app. Touch without browser flashes or zooming, pressed states,
   the notch and home bar kept clear, the More menu as a sheet, back buttons, pull to refresh
   ========================================================================== */
@media (max-width: 640px) {
    html { background: #3a2c20; -webkit-text-size-adjust: 100%; touch-action: manipulation; }    /* dark where a page is pulled past its ends */
    body { min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .banner, .resbar, .navbtns, .nav-more-panel, .vswitch, button, .button, .sq-chip, .box-title { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
    .scene, .worldmap, .art { -webkit-touch-callout: none; }

    /* pressed, the way app buttons answer a thumb (there is no hover on a phone) */
    button, .button, .navbtn-icon, .jarl-quick, .vswitch summary, .nav-more-panel a, .vswitch-list a, .sq-chip, .box-title { transition: transform .08s ease, filter .08s ease; }
    button:not(:disabled):active, .button:active, .jarl-quick:active, .vswitch summary:active, .nav-more-panel a:active, .vswitch-list a:active, .sq-chip:active { transform: scale(.96); filter: brightness(.92); }
    .navbtn:active .navbtn-icon { transform: scale(.9); }
    .box.fold > .box-title:active { filter: brightness(1.15); }
    .banner .navbtn.active .navbtn-label { color: #f0d898; }

    /* the top: under the clock and the notch when it runs full screen */

    /* "More": a sheet that slides up over a dimmed game */
    .nav-more[open] > summary::before { content: ""; position: fixed; inset: 0; bottom: calc(66px + env(safe-area-inset-bottom)); background: rgba(10, 6, 2, .55); z-index: -1; animation: sheet-dim .2s ease-out; }
    .nav-more-panel { left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); padding: 22px 12px 14px; border-radius: 18px 18px 0 0; border-width: 1px 0 0; animation: sheet-up .22s cubic-bezier(.2, .8, .3, 1); }
    .nav-more-panel::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: rgba(232, 214, 168, .35); }
    @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
    @keyframes sheet-dim { from { opacity: 0; } }
    .vswitch-list { animation: sheet-dim .15s ease-out; }

    /* back links become an app's back button, and page titles sit tighter */
    .crumbs { margin: 0 0 8px; }
    .crumbs a { display: inline-flex; align-items: center; max-width: 100%; padding: 5px 12px 5px 9px; border-radius: 16px; font-size: .84rem; text-shadow: none;
        overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #f0e2c0; background: linear-gradient(180deg, #4a3826, #2e2318); border: 1px solid #8a6a2a; }
    .page-head { margin-bottom: 8px; gap: 2px 10px; }
    .page-head h1 { font-size: 1.4rem; }
    .page-head .meta { font-size: .82rem; }

    /* how to install it, on iPhone */
    .app-tip { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; margin: 0 0 12px; padding: 10px 8px 10px 10px; border-radius: 12px;
        color: #f0e2c0; background: linear-gradient(180deg, #3a2e22, #241b13); border: 1px solid #8a6a2a; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
    .app-tip img { border-radius: 9px; }
    .app-tip p { margin: 0; font-size: .8rem; line-height: 1.35; color: #d8c8a4; }
    .app-tip strong { display: block; font: 700 .9rem var(--game-font); color: #f0d898; }
    .app-tip em { font-style: normal; font-weight: 700; color: #f0e2c0; }
    .app-tip-share { display: inline-block; width: 13px; height: 15px; vertical-align: -2px; border: 1.6px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; position: relative; margin: 0 2px; }
    .app-tip-share::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1.6px; height: 11px; margin-left: -.8px; background: currentColor; }
    .app-tip-close { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; font-size: 1.2rem; line-height: 1; color: #e8d6a8; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 162, 74, .4); box-shadow: none; }

    /* pull to refresh (full screen only) */
    .pull-refresh { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 8px); z-index: 71; width: 38px; height: 38px; margin-left: -19px; border-radius: 50%;
        display: grid; place-items: center; background: #2e2318; border: 1px solid #8a6a2a; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
        opacity: 0; transform: translateY(calc(var(--pull, 0px) - 50px)); pointer-events: none; }
    .pull-refresh.pulling { opacity: 1; }
    .pull-refresh span { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #c9a24a; border-right-color: transparent; transform: rotate(calc(var(--pull, 0px) * 4)); }
    .pull-refresh.ready span { border-color: #f0d898; border-right-color: transparent; }
    .pull-refresh.loading span { animation: pull-spin .7s linear infinite; }
    @keyframes pull-spin { to { transform: rotate(360deg); } }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { .nav-more-panel, .vswitch-list, .nav-more[open] > summary::before { animation: none; } }

/* Phones: a page's tabs stay on one line you can swipe, like an app's segmented bar */
@media (max-width: 640px) {
    nav.tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    nav.tabs::-webkit-scrollbar { display: none; }
    nav.tabs > a { flex: none; white-space: nowrap; padding-left: 12px; padding-right: 12px; font-size: .82rem; }
}

/* Full screen from the home screen. iOS softens whatever passes just under the clock with a blur
   that reaches a little below the status bar, so a solid band a bit deeper than that sits there:
   the blur only ever falls on flat colour, and the top bar and the resource bar start below it. */
@media (max-width: 640px) and (display-mode: standalone) {
    :root { --app-top: calc(env(safe-area-inset-top) + 12px); }
    body::after { content: ""; }
}
@media (max-width: 640px) {
    .app-mode { --app-top: calc(env(safe-area-inset-top) + 12px); }
    .app-mode body::after { content: ""; }
    .banner.in-game { padding-top: var(--app-top, 0px) !important; }
    .resbar, .raid-alert { top: var(--app-top, 0px); }
    body::after { position: fixed; left: 0; right: 0; top: 0; z-index: 70; height: var(--app-top, 0px); pointer-events: none;
        background: #2c231b; box-shadow: 0 1px 0 rgba(10, 6, 2, .45); }
    .pull-refresh { top: calc(var(--app-top, 0px) + 8px); }
}

/* Phones: no zoom when a field is tapped (iOS zooms into text under 16px), no bounce in the app,
   a loading bar along the top, and a tapped button that shows it's working */
@media (max-width: 640px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
    .app-mode, .app-mode body { overscroll-behavior-y: none; }
    .nav-progress { position: fixed; left: 0; top: var(--app-top, 0px); z-index: 72; width: 100%; height: 3px; pointer-events: none;
        background: linear-gradient(90deg, #8a6a2a, #f0d898, #c9a24a); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; }
    .navigating .nav-progress { opacity: 1; animation: nav-progress 6s cubic-bezier(.1, .7, .2, 1) forwards; }
    @keyframes nav-progress { 0% { transform: scaleX(0); } 15% { transform: scaleX(.45); } 100% { transform: scaleX(.92); } }
    button.busy { position: relative; color: transparent !important; pointer-events: none; }
    button.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
        border: 2.5px solid rgba(255, 240, 210, .85); border-right-color: transparent; animation: pull-spin .7s linear infinite; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { .navigating .nav-progress { animation: none; transform: scaleX(.6); } }

/* ==========================================================================
   Phones: every page made for a thumb. Buttons, checkboxes, choices and fold-outs big enough
   to hit; the side panels only on the village pages; compact hero headers; rows of chips you swipe
   ========================================================================== */
@media (max-width: 640px) {
    main button:not(.app-tip-close), main .button, main input[type=submit] { min-height: 40px; }
    main .form-row input:not([type=checkbox]):not([type=radio]), main input[type=number], main input[type=text], main input[type=search], main select { min-height: 40px; box-sizing: border-box; }
    main input[type=checkbox], main input[type=radio] { width: 22px; height: 22px; margin: 0 4px 0 0; vertical-align: middle; accent-color: #8e2a1c; }
    main details:not(.map-legend) > summary { padding-top: 9px; padding-bottom: 9px; cursor: pointer; }
    main label:has(> input[type=checkbox]), main label:has(> input[type=radio]) { min-height: 40px; display: inline-flex; align-items: center; }

    /* the panels beside the page (Saga, production, troops, defence) belong with the village */
    body:not([data-page="resources"]):not([data-page="centre"]) .sidebar { display: none; }

    /* rankings: one row of choices you swipe, not three */
    .st-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 2px; }
    .st-tabs::-webkit-scrollbar { display: none; }
    .st-tabs > a { flex: none; white-space: nowrap; }

    /* the jarl's banner: portrait beside his name rather than a screen of its own */
    .jl-banner { padding: 16px 14px 20px; }
    .jl-portrait { width: 112px; height: 112px; margin: 0 auto; }
    .jl-ring .art { width: 86px; height: 86px; margin-top: -4px; }
    .jl-level { width: 40px; height: 46px; font-size: 1.15rem; right: -8px; }
    .jl-name { font-size: 1.6rem; }

    /* the market's quick amounts */
    main .mk-good .mk-add { min-height: 36px; padding: 6px 9px; font-size: .78rem; }
    /* "/ 6" beside a unit: tap it to send them all */
    .fill-max { min-height: 32px; padding: 4px 10px; border-radius: 14px; font: 700 .78rem var(--game-font); color: #f0e2c0;
        background: linear-gradient(180deg, #4a3826, #2e2318); border: 1px solid #8a6a2a; cursor: pointer; }
}

/* ==========================================================================
   Reports on phones: a plain list as in a mail app. One line each for the title and what
   happened, the outcome as a round badge, a gold dot for unread; "Select" brings the boxes and
   a bar along the bottom. An open report steps back and forth with arrows.
   ========================================================================== */
.rp-head-actions, .rp-picked { display: none; }
@media (max-width: 640px) {
    .page-head:has(.rp-head-actions) { flex-wrap: nowrap; align-items: center; }
    .rp-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
    main .rp-head-actions button { min-height: 36px; height: 36px; box-shadow: none; }
    .rp-icon-btn { display: grid; place-items: center; width: 36px; padding: 0; border-radius: 50%; color: #f0e2c0;
        background: linear-gradient(180deg, #4a3826, #2e2318); border: 1px solid #8a6a2a; }
    .rp-icon-btn svg { width: 20px; height: 20px; }
    .rp-select-toggle { padding: 0 16px; border-radius: 18px; font: 700 .82rem var(--game-font); letter-spacing: .04em; color: #f0e2c0;
        background: linear-gradient(180deg, #4a3826, #2e2318); border: 1px solid #8a6a2a; }
    .rp-select-toggle[aria-pressed="true"] { color: #2a1406; background: linear-gradient(180deg, #f4e2a4, #c9a24a); border-color: #6a4a12; }

    /* the list: edge to edge on one plain surface */
    .rp-list-card { margin: 0 -16px; padding: 4px 0 8px; border-radius: 0; border-width: 1px 0; box-shadow: none;
        background: color-mix(in srgb, var(--surface) 92%, #fff); }
    .rp-list-card .rp-tabs { margin: 6px 12px 2px; }
    .rp-count { display: none; }
    .rp-unread { font-size: .62rem; }
    .rp-legend { display: none; }
    .rp-day { margin: 16px 16px 4px; font-size: .68rem; }

    .rp-row { position: relative; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0; padding: 11px 16px;
        border: 0; border-radius: 0; border-bottom: 1px solid rgba(40, 25, 10, .09); background: none; }
    .rp-row.unread { background: none; }
    .rp-row:last-of-type { border-bottom: 0; }
    .rp-row:active { background: rgba(40, 25, 10, .06); }
    .rp-row .outcome { display: grid; place-items: center; width: 40px; height: 40px; border-width: 2px; border-radius: 50%; }
    .rp-row .outcome .art { width: 20px; height: 20px; }
    .rp-row input[name="ids[]"] { display: none; }
    .rp-row-main { gap: 3px; }
    .rp-row-main::after { content: ""; position: absolute; inset: 0; }      /* the whole row opens the report */
    .rp-row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; color: var(--ink); }
    .rp-row:not(.unread) .rp-row-title { font-weight: 400; }
    .rp-row .rp-row-title .new { display: none; }
    .rp-row-sum { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: .76rem;
        -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
    .rp-row-sum .cost { flex-wrap: nowrap; }
    .rp-row.unread .rp-row-sum { font-weight: 400; }
    .rp-row-time { align-self: start; padding-top: 2px; font-size: .74rem; text-align: right; }
    .rp-row.unread .rp-row-time { color: #8a5a10; font-weight: 700; }
    .rp-row.unread .rp-row-time::after { content: ""; display: block; width: 10px; height: 10px; margin: 8px 0 0 auto; border-radius: 50%;
        background: #c9a24a; box-shadow: 0 0 0 2px rgba(201, 162, 74, .25); }

    /* choosing: a box on each row, tapping a row ticks it, and the bar along the bottom */
    .rp-tools { display: none; }
    .rp-list.selecting .rp-row { grid-template-columns: 24px 40px minmax(0, 1fr) auto; }
    .rp-list.selecting .rp-row input[name="ids[]"] { display: block; margin: 0; }
    .rp-list.selecting .rp-row-main::after { display: none; }
    .rp-list.selecting .rp-row:has(input:checked) { background: rgba(201, 162, 74, .14); }
    .rp-list.selecting { padding-bottom: 76px; }
    .rp-list.selecting .rp-tools { position: fixed; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 59; display: flex; flex-wrap: nowrap;
        align-items: center; gap: 8px; margin: 0; padding: 10px 12px; background: linear-gradient(180deg, #3a2e22, #241b13); border-top: 1px solid #8a6a2a;
        box-shadow: 0 -6px 18px rgba(0, 0, 0, .35); animation: sheet-up .2s ease-out; }
    .rp-list.selecting .rp-tools .rp-all { margin: 0; color: #e8d6a8; font-size: .8rem; }
    .rp-list.selecting .rp-picked { display: block; flex: 1; min-width: 0; color: #c9b98a; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rp-list.selecting .rp-tools button[value="read_all"] { display: none; }
    main .rp-list .rp-tools button { min-height: 38px; padding: 0 14px; font-size: .78rem; }
    .rp-list .rp-tools button[value="delete"]:not(:disabled) { color: #fbe6dc; background: linear-gradient(180deg, #9a3324, #6e1f14); border-color: #3a1008; }

    /* the open report: a back pill and arrows for the newer and older ones */
    .rp-bar { flex-wrap: nowrap; align-items: center; }
    main .rp-bar .button { min-height: 36px; padding: 6px 14px; border-radius: 18px; font-size: .8rem; }
    .rp-step { margin-left: auto; }
    main:has(.report-view) > .page-head { display: none; }
}

/* ==========================================================================
   Phones, every page: plain surfaces running edge to edge with a hairline above and below,
   instead of framed, riveted cards; the page's parchment shows between them, as in an app's
   grouped lists. Pictures, the map and the hoard's banner keep their frames.
   ========================================================================== */
@media (max-width: 640px) {
    main .card:not(.scene-card):not(.map-window):not(.gd-hero):not(.card .card) {
        margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; border-radius: 0;
        border-width: 1px 0; border-color: rgba(40, 25, 10, .16); box-shadow: none;
        background: color-mix(in srgb, var(--surface) 92%, #fff); }
    main .card.danger-zone { border-color: rgba(160, 50, 30, .45); }
    main .grid:has(> .card) { gap: 10px; }
    main .card > h2 { font-size: 1.08rem; }

    /* messages: conversations, inbox and sent as rows, like the reports */
    main .card.ms-box, main .card.ms-shell { padding: 4px 0 8px; }
    .ms-search.wide { padding: 6px 16px 8px; }
    .ms-search { padding: 8px 16px; }
    .ms-list { background: none; }
    .ms-row, .ms-chat { position: relative; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0; padding: 11px 16px;
        border: 0; border-radius: 0; border-bottom: 1px solid rgba(40, 25, 10, .09); background: none; }
    .ms-row.unread, .ms-chat.on { background: none; }
    .ms-row:active, .ms-chat:active { background: rgba(40, 25, 10, .06); }
    .ms-row .ms-avatar, .ms-chat .ms-avatar { width: 40px; height: 40px; }
    .ms-row input[name="ids[]"] { display: none; }
    .ms-row-main { gap: 3px; }
    .ms-row-main::after { content: ""; position: absolute; inset: 0; }
    .ms-row-top { display: grid; gap: 1px; }
    .ms-row-top strong, .ms-chat-top strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ms-row:not(.unread) .ms-row-top strong { font-weight: 600; }
    .ms-row-subject { font-size: .85rem; }
    .ms-row .ms-chat-snippet, .ms-chat .ms-chat-snippet { font-weight: 400; }
    .ms-row .ms-chat-time { align-self: start; padding-top: 2px; text-align: right; }
    .ms-row.unread .ms-chat-time { color: #8a5a10; font-weight: 700; }
    .ms-row.unread .ms-chat-time::after { content: ""; display: block; width: 10px; height: 10px; margin: 8px 0 0 auto; border-radius: 50%;
        background: #c9a24a; box-shadow: 0 0 0 2px rgba(201, 162, 74, .25); }
    .ms-chat.unread .ms-chat-top strong { color: var(--ink); }
    .ms-list-foot { display: none; }
    .rp-list.selecting .ms-row { grid-template-columns: 24px 40px minmax(0, 1fr) auto; }
    .rp-list.selecting .ms-row input[name="ids[]"] { display: block; margin: 0; }
    .rp-list.selecting .ms-row-main::after { display: none; }
    .rp-list.selecting .ms-row:has(input:checked) { background: rgba(201, 162, 74, .14); }
    .rp-list .pager { padding: 10px 16px; }
}

/* ==========================================================================
   Phones: the alliance, the jarl and the rankings, pared down. Compact headers (emblem beside
   the name), sections that fold to a title row, and the rankings without the wall of tiles.
   ========================================================================== */
@media (max-width: 640px) {
    /* folding sections (game.js marks them on the alliance and jarl pages) */
    main .card.fold-card { padding-top: 0; padding-bottom: 0; }
    main .card.fold-card > h2 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 0; cursor: pointer; user-select: none; -webkit-user-select: none; }
    main .card.fold-card > h2::after { display: none; }
    .fold-chev { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid #8a6a2a; border-bottom: 2px solid #8a6a2a; transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
    .fold-card.open > h2 .fold-chev { transform: rotate(-135deg) translateY(-2px); }
    .fold-card.open { padding-bottom: 14px; }
    .fold-card:not(.open) > :not(h2) { display: none !important; }
    .fold-card > h2:active { opacity: .7; }
    main .grid:has(> .fold-card), main .jl-grid, main .al-col { gap: 0; }
    main .fold-card + .fold-card, main .jl-grid > .fold-card + .fold-card, main .al-col > .fold-card + .fold-card { margin-top: -1px; }

    /* the alliance's banner: the shield beside its name, the numbers in one slim row */
    .pf-banner.al-banner { grid-template-columns: 60px minmax(0, 1fr); gap: 10px 14px; align-items: center; padding: 14px 16px 18px; text-align: left; }
    .al-banner .pf-shield { width: 60px; height: 60px; }
    .al-banner .pf-shield span { font-size: 1.35rem; }
    .al-banner .pf-name { font-size: 1.5rem; margin: 0 0 6px; }
    .al-banner .pf-kicker { font-size: .64rem; }
    .al-banner .pf-facts { margin: 0 0 8px; gap: 4px; }
    .al-banner .pf-pill { padding: 2px 8px; font-size: .72rem; }
    .al-banner .pf-actions { margin: 0; display: flex; gap: 6px; }
    main .al-banner .pf-actions .button { min-height: 34px; padding: 4px 12px; font-size: .74rem; }
    .al-banner .pf-big { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .al-banner .pf-big > div { padding: 6px 4px; }
    .al-banner .pf-big strong { font-size: 1.15rem; }
    .al-banner .pf-big span { font-size: .6rem; }

    /* the jarl's banner: portrait beside his name, his four bonuses as one slim row */
    .jl-banner { grid-template-columns: 84px minmax(0, 1fr); justify-items: stretch; text-align: left; gap: 10px 14px; padding: 14px 16px 18px; }
    .jl-portrait { width: 84px; height: 84px; margin: 0; }
    .jl-ring .art { width: 64px; height: 64px; margin-top: -2px; }
    .jl-level { width: 32px; height: 38px; font-size: .95rem; right: -6px; bottom: 0; }
    .jl-level small { font-size: .45rem; }
    .jl-kicker { font-size: .62rem; }
    .jl-name { font-size: 1.35rem; margin: 0 0 4px; }
    .jl-state { font-size: .8rem; margin: 0 0 6px; }
    .jl-xp-text { font-size: .7rem; }
    .jl-rename summary { font-size: .74rem; }
    main .jl-rename > summary { padding-top: 4px; padding-bottom: 4px; }
    .jl-stones { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; }
    .jl-stone { height: 46px; border-radius: 10px; }
    .jl-stone-value { font-size: .95rem; }
    .jl-stone-label { font-size: .56rem; }

    /* adventures: name, danger and the facts; the story stays on the map */
    .jl-adv { grid-template-columns: 56px minmax(0, 1fr); gap: 6px 12px; padding: 10px 0; border: 0; border-radius: 0; border-bottom: 1px solid rgba(40, 25, 10, .09); background: none; box-shadow: none; }
    .jl-adv:last-child { border-bottom: 0; }
    .jl-adv-art { height: 56px; }
    .jl-adv-body h3 { font-size: 1rem; margin: 0 0 2px; }
    .jl-adv-body > p.muted, .jl-adv-gain { display: none; }
    .jl-adv-facts { font-size: .74rem; margin: 0; }
    .jl-adv-go { grid-column: 1 / -1; }
    main .jl-adv-go button { width: 100%; min-height: 38px; }
    .jl-adventures > h2 + p { display: none; }
    .jl-adventures > p { font-size: .78rem; }

    /* rankings: your place shows in the board itself, so no wall of tiles above it */
    .st-standing { display: none; }
    .page-head:has(+ .st-standing) .meta, .st-board-head + p { font-size: .78rem; }
}

/* The install button is for phones only */
@media (min-width: 641px) { .banner-links .install-app { display: none !important; } }

/* The sign-up form's trap field for bots: off-screen, so people never see or tab into it */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ==========================================================================
   The landing page (before logging in): one quiet dark opening with the emblem, the name and
   one button; then the town as the game draws it, three short points, and the world in one line.
   The dark band reaches the window's edges (100cqw: the page's width without the scrollbar).
   ========================================================================== */
body:has(.ld-hero) { container-type: inline-size; }
body:has(.ld-hero) .banner-links a.play { display: none; }   /* the page's own button says it */
.ld-hero { position: relative; isolation: isolate; display: grid; justify-items: center; text-align: center;
    margin: -20px 0 0; padding: 72px 0 64px; color: #ecdcb8; }
.ld-hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 50cqw); right: calc(50% - 50cqw); z-index: -1;
    background: radial-gradient(ellipse 40% 70% at 50% 30%, rgba(201, 120, 50, .28), transparent 70%), linear-gradient(180deg, #2a1d14, #140e09); }
.ld-emblem { width: 132px; height: 132px; margin-bottom: 22px; border-radius: 22.5%;
    box-shadow: 0 0 0 2px rgba(201, 162, 74, .3), 0 18px 44px rgba(0, 0, 0, .55), 0 0 60px rgba(220, 130, 50, .2); }
.ld-title { margin: 0; font: 700 3.2rem/1.05 var(--game-font); font-variant: small-caps; letter-spacing: .03em; color: #f6e8c4;
    text-shadow: 0 2px 0 #000; }
.ld-title::after { display: none; }
.ld-lead { margin: 12px 0 30px; font-size: 1.12rem; color: #cdbb93; letter-spacing: .01em; }
.ld-play { min-width: 220px; text-align: center; }
.ld-login { margin: 16px 0 0; font-size: .88rem; color: #a8987a; }
.ld-login a { color: #e2c06a; font-weight: 700; }

.ld-shot { max-width: 880px; margin: 48px auto 0; border-radius: 14px; overflow: hidden; box-shadow: 0 14px 40px rgba(30, 20, 10, .25); }
.ld-shot .scene { display: block; width: 100%; height: auto; border-radius: 0; }
.ld-shot .badge-link, .ld-shot .hint-up { display: none; }

.ld-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; max-width: 880px; margin: 44px auto 0; }
.ld-point { text-align: center; }
.ld-point .art { width: 48px; height: 48px; }
.ld-point h2 { margin: 6px 0 4px; font: 700 1.2rem var(--game-font); font-variant: small-caps; letter-spacing: .04em; }
.ld-point h2::after { display: none; }
.ld-point p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }

.ld-world { margin: 44px 0 0; text-align: center; font-size: .82rem; color: var(--muted); letter-spacing: .02em; }
.ld-world + .landing-footer { margin-top: 10px; }

@media (max-width: 640px) {
    .ld-hero { padding: 48px 0 44px; }
    .ld-emblem { width: 104px; height: 104px; margin-bottom: 18px; }
    .ld-title { font-size: 2.4rem; }
    .ld-lead { font-size: 1rem; margin-bottom: 26px; }
    .ld-play { width: 100%; box-sizing: border-box; }
    .ld-shot { margin: 32px -16px 0; border-radius: 0; box-shadow: none; }
    .ld-points { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 30px; }
    .ld-point { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; text-align: left; }
    .ld-point .art { grid-row: span 2; width: 44px; height: 44px; }
    .ld-point h2 { margin: 0; font-size: 1.05rem; }
    .ld-point p { font-size: .88rem; }
    .ld-world { margin-top: 30px; }
}