/* ============================================================
   Commander of Armies — dark fantasy / medieval theme
   ============================================================ */
:root {
    /* Schemers — neon-noir underworld palette. Variable names kept for compatibility;
       "gold" is now the neon-blue primary, "magic" the cyan accent, "ember" the neon red. */
    --stone-900: #07080b;
    --stone-800: #0d1016;
    --stone-700: #151a23;
    --stone-600: #232a36;
    --parchment: #d9dee8;
    --parchment-dim: #97a2b4;
    --gold: #3da9fc;
    --gold-bright: #7fc8ff;
    --ember: #ff4d4d;
    --ember-glow: #ff8585;
    --magic: #22d3ee;
    --magic-glow: #67e8f9;
    --blood: #c01f2f;
    --ok: #4ade80;
    --bad: #f87171;
    --border: #2a3340;
}

* { box-sizing: border-box; }

/* Ambient ember/particle canvas sits behind everything and never blocks clicks. */
#tribes-embers {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}
/* Keep all real content above the particle layer. */
.app-shell, .auth-wrap, #blazor-error-ui { position: relative; z-index: 1; }

html, body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, 'Segoe UI', sans-serif;
    color: var(--parchment);
    background:
        radial-gradient(circle at 18% -10%, rgba(61,169,252,.12), transparent 45%),
        radial-gradient(circle at 92% 0%, rgba(255,77,77,.10), transparent 42%),
        linear-gradient(160deg, #06070a 0%, #0a0d13 45%, #0e1218 100%);
    background-attachment: fixed;
}

h1, h2, h3, h4, .display, .title {
    font-family: 'Oswald', 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--gold-bright);
    text-shadow: 0 2px 10px rgba(61,169,252,.25), 0 2px 6px rgba(0,0,0,.6);
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

/* ---- Panels (parchment-on-stone cards) ---- */
.panel {
    background:
        linear-gradient(180deg, rgba(35,42,54,.55), rgba(13,16,22,.85));
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,.5), inset 0 1px 0 rgba(127,200,255,.08);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.1rem;
}
.panel > h2, .panel > h3 { margin-top: 0; }
.panel-title {
    display: flex; align-items: center; gap: .5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: .5rem; margin-bottom: .9rem;
}

