/* ============================================================
   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; }

.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); }
.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; max-width: 1200px; width: 100%; }

/* ---- 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-right: auto; }
.turns { color: var(--ember-glow); font-weight: 700; }

/* ---- 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; }

/* ---- 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); }

/* ---- 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; }

/* ---- 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;
}
