/* ==========================================================================
   Black Templars Eternal — black, bone-white and crusade red.
   ========================================================================== */

:root {
  --bg: #070707;
  --panel: #111112;
  --panel-2: #18181a;
  --panel-3: #1f1f22;
  --line: #242427;
  --line-hi: #38383d;
  --bone: #f2eee6;
  --text: #e6e2d9;
  --muted: #8e897f;
  --dim: #5f5b54;
  --red: #b3121d;
  --red-hi: #dc2430;
  --red-deep: #5c070c;
  --red-glow: #b3121d55;
  --ok: #78c896;
  --warn: #d9b45a;
  --bad: #ff8c8c;
  --cut: 12px; /* chamfered corner size */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --display: Cinzel, "Times New Roman", serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  min-height: 100vh;
  display: flex; flex-direction: column;
  color: var(--text);
  font: 15px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 50% -200px, #3a0609 0%, transparent 70%),
    repeating-linear-gradient(90deg, #ffffff03 0 1px, transparent 1px 120px);
  background-attachment: fixed;
}
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
img { max-width: 100%; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: 0.06em; margin: 0 0 14px; color: var(--bone); line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(26px, 4vw, 34px); text-transform: uppercase; }
h2 { font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
h3 { font-size: 15px; letter-spacing: 0.04em; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, Consolas, monospace; background: #000; border: 1px solid var(--line-hi); padding: 1px 6px; font-size: 0.88em; color: var(--bone); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.eyebrow { font-family: var(--body); font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--red-hi); }
.eyebrow.muted { color: var(--muted); }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--bone); color: #000; padding: 8px 14px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px; height: 64px;
  background: #050505e8;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 #000, 0 2px 0 var(--red-deep);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand-cross { width: 30px; height: 30px; fill: var(--bone); stroke: var(--red); stroke-width: 4; filter: drop-shadow(0 0 6px var(--red-glow)); transition: transform 0.4s var(--ease); flex: none; }
.brand:hover .brand-cross { transform: rotate(90deg); }
.brand-name { font-family: var(--display); font-weight: 900; font-size: 17px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone); }
.brand-name em { font-style: normal; color: var(--red-hi); }
.nav { display: flex; align-items: stretch; gap: 2px; flex: 1; height: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 0 14px; text-decoration: none; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  transition: color 0.15s;
}
.nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--red-hi); transform: scaleX(0); transition: transform 0.25s var(--ease); }
.nav a:hover { color: var(--bone); }
.nav a.active { color: var(--bone); }
.nav a.active::after, .nav a:hover::after { transform: scaleX(1); }
.nav .sep { width: 1px; background: var(--line); margin: 18px 8px; flex: none; }
.nav a.command { color: var(--red-hi); }
.nav a.command.active, .nav a.command:hover { color: var(--bone); }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.me-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.me-link .name { font-size: 13px; color: var(--muted); transition: color 0.15s; }
.me-link:hover .name { color: var(--bone); }
.count { background: var(--red); color: #fff; border-radius: 99px; min-width: 18px; padding: 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0; line-height: 18px; text-align: center; }

/* ---------- layout ---------- */
.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 28px 96px; outline: none; }
.page.wide { max-width: none; padding: 0 0 96px; }
.page.enter { animation: page-in 0.4s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }
.section { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.grid { display: grid; gap: 16px; }
.grid.top { align-items: start; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack-panels > .panel:last-child { margin-bottom: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 6px 0 0; }
.back { display: inline-block; margin-bottom: 14px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--bone); }

/* chamfered "power armour" panels */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 140px);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  padding: 22px 24px;
  margin-bottom: 18px;
}
.panel::before { content: ""; position: absolute; left: var(--cut); right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--red), transparent 60%); }
.panel > h2:first-child, .panel > .row:first-child h2 { margin-top: 0; }
.panel > .row:first-child { margin-bottom: 12px; }
.panel > .row:first-child h2 { margin-bottom: 0; }

/* stat plaques */
.stats { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); margin-bottom: 18px; }
.stat {
  position: relative; background: var(--panel); border: 1px solid var(--line); padding: 16px 18px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}