/* ---- Buttons ---- */
.btn-fantasy {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #06121f;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border: 1px solid #1f6fb0;
    border-radius: 7px;
    padding: .4rem .9rem;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
    box-shadow: 0 3px 0 #1b5e96, 0 4px 12px rgba(0,0,0,.5);
}
.btn-fantasy:hover { filter: brightness(1.08); box-shadow: 0 3px 0 #1b5e96, 0 6px 18px rgba(61,169,252,.45); }
.btn-fantasy:active { transform: translateY(2px); box-shadow: 0 1px 0 #1b5e96; }
.btn-fantasy:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; }
/* Ghost = de-emphasized / unselected: outlined, muted. The solid (non-ghost) button reads as "selected". */
.btn-fantasy.ghost {
    background: transparent; color: var(--parchment-dim);
    border-color: var(--border); box-shadow: none;
}
.btn-fantasy.ghost:hover { filter: none; color: var(--gold-bright); border-color: var(--gold-bright); box-shadow: none; }

.btn-war {
    background: linear-gradient(180deg, var(--ember-glow), var(--ember));
    color: #fff; border-color: #7a1f1f; box-shadow: 0 3px 0 #6e1818, 0 0 18px rgba(255,77,77,.35);
}
.btn-war:hover { box-shadow: 0 3px 0 #6e1818, 0 0 26px rgba(255,77,77,.6); }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.field label { font-family: 'Oswald', sans-serif; font-size: .85rem; color: var(--parchment-dim); }
input, select {
    background: rgba(9,11,16,.7);
    border: 1px solid var(--border);
    color: var(--parchment);
    border-radius: 6px;
    padding: .45rem .6rem;
    font-family: inherit; font-size: 1rem;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(61,169,252,.25); }
.input-sm { width: 5.5rem; }
.remember { display: flex; align-items: center; gap: .5rem; margin: 0 0 .8rem; color: var(--parchment-dim); font-family: 'Oswald', sans-serif; font-size: .9rem; cursor: pointer; }
.remember input { width: auto; }

/* ---- Stat / resource chips ---- */
.stat { display: flex; align-items: center; gap: .45rem; }
.stat .v { color: var(--gold-bright); font-weight: 600; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(9,11,16,.6); border: 1px solid var(--border);
    border-radius: 999px; padding: .25rem .7rem; font-size: .95rem;
}
.chip .icon { font-size: 1.1rem; }
.gold .v, .gold .icon { color: var(--gold-bright); }
.magic .v, .magic .icon { color: var(--magic-glow); }
.ember .v, .ember .icon { color: var(--ember-glow); }

/* ---- Tables ---- */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: .5rem .6rem; border-bottom: 1px solid rgba(60,70,84,.4); text-align: left; }
table.grid th { font-family: 'Oswald', sans-serif; color: var(--parchment-dim); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
table.grid tr:hover td { background: rgba(61,169,252,.06); }

/* ---- Messages ---- */
.msg-ok { color: var(--ok); }
.msg-bad { color: var(--bad); }

/* ---- Live countdown ---- */
.countdown {
    font-variant-numeric: tabular-nums; /* fixed-width digits so the clock doesn't jitter */
    font-feature-settings: "tnum";
    white-space: nowrap;
    letter-spacing: .02em;
}
.countdown::before { content: "⏳ "; }
.countdown-done { color: var(--bad); }
.countdown-done::before { content: "🔒 "; }

/* ---- Toast notifications (top-center) ---- */
.toast-host {
    position: fixed; top: .8rem; left: 50%; transform: translateX(-50%);
    z-index: 80; display: flex; flex-direction: column; gap: .5rem;
    align-items: center; width: max-content; max-width: 92vw; pointer-events: none;
}
.toast {
    position: relative; pointer-events: auto; overflow: hidden;
    display: flex; align-items: center; gap: .6rem;
    min-width: 16rem; max-width: 92vw;
    padding: .7rem 2.2rem .7rem .9rem;
    border-radius: 10px; border: 1px solid var(--border);
    border-inline-start: 4px solid var(--gold);
    background: linear-gradient(180deg, rgba(28,33,44,.98), rgba(15,18,24,.98));
    box-shadow: 0 8px 26px rgba(0,0,0,.55);
    font-weight: 600; color: var(--parchment);
    animation: toast-in .28s cubic-bezier(.2,.9,.3,1.2);
}
.toast-success { border-inline-start-color: var(--ok); }
.toast-error   { border-inline-start-color: var(--bad); animation: toast-in .28s cubic-bezier(.2,.9,.3,1.2), toast-shake .4s ease .28s; }
.toast-info    { border-inline-start-color: var(--gold-bright, #3da9fc); }
.toast-icon {
    flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .9rem; color: #0c0f14; font-weight: 800;
}
.toast-success .toast-icon { background: var(--ok); }
.toast-error   .toast-icon { background: var(--bad); color: #fff; }
.toast-info    .toast-icon { background: var(--gold-bright, #3da9fc); }
.toast-msg { line-height: 1.3; }
.toast-close {
    position: absolute; top: .35rem; inset-inline-end: .45rem;
    background: none; border: none; color: var(--parchment-dim); cursor: pointer;
    font-size: .9rem; line-height: 1; padding: .1rem .25rem;
}
.toast-close:hover { color: var(--parchment); }
.toast-bar {
    position: absolute; bottom: 0; inset-inline-start: 0; height: 3px;
    background: currentColor; opacity: .5; width: 100%;
    transform-origin: left; animation-name: toast-bar; animation-timing-function: linear;
}
.toast-success .toast-bar { color: var(--ok); }
.toast-error   .toast-bar { color: var(--bad); }
.toast-info    .toast-bar { color: var(--gold-bright, #3da9fc); }
[dir="rtl"] .toast-bar { transform-origin: right; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }
@media (prefers-reduced-motion: reduce) {
    .toast, .toast-error { animation: none; }
    .toast-bar { animation: none; opacity: .35; }
}
.news-good { color: var(--ok); }
.news-bad { color: var(--bad); }
.msg { min-height: 1.2rem; font-weight: 600; }

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; flex: 0 0 220px;
    background: linear-gradient(180deg, rgba(13,16,22,.96), rgba(7,9,13,.98));
    border-right: 1px solid var(--border);
    padding: 1rem .75rem;
}
.brand { font-family: 'Oswald', sans-serif; font-size: 1.15rem; color: var(--gold-bright); text-align: center; padding: .5rem 0 1rem; border-bottom: 1px solid var(--border); margin-bottom: .8rem; }
.brand small { display:block; font-size:.7rem; color: var(--parchment-dim); letter-spacing:.15em; }
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .7rem; margin: .15rem 0; border-radius: 7px;
    color: var(--parchment); font-family: 'Oswald', sans-serif; font-size: .95rem;
}
.nav-link:hover { background: rgba(61,169,252,.1); color: var(--gold-bright); }
.nav-link.active { background: linear-gradient(90deg, rgba(61,169,252,.22), transparent); color: var(--gold-bright); border-left: 3px solid var(--gold); }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.2rem 1.6rem; width: 100%; box-sizing: border-box; }

/* ---- Top resource bar ---- */
.topbar {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .6rem 1.6rem;
    background: linear-gradient(180deg, rgba(21,26,35,.9), rgba(13,16,22,.92));
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.topbar .tribe { font-family: 'Oswald', sans-serif; color: var(--gold-bright); margin-inline-end: auto; }
.turns { color: var(--ember-glow); font-weight: 700; }

/* ---- Public promo portal (/welcome) ---- */
.portal { max-width: 980px; margin: 0 auto; padding: 2.2rem 1.2rem 3.2rem; }
.portal-hero { text-align: center; }
.portal-hero-img { width: min(380px, 82%); height: auto; border-radius: 16px; box-shadow: 0 10px 34px rgba(0,0,0,.55); }
.portal-tagline { font-family: 'Oswald', sans-serif; font-size: 1.6rem; color: var(--parchment); margin: .9rem 0 .6rem; }
.portal-lead { max-width: 640px; margin: 0 auto 1.3rem; color: var(--parchment-dim); line-height: 1.55; }
.portal-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.portal-cta-primary { font-size: 1.05rem; padding: .6rem 1.4rem; }
.portal-section-title { text-align: center; margin: 2.4rem 0 1rem; color: var(--gold-bright); font-family: 'Oswald', sans-serif; }
.portal-features { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.portal-feature { text-align: center; }
.portal-feature-icon { font-size: 2rem; line-height: 1; margin-bottom: .3rem; }
.portal-feature h3 { margin: .2rem 0 .3rem; }
.portal-closing { text-align: center; margin-top: 2.6rem; }
.portal-closing h2 { color: var(--gold-bright); margin-bottom: .9rem; }
@media (max-width: 760px) {
    .portal-features { grid-template-columns: 1fr; }
    .portal-title { font-size: 2.1rem; }
    .portal-cta .btn-fantasy { width: 100%; max-width: 22rem; }
}

/* ---- Auth screens ---- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { font-size: 1.5rem; }

/* ---- Grid helpers ---- */
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.1rem; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1.1rem; }
@media (max-width: 900px) { .row2, .row3 { grid-template-columns: 1fr; } .sidebar { display:none; } }

/* ---- Tribe name tag (clickable) ---- */
.tribe-tag {
    display: inline-flex; align-items: center; gap: .4rem;
    background: linear-gradient(180deg, rgba(35,42,54,.7), rgba(13,16,22,.7));
    border: 1px solid var(--border); border-radius: 999px;
    padding: .12rem .6rem; cursor: pointer; font-family: 'EB Garamond', serif;
    color: var(--parchment); font-size: .98rem; line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.tribe-tag:hover { border-color: var(--gold); color: var(--gold-bright); box-shadow: 0 0 10px rgba(61,169,252,.25); }
.tribe-tag-id { color: var(--parchment-dim); font-size: .82rem; }
.tribe-tag:hover .tribe-tag-id { color: var(--gold); }

/* ---- Tribe card ---- */
.tribe-card { max-width: 420px; width: 92%; }
.tribe-card-head { display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.tribe-card-crest { font-size: 2rem; }
.tribe-card-ally { color: var(--gold-bright); font-size: .85rem; margin-top: .15rem; }
.tribe-card-artifact { color: #ffd24a; font-size: .85rem; margin-top: .15rem; }
.tribe-card-protected { color: #5fd0a0; font-size: .85rem; margin-top: .15rem; }
.tribe-card-council { color: #d4af37; font-size: .85rem; margin-top: .15rem; }

/* New-family protection shield (rankings + family card) */
.protection-icon {
    cursor: help;
    font-size: .95em;
    vertical-align: -0.05em;
    margin-inline-start: .25rem;
    filter: drop-shadow(0 0 2px rgba(95, 208, 160, .6));
}
/* Active City Council decree marker (rankings + family card) */
.council-icon {
    cursor: help;
    font-size: .95em;
    vertical-align: -0.05em;
    margin-inline-start: .25rem;
    filter: drop-shadow(0 0 2px rgba(212, 175, 55, .6));
}

/* ---- Artifacts ---- */
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.artifact-card {
    display: flex; flex-direction: column; gap: .4rem;
    background: rgba(9,11,16,.55); border: 1px solid var(--border);
    border-radius: 12px; padding: .45rem; transition: border-color .2s ease, box-shadow .2s ease;
}
.artifact-card.owned { border-color: #ffd24a; box-shadow: 0 0 14px rgba(255,210,74,.25); }
.artifact-card.signet.owned { border-color: #ffb000; box-shadow: 0 0 20px rgba(255,176,0,.45); }
.artifact-img { width: 100%; height: auto; display: block; border-radius: 10px; }
.artifact-card.locked .artifact-img { filter: grayscale(1) brightness(.55); }
.artifact-foot { display: flex; flex-direction: column; gap: .1rem; }
.artifact-name { font-family: 'Oswald', sans-serif; font-size: .95rem; }
.artifact-buff { font-size: .78rem; }
.artifact-buff.ok { color: #ffd24a; font-weight: 600; }

/* artifact / alliance markers in tables (rankings) */
.tag-artifact { color: #ffd24a; }
.tag-ally { color: var(--gold-bright); font-size: .8rem; }
/* small inline artifact icon (replaces the ✨ emoji) */
.artifact-icon { height: 1.15em; width: auto; vertical-align: -0.22em; border-radius: 3px; }

/* ---- Alliances ---- */
.ally-head { display: flex; align-items: center; gap: .8rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.ally-crest { font-size: 2rem; }
.ally-crest .family-logo { width: 3.2rem; height: 3.2rem; }
.ally-logo-sm { width: 1.8rem; height: 1.8rem; border-radius: 4px; object-fit: cover; }
.ally-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; }
.ally-invite { display: inline-flex; gap: .35rem; align-items: center; }
.ally-invite-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.ally-invite-row:last-child { border-bottom: none; }
.file-btn { cursor: pointer; }
.file-btn input[type=file] { display: none; }

/* ---- Battle modal ---- */
.modal-veil { position: fixed; inset: 0; background: rgba(0,0,0,.7); display:flex; align-items:center; justify-content:center; z-index: 50; }
.modal-card { max-width: 480px; width: 92%; animation: rise .25s ease; }
@keyframes rise { from { opacity:0; transform: translateY(18px) scale(.97);} to {opacity:1; transform:none;} }
.victory { color: var(--gold-bright); text-shadow: 0 0 18px rgba(127,200,255,.6); }
.defeat { color: var(--bad); }
.fallen-panel {
    border-color: #7a2f12;
    box-shadow: 0 0 26px rgba(163,32,31,.35), inset 0 0 40px rgba(120,0,0,.25);
    /* Noir backdrop — dark behind the text on the left, fading clear to the right so the scene shows. */
    background-image:
        linear-gradient(to right, rgba(9,11,16,.9) 0%, rgba(9,11,16,.5) 45%, rgba(9,11,16,.15) 100%),
        url("img/back-message.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ---- Language switcher ---- */
.lang-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .9rem; font-size: .85rem; color: var(--parchment-dim); }
.lang-switch .lang-link { padding: .15rem .45rem; border: 1px solid var(--border); border-radius: 6px; color: var(--parchment-dim); }
.lang-switch .lang-link:hover { color: var(--gold-bright); border-color: var(--gold); }
.lang-switch .lang-link.active { color: #1a150e; background: linear-gradient(180deg, var(--gold-bright), var(--gold)); border-color: #7a5d1c; }
.lang-switch-corner { position: absolute; top: .8rem; right: 1rem; z-index: 5; }
.lang-switch-corner .lang-switch { margin-top: 0; }
.nav-emoji { display: inline-block; width: 1.1em; text-align: center; }

/* ---- New-player guide banner (Headquarters) ---- */
.guide-welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem;
    border-color: var(--gold); box-shadow: 0 0 16px rgba(212,175,55,.18); }
.guide-welcome-text { flex: 1 1 16rem; }
.guide-welcome-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Game Guide page ---- */
.guide-layout { display: grid; grid-template-columns: 13rem 1fr; gap: 1.2rem; align-items: start; }
.guide-toc { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .15rem;
    background: rgba(9,11,16,.55); border: 1px solid var(--border); border-radius: 12px; padding: .6rem; }
.guide-toc a { padding: .3rem .55rem; border-radius: 6px; color: var(--parchment-dim); font-size: .9rem; }
.guide-toc a:hover { color: var(--gold-bright); background: rgba(255,255,255,.04); }
.guide-body { display: flex; flex-direction: column; gap: 1rem; }
.guide-body section { scroll-margin-top: 1rem; }
.guide-body h2 { margin-top: 0; }
.guide-body ul, .guide-body ol { margin: .3rem 0 .3rem 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.guide-artifact-icon { height: 1.2em; width: auto; vertical-align: -0.25em; border-radius: 3px; }
@media (max-width: 860px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc { position: static; flex-flow: row wrap; } }

/* ---- Right-to-left support ---- */
[dir="rtl"] .nav-link.active { border-left: none; border-right: 3px solid var(--gold); }
[dir="rtl"] .nav-link.active { background: linear-gradient(270deg, rgba(61,169,252,.22), transparent); }
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] table.grid th, [dir="rtl"] table.grid td { text-align: right; }

.blazor-error-boundary { background: var(--blood); color: #fff; padding: 1rem; }
.blazor-error-boundary::after { content: "A dark omen — an error has occurred."; }
.validation-message, .invalid { color: var(--bad); }
.muted { color: var(--parchment-dim); }

/* ---- Schemers logo ---- */
.auth-logo {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: .2rem auto 1rem;
    border-radius: 10px;
    filter: drop-shadow(0 6px 22px rgba(61,169,252,.25));
}
.brand-logo {
    display: block;
    width: 100%;
    max-width: 188px;
    height: auto;
    margin: 0 auto .35rem;
    border-radius: 6px;
}

/* ---- Schemers SVG icons (sprite glyphs, inherit text color via currentColor) ---- */
.game-icon {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.18em;
    flex: 0 0 auto;
    display: inline-block;
}
.nav-link .game-icon { width: 1.25em; height: 1.25em; }
.chip .game-icon, .stat .game-icon { width: 1.1em; height: 1.1em; }
.brand .game-icon { width: 1.4em; height: 1.4em; }

/* ---- Unit portraits (character art beside each crew type) ---- */
.crew-cell { display: flex; align-items: center; gap: .7rem; }
.unit-portrait {
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
    object-fit: cover;
    object-position: center top;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.35);
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ---- Money Operations ladder ---- */
.collect-options { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .4rem; }
.collect-options .btn-fantasy { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 9rem; }
.collect-sub { font-size: .72rem; opacity: .85; font-weight: 600; }

.ladder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.ladder-card {
    display: flex; flex-direction: column; gap: .4rem;
    background: rgba(9,11,16,.55);
    border: 1px solid var(--border);
    border-radius: 12px; padding: .45rem;
    transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}
/* New art is a complete, full-bleed card — show it whole. */
.ladder-img {
    width: 100%; height: auto; display: block; border-radius: 10px;
}
.ladder-card.locked .ladder-img { filter: grayscale(.35) brightness(.8); }
.ladder-card.next { border-color: var(--gold-bright, #3da9fc); box-shadow: 0 0 16px rgba(61,169,252,.25); }
.ladder-card.open { border-color: rgba(74,222,128,.45); }
.ladder-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2rem; }
.ladder-foot .btn-fantasy { padding: .3rem .5rem; font-size: .78rem; flex: 1; }
.ladder-card .ladder-cash { color: #ffd24a; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.ladder-badge { font-size: .8rem; padding: .25rem .5rem; border-radius: 6px; }
.ladder-badge.ok { color: #4ade80; background: rgba(74,222,128,.12); }
.ladder-badge.locked { color: #8b97a7; }
/* Reveal glow when a business is opened (on the container, so it won't fight the image zoom) */
.ladder-card.just-opened { animation: ladder-unlock .8s ease; }
@keyframes ladder-unlock {
    0%   { box-shadow: 0 0 0 0 rgba(255,210,74,0); }
    35%  { box-shadow: 0 0 26px 4px rgba(255,210,74,.6); }
    100% { box-shadow: 0 0 0 0 rgba(255,210,74,0); }
}

/* ---- Underground community board ---- */
.ug-post { padding: .7rem .9rem; }
.ug-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .35rem; }
.ug-cat {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
    border: 1px solid; border-radius: 999px; padding: .1rem .55rem;
    color: #9fb3c8; /* per-topic color set below; border follows currentColor */
}
.ug-cat-general    { color: #9fb3c8; }
.ug-cat-recruiting { color: #4ade80; }
.ug-cat-alliance   { color: #3da9fc; }
.ug-cat-services   { color: #22d3ee; }
.ug-cat-trade      { color: #ffd24a; }
.ug-cat-trash-talk { color: #ff5a5a; }
.ug-time { margin-left: auto; font-size: .85rem; }
.ug-body { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* Underground action buttons — pill chips that fit the neon-noir theme */
.ug-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    color: var(--parchment-dim, #9fb3c8);
    border-radius: 999px; padding: .28rem .8rem;
    font-family: 'Oswald', sans-serif; font-size: .82rem; letter-spacing: .03em;
    cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ug-btn .game-icon { width: 1em; height: 1em; }
.ug-btn:hover { color: #fff; border-color: var(--gold-bright, #3da9fc); background: rgba(61,169,252,.14); }
.ug-btn-msg:hover { color: #fff; border-color: var(--magic, #22d3ee); background: rgba(34,211,238,.14); }
/* small icon-only variant (reply rows) */
.ug-iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.7rem; height: 1.7rem; border-radius: 8px;
    border: 1px solid transparent; background: rgba(255,255,255,.04);
    color: var(--parchment-dim, #9fb3c8); cursor: pointer; transition: all .15s ease;
}
.ug-iconbtn .game-icon { width: 1em; height: 1em; }
.ug-iconbtn:hover { color: #fff; border-color: var(--magic, #22d3ee); }
.ug-iconbtn.ug-del:hover { color: var(--ember, #ff5a5a); border-color: rgba(255,90,90,.45); }

/* Replies + actions */
.ug-actions { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.ug-replies { margin: .6rem 0 0 1.2rem; border-left: 2px solid var(--border); padding-left: .9rem; display: flex; flex-direction: column; gap: .5rem; }
.ug-reply-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .2rem; }
.ug-reply-body { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ug-replybox { margin-top: .5rem; }

/* ---- Admin player-row actions: tidy equal-size 2×2 grid ---- */
.admin-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
    min-width: 14rem;
}
.admin-actions .btn-fantasy {
    margin: 0; width: 100%;
    display: inline-flex; align-items: center; justify-content: center;
    padding: .35rem .5rem; font-size: .8rem; text-align: center; line-height: 1.2;
    box-sizing: border-box;
}

/* ---- Admin impersonation banner ---- */
.impersonate-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    background: linear-gradient(90deg, rgba(255,159,67,.18), rgba(255,159,67,.06));
    border: 1px solid rgba(255,159,67,.5); color: #ffcf9a;
    border-radius: 10px; padding: .5rem .9rem; margin-bottom: .8rem;
}
.impersonate-bar .btn-fantasy { padding: .3rem .8rem; font-size: .82rem; }

/* Image-based icon (e.g. the gambling .ico), sized to sit like the SVG game-icons */
.img-icon { width: 1.2em; height: 1.2em; object-fit: contain; vertical-align: -0.22em; }
h1 .img-icon { width: 1.1em; height: 1.1em; vertical-align: -0.12em; }
.nav-link .img-icon { width: 1.3em; height: 1.3em; }

/* ---- Gambling / The Bookie ---- */
.sport-tabs { display: flex; gap: .5rem; margin: .2rem 0 1rem; flex-wrap: wrap; }
.sport-tab {
    font-family: 'Oswald', sans-serif; font-size: .95rem; letter-spacing: .02em;
    padding: .45rem 1.1rem; border-radius: 999px; cursor: pointer;
    background: rgba(9,11,16,.55); border: 1px solid var(--border); color: inherit;
    transition: border-color .15s ease, background .15s ease;
}
.sport-tab:hover { border-color: var(--gold-bright, #3da9fc); }
.sport-tab.active { border-color: #ffd24a; background: rgba(255,210,74,.12); color: #ffd24a; }

.bet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .6rem;
}
.bet-card {
    display: flex; flex-direction: column; gap: .2rem; text-align: left;
    background: rgba(9,11,16,.55); border: 1px solid var(--border);
    border-radius: 10px; padding: .55rem .7rem; cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
    color: inherit; font: inherit;
}
.bet-card:hover:not(.off) { border-color: var(--gold-bright, #3da9fc); transform: translateY(-1px); }
.bet-card.selected { border-color: #ffd24a; box-shadow: 0 0 14px rgba(255,210,74,.3); }
.bet-card.off { opacity: .5; cursor: not-allowed; }
.bet-head { display: flex; align-items: center; gap: .5rem; }
.bet-crest { width: 1.9rem; height: 1.9rem; object-fit: contain; flex: 0 0 auto; }
.bet-team { font-family: 'Oswald', sans-serif; font-size: 1rem; }
.bet-fixture { font-size: .85rem; }
.bet-when { font-size: .78rem; }
.bet-picks { display: flex; gap: .4rem; flex-wrap: wrap; }
.bet-picks .btn-fantasy { flex: 1; min-width: 6rem; }
.bet-badge { font-size: .8rem; padding: .15rem .5rem; border-radius: 6px; white-space: nowrap; }
.bet-badge.bet-pending { color: #9fb3c8; background: rgba(159,179,200,.12); }
.bet-badge.bet-won { color: #4ade80; background: rgba(74,222,128,.14); }
.bet-badge.bet-lost { color: #ff5a5a; background: rgba(255,90,90,.14); }
.bet-badge.bet-void { color: #ff9f43; background: rgba(255,159,67,.14); }

/* ---- War Room: guided "Plan Your Assault" ---- */
.field-label { display: block; font-size: .8rem; color: var(--muted, #9fb3c8); margin: .8rem 0 .35rem; letter-spacing: .02em; }
.attack-units { display: flex; gap: .6rem; flex-wrap: wrap; }
.attack-unit {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    width: 8.2rem; padding: .5rem .4rem; cursor: pointer; color: inherit;
    border: 2px solid var(--line, #2a3550); border-radius: 12px; background: rgba(255,255,255,.02);
    transition: transform .1s, border-color .1s;
}
.attack-unit:hover { transform: translateY(-2px); border-color: #3da9fc; }
.attack-unit.selected { border-color: #ffd24a; background: rgba(255,210,74,.14); box-shadow: 0 0 10px rgba(255,210,74,.3); }
.attack-unit.empty { opacity: .5; }
.attack-unit-img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.attack-unit-name { font-weight: 700; font-size: .9rem; }
.attack-unit-role { font-size: .72rem; color: var(--muted, #9fb3c8); text-align: center; line-height: 1.1; }
.attack-unit-have { font-size: .75rem; color: var(--gold-bright, #3da9fc); }
.attack-targets { display: flex; gap: .5rem; flex-wrap: wrap; }
.attack-target {
    cursor: pointer; color: inherit; font-weight: 600; font-size: .9rem;
    padding: .45rem .8rem; border: 2px solid var(--line, #2a3550); border-radius: 10px;
    background: rgba(255,255,255,.02); transition: border-color .1s, background .1s;
}
.attack-target:hover { border-color: #3da9fc; }
.attack-target.selected { border-color: #ffd24a; background: rgba(255,210,74,.14); color: #ffd24a; }
.attack-star { margin-inline-end: .25rem; }

/* ---- Random-event pop-up (image + details, shown once on login) ---- */
.event-popup { max-width: 440px; text-align: center; }
.event-popup-img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 8px 26px rgba(0,0,0,.5); }
.event-popup-title { margin: .7rem 0 .3rem; color: var(--gold-bright); font-family: 'Oswald', sans-serif; }
.event-popup-body { margin: 0; font-size: 1.05rem; line-height: 1.5; }

/* ---- Total-victory banner (enemy family wiped out) ---- */
.victory-enemy { position: relative; margin: -0.4rem -0.4rem .8rem; border-radius: 10px; overflow: hidden; }
.victory-enemy-img { display: block; width: 100%; height: auto; }
.victory-enemy-banner {
    position: absolute; inset-inline: 0; bottom: 0;
    padding: .5rem .8rem; text-align: center; font-weight: 700; font-size: 1.15rem;
    background: linear-gradient(180deg, rgba(6,18,31,0), rgba(6,18,31,.85));
    text-shadow: 0 2px 6px rgba(0,0,0,.8);
}

/* ---- Rock-Paper-Scissors ---- */
.rps-cta { display: inline-flex; align-items: center; gap: .4rem; margin: .2rem 0 .8rem; }
.rps-moves { display: flex; gap: .6rem; flex-wrap: wrap; }
.rps-move {
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    padding: .4rem; border: 2px solid var(--line, #2a3550); border-radius: 12px;
    background: rgba(255,255,255,.02); cursor: pointer; transition: transform .1s, border-color .1s;
    color: inherit; font-weight: 600;
}
.rps-move img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }
.rps-move:hover { transform: translateY(-2px); border-color: #3da9fc; }
.rps-move.selected { border-color: #ffd24a; background: rgba(255,210,74,.14); box-shadow: 0 0 10px rgba(255,210,74,.3); }
.rps-move-mini { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; vertical-align: middle; }
.rps-invite {
    border: 1px solid var(--line, #2a3550); border-radius: 10px; padding: .6rem .8rem;
    margin-bottom: .6rem; background: rgba(255,255,255,.02);
    display: flex; flex-direction: column; gap: .5rem;
}
.rps-invite-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.rps-invite-actions { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.btn-fantasy.btn-sm { padding: .25rem .7rem; font-size: .82rem; box-shadow: 0 2px 0 #1b5e96, 0 3px 8px rgba(0,0,0,.4); }
.rps-invite-head .btn-sm { margin-inline-start: auto; }

/* ---- Family logo ---- */
.family-logo {
    width: 72px; height: 72px; object-fit: cover;
    border-radius: 12px; border: 1px solid var(--border); display: block;
}
.tribe-card-crest .family-logo { width: 3.6rem; height: 3.6rem; }

/* ---- Icon colors (per-icon, thematic) — single-color glyphs tinted via currentColor ---- */
.game-icon { filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); }

/* palette */
.icon-res-cash, .icon-op-front-business, .icon-nav-city-council, .icon-nav-rankings,
.icon-res-power, .icon-res-rank, .icon-unit-made-men, .icon-act-decree-investigate,
.icon-act-announcement, .icon-state-legend-crown, .icon-state-legend-star, .icon-nav-city-legends,
.icon-battle-victory { color: #ffd24a; }                 /* gold */

/* Keep the top-bar Cash icon yellow (beats the .gold .icon chip override). */
.chip.gold .icon-res-cash { color: #ffd24a; }

.icon-res-loyalty, .icon-op-neighborhood-hub, .icon-nav-headquarters, .icon-nav-messages,
.icon-res-family, .icon-act-reply, .icon-doctrine-protection, .icon-news-defense,
.icon-state-safehouse, .icon-state-safehouse-alt, .icon-admin-dashboard
{ color: #3da9fc; }                                       /* blue */

.icon-res-influence, .icon-op-backroom-office, .icon-nav-city, .icon-act-informants,
.icon-act-language, .icon-unit-informants, .icon-news-spy, .icon-admin-families
{ color: #22d3ee; }                                       /* cyan */

.icon-res-territory, .icon-nav-politics, .icon-act-recruit, .icon-doctrine-expansion,
.icon-state-active, .icon-state-active-ok, .icon-act-decree-favor, .icon-admin-bots
{ color: #4ade80; }                                       /* green */

.icon-nav-war-room, .icon-nav-console, .icon-act-covert-hit, .icon-doctrine-domination,
.icon-unit-heavy-crews, .icon-news-attack, .icon-battle-defeat-blood, .icon-state-collapsed-home,
.icon-admin-console { color: #ff5a5a; }                   /* red */

.icon-res-turns, .icon-unit-street-enforcers, .icon-news-spied-on, .icon-state-warning,
.icon-state-rebuild { color: #ff9f43; }                   /* amber */

.icon-nav-doctrines { color: #a78bfa; }                   /* purple */
.icon-unit-hitmen { color: #e0314f; }                     /* crimson */

.icon-res-family-id, .icon-nav-crew, .icon-nav-news, .icon-nav-settings, .icon-unit-associates,
.icon-act-edit, .icon-admin-edit, .icon-admin-back, .icon-state-dismiss
{ color: #9fb3c8; }                                       /* steel */

.icon-news-death, .icon-battle-collapse, .icon-state-collapsed { color: #8b97a7; } /* gray */

/* ---- Nav unread badge (News / Messages) ---- */
.nav-badge {
    margin-left: auto;
    background: var(--ember);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: .7rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(255,77,77,.55);
}

/* =====================================================================
   MOBILE (phones) — everything below is gated by `html.is-mobile`, set
   from the User-Agent in App.razor. The desktop layout is never affected.
   ===================================================================== */

/* Desktop never shows the mobile chrome. */
html:not(.is-mobile) .mobile-topbar,
html:not(.is-mobile) .mobile-drawer,
html:not(.is-mobile) .mobile-scrim { display: none !important; }

html.is-mobile .app-shell { display: block; }
html.is-mobile .sidebar { display: none; }
html.is-mobile .content { padding: .7rem; }

/* --- Top app bar + slide-in drawer --- */
html.is-mobile .mobile-topbar {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .7rem;
    background: linear-gradient(180deg, rgba(13,16,22,.98), rgba(7,9,13,.98));
    border-bottom: 1px solid var(--border);
}
html.is-mobile .mobile-burger {
    font-size: 1.5rem; line-height: 1; background: none; border: none;
    color: var(--gold-bright); cursor: pointer; min-width: 44px; min-height: 44px;
}
html.is-mobile .mobile-brand-logo { height: 30px; width: auto; }

.mobile-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); }
.mobile-drawer {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 75;
    width: min(82vw, 320px); max-height: 100vh; overflow-y: auto; padding: .8rem .7rem;
    background: linear-gradient(180deg, rgba(13,16,22,.99), rgba(7,9,13,1));
    border-inline-end: 1px solid var(--border);
    transform: translateX(-105%); transition: transform .22s ease;
}
[dir="rtl"] .mobile-drawer { transform: translateX(105%); }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.mobile-drawer-head .brand { font-family: 'Oswald', sans-serif; color: var(--gold-bright); font-size: 1.1rem; border: none; padding: 0; margin: 0; }
.mobile-close { background: none; border: none; color: var(--parchment); font-size: 1.2rem; cursor: pointer; min-width: 44px; min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .mobile-drawer { transition: none; } }

/* --- Compact, horizontally-scrollable resource bar --- */
html.is-mobile .topbar {
    flex-wrap: nowrap; overflow-x: auto; gap: .4rem;
    padding: .45rem .6rem; -webkit-overflow-scrolling: touch;
}
html.is-mobile .topbar .tribe { margin-inline-end: .4rem; font-size: .9rem; white-space: nowrap; }
html.is-mobile .topbar .chip { flex: 0 0 auto; font-size: .8rem; }

/* --- Wide data tables -> stacked label/value cards (player pages opt in via `.mobile-cards`) --- */
html.is-mobile table.grid.mobile-cards,
html.is-mobile table.grid.mobile-cards tbody,
html.is-mobile table.grid.mobile-cards tr,
html.is-mobile table.grid.mobile-cards td { display: block; width: 100%; }
html.is-mobile table.grid.mobile-cards thead { display: none; }
html.is-mobile table.grid.mobile-cards tr {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: .6rem; padding: .35rem .7rem; background: rgba(255,255,255,.02);
}
html.is-mobile table.grid.mobile-cards td {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    border: none; padding: .4rem 0; text-align: end;
}
html.is-mobile table.grid.mobile-cards td::before {
    content: attr(data-label); color: var(--parchment-dim); font-weight: 600;
    text-align: start; margin-inline-end: auto;
}
html.is-mobile table.grid.mobile-cards td:empty { display: none; }
html.is-mobile table.grid.mobile-cards tr:hover td { background: none; }
/* Long-text / action cells (empty data-label) render full-width, start-aligned. */
html.is-mobile table.grid.mobile-cards td[data-label=""] { display: block; text-align: start; }
html.is-mobile table.grid.mobile-cards td[data-label=""]::before { content: none; }

/* Other tables (e.g. admin) stay tabular — just let them scroll sideways. */
html.is-mobile table.grid:not(.mobile-cards) { display: block; overflow-x: auto; white-space: nowrap; }

/* --- Larger touch targets & full-width controls --- */
html.is-mobile .btn-fantasy { min-height: 44px; }
html.is-mobile .field input,
html.is-mobile .field select,
html.is-mobile input.input-sm,
html.is-mobile select,
html.is-mobile textarea { font-size: 16px; min-height: 44px; width: 100%; max-width: 100%; box-sizing: border-box; }
html.is-mobile .field { max-width: 100% !important; }

/* War Room / Covert pickers: two cards per row, full-width objective chips. */
html.is-mobile .attack-units { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
html.is-mobile .attack-unit { width: auto; }
html.is-mobile .attack-targets .attack-target { flex: 1 1 100%; }

/* --- Game Guide: stacked layout + the table-of-contents as tappable chips --- */
html.is-mobile .guide-layout { grid-template-columns: 1fr; }
html.is-mobile .guide-toc { position: static; flex-flow: row wrap; gap: .4rem; margin-bottom: .8rem; }
html.is-mobile .guide-toc a {
    border: 1px solid var(--border); border-radius: 999px; padding: .35rem .75rem; font-size: .85rem;
}
html.is-mobile .guide-body { gap: .8rem; }

/* --- Overlays fit the screen --- */
html.is-mobile .modal-card,
html.is-mobile .tribe-card { width: 94%; max-height: 90vh; overflow-y: auto; }
html.is-mobile .toast-host { width: 94vw; }