.stat::after { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; background: var(--line-hi); }
.stat.accent::after { background: var(--red-hi); box-shadow: 0 0 10px var(--red-hi); }
.stat .v { font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--bone); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .l { color: var(--muted); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.stat .sub { color: var(--dim); font-size: 12px; margin-top: 4px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.2;
  border: 1px solid var(--line-hi); background: var(--panel-2); color: var(--bone);
  padding: 10px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--muted); background: var(--panel-3); }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { background: var(--red); border-color: var(--red-hi); color: #fff; }
.primary:hover:not(:disabled), .btn.primary:hover { background: var(--red-hi); border-color: #ff4b55; box-shadow: 0 0 24px var(--red-glow); }
.bone { background: var(--bone); border-color: var(--bone); color: #0a0a0a; }
.bone:hover:not(:disabled), .btn.bone:hover { background: #fff; border-color: #fff; }
.good { background: #1d4a31; border-color: #2f6e4b; }
.good:hover:not(:disabled) { background: #245a3c; border-color: #3d8a5f; }
.danger { color: var(--bad); }
.ghost { background: transparent; }
.tiny { padding: 5px 10px; font-size: 11px; clip-path: none; }
.big { padding: 14px 28px; font-size: 13.5px; }
.icon { width: 18px; height: 18px; fill: currentColor; flex: none; }

input, select, textarea {
  font: inherit; color: var(--text); background: #0a0a0b; border: 1px solid var(--line-hi); padding: 9px 11px; min-width: 0; border-radius: 0;
  transition: border-color 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: #4a4a50; }
input:focus, select:focus, textarea:focus { border-color: var(--red-hi); }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
input:focus:not(:focus-visible), select:focus:not(:focus-visible), textarea:focus:not(:focus-visible) { outline: none; }
textarea { width: 100%; min-height: 100px; resize: vertical; line-height: 1.5; }
input[type="number"] { width: 100px; }
input[type="checkbox"] { accent-color: var(--red); width: 16px; height: 16px; }
label.field { display: grid; gap: 6px; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
label.field > * { color: var(--text); font-size: 15px; letter-spacing: 0; text-transform: none; }
label.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }

/* segmented control (sort/filter tabs) */
.seg { display: inline-flex; border: 1px solid var(--line-hi); background: #0a0a0b; }
.seg button { clip-path: none; border: 0; background: none; color: var(--muted); padding: 8px 14px; font-size: 11.5px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover:not(:disabled) { background: var(--panel-2); color: var(--bone); }
.seg button.active { background: var(--panel-3); color: var(--bone); box-shadow: inset 0 -2px 0 var(--red-hi); }

/* section tabs (Command) */
.tabs { display: flex; gap: 0; margin: -6px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; color: var(--muted); padding: 11px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; transition: color 0.15s, border-color 0.15s; }
.tabs a:hover { color: var(--bone); }
.tabs a.active { color: var(--bone); border-bottom-color: var(--red-hi); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #ffffff07; }
tr.mine td { background: #b3121d1c; }
tr.mine td:first-child { box-shadow: inset 2px 0 0 var(--red-hi); }
tr.inactive td { opacity: 0.55; }
td.pos { font-family: var(--display); font-weight: 700; color: var(--muted); width: 48px; }
.you { margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red-hi); border: 1px solid var(--red-deep); padding: 1px 6px; }
.plus { color: var(--ok); }
.minus { color: var(--bad); }
.icon-link { text-decoration: none; color: var(--muted); padding: 2px 6px; }
.icon-link:hover { color: var(--bone); }
.edit-table td { vertical-align: top; }
.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person-name { overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--panel-3); border: 1px solid var(--line-hi); flex: none; display: inline-grid; place-items: center; font-family: var(--display); font-size: 12px; font-weight: 700; color: var(--muted); }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.xl { width: 88px; height: 88px; font-size: 32px; border: 2px solid var(--line-hi); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--red-deep); }

.badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; padding: 3px 9px; border: 1px solid var(--line-hi); color: var(--muted); white-space: nowrap; }
.badge.pending, .badge.open { color: var(--warn); border-color: #5c4b14; background: #d9b45a0d; }
.badge.approved, .badge.fulfilled, .badge.victory { color: var(--ok); border-color: #2c5e3f; background: #78c8960d; }
.badge.denied, .badge.refunded, .badge.defeat { color: var(--bad); border-color: #6a2226; background: #ff8c8c0d; }
.badge.dev { color: var(--bone); border-color: var(--red); background: #b3121d26; }
.chip-sm { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.note { margin: 6px 0 0; padding: 6px 10px; border-left: 2px solid var(--line-hi); background: #ffffff05; color: var(--muted); font-size: 13px; font-style: italic; }
.note.inline { display: block; margin-top: 8px; }
.notice { margin-bottom: 18px; padding: 12px 16px; border: 1px solid #5c4b14; border-left: 3px solid var(--warn); background: #d9b45a0a; font-size: 14px; }
.notice a { color: var(--bone); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 26px 12px; color: var(--muted); }
.empty svg { width: 28px; height: 28px; fill: none; stroke: var(--line-hi); stroke-width: 3; }
.empty p { margin: 0; max-width: 380px; }

/* progress bar */
.progress { display: grid; gap: 6px; }
.progress-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.progress-top span:first-child { color: var(--bone); font-weight: 600; }
.bar { height: 6px; background: #0a0a0b; border: 1px solid var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red-deep), var(--red-hi)); box-shadow: 0 0 12px var(--red-glow); transition: width 0.8s var(--ease); }
.progress.done .bar span { background: linear-gradient(90deg, #c9c3b6, var(--bone)); box-shadow: 0 0 12px #f2eee655; }

/* ---------- service record (profile header) ---------- */
.record-panel { padding: 26px 28px; }
.record { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.record-main { flex: 1; min-width: 220px; }
.record-main h1 { margin: 4px 0 10px; }
.record-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid var(--line-hi); background: #0a0a0b; font-size: 13px; color: var(--bone); }
.tag span { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.record-side { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.standing { text-align: right; }
.standing .v { font-family: var(--display); font-size: 34px; font-weight: 900; color: var(--bone); line-height: 1; }
.standing .l { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.record-progress { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- leaderboard podium ---------- */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 14px; margin: 8px 0 22px; }
.podium-spot { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 12px 0; min-width: 0; }
.podium-name { font-weight: 600; color: var(--bone); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-value { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--bone); }
.podium-value span { font-family: var(--body); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.podium-base { align-self: stretch; margin-top: 8px; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 28px; color: var(--line-hi); background: linear-gradient(180deg, var(--panel-3), var(--panel)); border: 1px solid var(--line); border-bottom: 0; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%, 0 10px); }
.p1 .podium-base { height: 96px; font-size: 40px; color: var(--red-hi); border-top: 2px solid var(--red-hi); background: linear-gradient(180deg, #2a0d10, var(--panel)); text-shadow: 0 0 20px var(--red-glow); }
.p2 .podium-base { height: 68px; color: var(--bone); }
.p3 .podium-base { height: 48px; color: var(--muted); font-size: 22px; }
.p1 .avatar.xl { width: 104px; height: 104px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--red-hi), 0 0 30px var(--red-glow); }
.podium-spot.mine .podium-name::after { content: " (you)"; color: var(--red-hi); font-weight: 500; }

/* ---------- AAR review cards ---------- */
.aar { border-left: 3px solid var(--warn); }
.aar.approved { border-left-color: var(--ok); }
.aar.denied { border-left-color: var(--red); }
.aar-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.aar-id { font-family: var(--display); font-weight: 700; color: var(--muted); }
.aar-mission { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; padding: 14px 16px; background: #0a0a0b; border: 1px solid var(--line); }
.aar-title { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--bone); letter-spacing: 0.04em; }
.aar-reward { text-align: right; }
.aar-reward .v { font-family: var(--display); font-size: 28px; font-weight: 900; color: var(--bone); line-height: 1; }
.aar-reward .l { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 4px 0 2px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 16px 0; }
.kv div span { display: block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.aar-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.aar-actions input { flex: 1; min-width: 200px; }

/* ---------- settings widgets ---------- */
.jump { position: sticky; top: 64px; z-index: 6; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: -8px 0 18px; padding: 8px 0; background: linear-gradient(180deg, var(--bg) 70%, transparent); }
.jump a { flex: none; text-decoration: none; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); background: var(--panel); }
.jump a:hover { color: var(--bone); border-color: var(--line-hi); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line-hi); padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: 0; background: none; padding: 0 6px; color: var(--muted); clip-path: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.track { background: #0b0b0c; border: 1px solid var(--line); padding: 14px; }
.track select, .track input:not([type]) { width: 100%; max-width: 100%; }
.track ol { margin: 8px 0; padding-left: 22px; }
.track li { padding: 3px 0; }
.track li .row { gap: 6px; }
.picker .results { background: var(--panel-2); border: 1px solid var(--line-hi); max-height: 240px; overflow: auto; }
.picker .results button { display: block; width: 100%; text-align: left; border: 0; background: none; clip-path: none; text-transform: none; letter-spacing: 0; font-weight: 500; }
.picker .results button:hover { background: #ffffff0d; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: flex-end; gap: 12px; align-items: center; background: #0a0a0bea; border: 1px solid var(--line-hi); padding: 10px 14px; backdrop-filter: blur(6px); }
.check-list { list-style: none; padding: 0; margin: 16px 0; }
.check-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.check-list li:last-child { border-bottom: 0; }
.check-list .tick { width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; border: 1px solid var(--line-hi); flex: none; }
.check-list li.ok .tick { color: #0a0a0a; background: var(--ok); border-color: var(--ok); }
.check-list li.todo { color: var(--muted); }

/* ---------- armoury ---------- */
.wallet { text-align: right; padding: 10px 18px; border: 1px solid var(--line-hi); background: var(--panel); clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
.wallet .l { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.wallet .v { font-family: var(--display); font-size: 30px; font-weight: 900; color: var(--bone); line-height: 1.1; }
.shop-items { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.shop-item {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 18px;
  background: linear-gradient(180deg, #1a1a1c, #0f0f10); border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.shop-item:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.shop-item.affordable { border-color: #4a1a1e; }
.shop-item.affordable:hover { border-color: var(--red); }
.shop-item.affordable::before { content: ""; position: absolute; left: var(--cut); right: 0; top: 0; height: 2px; background: var(--red-hi); }
.shop-item.sold-out { opacity: 0.55; }
.shop-item h3 { margin: 0; font-size: 17px; }
.shop-item p { margin: 0; }
.shop-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 6px; }
.shop-status { font-size: 12px; letter-spacing: 0.08em; height: 33px; display: flex; align-items: flex-end; }
.shop-status.ready { color: var(--ok); text-transform: uppercase; font-weight: 600; font-size: 11px; letter-spacing: 0.14em; }
.shop-foot .progress { height: 33px; align-content: end; }
.shop-foot .progress-top { font-size: 11px; }
.price { font-family: var(--display); font-size: 24px; font-weight: 700; color: var(--bone); }
.price small { font-family: var(--body); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }

/* ---------- gates & loader ---------- */
.gate { max-width: 560px; margin: 48px auto; text-align: center; }
.gate .panel { padding: 40px 32px; }
.gate .emblem { width: 64px; height: 64px; margin: 0 auto 18px; }
.gate .row { margin-top: 20px; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 90px 0; color: var(--muted); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; }
.loader svg { width: 40px; height: 40px; fill: var(--bone); stroke: var(--red); stroke-width: 4; animation: spin 1.6s var(--ease) infinite; filter: drop-shadow(0 0 10px var(--red-glow)); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- home ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 28px 78px; text-align: center; border-bottom: 1px solid var(--line); isolation: isolate; }
.hero::before {
  /* the great cross, watermark */
  content: ""; position: absolute; inset: -10% 0 auto; height: 130%; z-index: -1;
  background: url("/favicon.svg") center 30% / min(760px, 130vw) no-repeat;
  opacity: 0.045; filter: grayscale(1);
}
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--red) 30%, var(--red) 70%, transparent); }
.emblem { display: block; width: 116px; height: 116px; margin: 0 auto 24px; fill: var(--bone); stroke: var(--red); stroke-width: 2.5; filter: drop-shadow(0 0 22px #b3121d88) drop-shadow(0 6px 0 #000); animation: glow 5s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 34px #dc2430aa) drop-shadow(0 6px 0 #000); } }
.hero h1 { font-size: clamp(34px, 7.4vw, 78px); font-weight: 900; letter-spacing: 0.1em; margin: 14px 0 12px; text-shadow: 0 4px 0 #000, 0 0 44px #b3121d55; }
.hero h1 em { font-style: normal; color: var(--red-hi); }
.tagline { font-family: var(--display); font-size: clamp(16px, 2.4vw, 22px); color: var(--muted); letter-spacing: 0.08em; margin-bottom: 32px; }
.hero .row.center { gap: 14px; }
.hero-stats { display: flex; justify-content: center; flex-wrap: wrap; margin-top: 58px; }
.hero-stats > div { padding: 4px 36px; border-left: 1px solid var(--line-hi); }
.hero-stats > div:first-child { border-left: 0; }
.hero-stats .v { font-family: var(--display); font-size: 36px; font-weight: 700; color: var(--bone); line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-stats .l { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.scroll-cue { display: block; width: 22px; height: 34px; margin: 46px auto 0; border: 1.5px solid var(--line-hi); border-radius: 12px; position: relative; }
.scroll-cue span { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; background: var(--red-hi); border-radius: 2px; animation: cue 2s ease-in-out infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* drifting embers */
.embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.embers i {
  position: absolute; bottom: -12px; left: calc(var(--i) * 5.6% + 2%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--red-hi); box-shadow: 0 0 8px 2px #dc243088;
  opacity: 0; animation: ember calc(9s + var(--i) * 0.45s) linear infinite; animation-delay: calc(var(--i) * -0.83s);
}
.embers i:nth-child(3n) { width: 2px; height: 2px; background: #ff7b3a; }
.embers i:nth-child(4n) { animation-duration: calc(13s + var(--i) * 0.3s); }
@keyframes ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  50% { transform: translate(18px, -45vh); }
  85% { opacity: 0.6; }
  100% { transform: translate(-12px, -95vh); opacity: 0; }
}

.band { padding: 76px 0 8px; }
.band-title { text-align: center; margin-bottom: 36px; }
.band-title h2 { font-size: clamp(22px, 3vw, 30px); letter-spacing: 0.16em; margin: 8px 0 0; display: inline-flex; align-items: center; gap: 18px; }
.band-title h2::before, .band-title h2::after { content: ""; width: 48px; height: 1px; background: linear-gradient(90deg, transparent, var(--red)); flex: none; }
.band-title h2::after { transform: scaleX(-1); }
.panel.lead { padding: 28px 30px; }
.about { font-size: 17px; line-height: 1.8; color: var(--text); white-space: pre-line; margin: 0; }
.oaths { list-style: none; padding: 0; margin: 0; counter-reset: oath; }
.oaths li { counter-increment: oath; position: relative; padding: 13px 0 13px 48px; border-bottom: 1px solid var(--line); }
.oaths li:last-child { border-bottom: 0; }
.oaths li::before { content: counter(oath, upper-roman); position: absolute; left: 0; top: 11px; font-family: var(--display); font-weight: 700; color: var(--red-hi); width: 34px; text-align: center; }

.step .n { font-family: var(--display); font-size: 44px; font-weight: 900; color: var(--red); line-height: 1; }
.step h3 { margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.14em; }
.step p { margin: 0; }

.crusade { text-align: center; padding: 30px 20px 26px; }
.crusade svg { width: 36px; height: 36px; fill: var(--red); margin-bottom: 10px; }
.crusade h3 { font-size: 19px; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 6px; }
.crusade-size { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; margin-bottom: 14px; }
.crusade-size strong { color: var(--bone); }
.crusade-co { display: inline-flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }

.ranks { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); align-items: stretch; }
.rank-track { margin-bottom: 0; }
.rank-track h2 { margin: 6px 0 10px; font-size: 17px; }
.rank-track .eyebrow { font-size: 10.5px; }
.rank-track.kind-command { border-color: #3a1013; background: linear-gradient(180deg, #1d0d0f, var(--panel) 160px); }
.rank-track.kind-command .eyebrow { color: var(--red-hi); }
.rank-track.kind-command::before { background: linear-gradient(90deg, var(--red-hi), transparent 80%); height: 3px; }
.rank-list { list-style: none; margin: 4px 0 0; padding: 0; }
.rank-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0 8px 18px; border-bottom: 1px solid var(--line); position: relative; }
.rank-list li::before { content: ""; position: absolute; left: 2px; top: 50%; width: 6px; height: 6px; margin-top: -3px; background: var(--red); transform: rotate(45deg); }
.rank-list li:first-child::before { background: var(--bone); box-shadow: 0 0 8px var(--red-hi); }
.rank-list li:last-child { border-bottom: 0; }
.rank-name { color: var(--bone); }
.rank-count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 26px; text-align: right; }
.rank-count.none { color: var(--dim); }

.honour, .feed { list-style: none; margin: 0; padding: 0; }
.honour li, .feed li { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.honour li:last-child, .feed li:last-child { border-bottom: 0; }
.honour .rank { width: 30px; font-family: var(--display); font-weight: 900; font-size: 18px; color: var(--muted); text-align: center; flex: none; }
.honour li:first-child .rank { color: var(--red-hi); }
.honour .who, .feed .what { flex: 1; min-width: 0; }
.honour .who strong, .feed .what strong { display: block; color: var(--bone); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally { text-align: right; }
.tally strong { display: block; font-family: var(--display); font-size: 20px; color: var(--bone); line-height: 1.1; }
.tally span { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.feed .when { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.cta { text-align: center; padding: 56px 24px; margin-top: 64px; background: radial-gradient(600px 220px at 50% 0%, #2a0a0d, transparent), linear-gradient(180deg, var(--panel-2), var(--panel)); }
.cta .emblem { width: 64px; height: 64px; margin-bottom: 18px; }
.cta h2 { font-size: clamp(22px, 3vw, 30px); letter-spacing: 0.14em; }
.cta p { max-width: 520px; margin: 0 auto 22px; }

/* scroll reveal (only animates when motion is allowed; see ui.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.grid > .reveal:nth-child(2) { transition-delay: 0.08s; }
.grid > .reveal:nth-child(3) { transition-delay: 0.16s; }
.grid > .reveal:nth-child(4) { transition-delay: 0.24s; }

/* ---------- footer, toast ---------- */
.footer { border-top: 1px solid var(--line); background: #040404; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 30px 28px 22px; display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-mark { font-family: var(--display); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px; color: var(--bone); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.footer-nav a { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--bone); }
.footer-legal { max-width: 1180px; margin: 0 auto; padding: 14px 28px 26px; border-top: 1px solid #141416; color: var(--dim); font-size: 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; transition: 0.25s var(--ease); background: var(--panel-2); border: 1px solid var(--line-hi); border-left: 3px solid var(--ok); padding: 12px 18px; pointer-events: none; max-width: calc(100vw - 32px); z-index: 50; box-shadow: 0 10px 40px #000a; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { border-left-color: var(--red-hi); }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 8px 12px; }
  .brand-name { font-size: 14px; }
  .nav { order: 3; width: 100%; flex: none; height: 44px; margin: 0 -8px; }
  .nav a { padding: 0 10px; font-size: 11.5px; }
  .nav a::after { left: 10px; right: 10px; }
  .userbox { margin-left: auto; }
  .me-link .name { display: none; }
  .page { padding: 24px 16px 80px; }
  .section { padding: 0 16px; }
  .hero { padding: 64px 16px 52px; }
  .hero .eyebrow { letter-spacing: 0.14em; font-size: 11px; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 40px; }
  .hero-stats > div { padding: 2px 6px; }
  .hero-stats .v { font-size: 24px; }
  .hero-stats .l { font-size: 9.5px; letter-spacing: 0.12em; }
  .band { padding-top: 56px; }
  .panel, .record-panel { padding: 18px; }
  .record { gap: 16px; }
  .record-side { width: 100%; justify-content: space-between; }
  .standing { text-align: left; }
  .podium { gap: 6px; }
  .podium .avatar.xl { width: 56px; height: 56px; font-size: 20px; }
  .p1 .avatar.xl { width: 68px; height: 68px; }
  .podium-value { font-size: 17px; }
  .hide-sm { display: none; }
  .jump { top: 98px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 12.5px; letter-spacing: 0.08em; }
  .brand-cross { width: 26px; height: 26px; }
  .userbox .logout, .userbox .demo, .userbox .dev { display: none; } /* Log out is in the footer */
  .hero .row.center .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .embers { display: none; }
}
