:root {
  --bg: #0d131d;
  --panel: rgba(20, 28, 42, 0.86);
  --panel-2: rgba(30, 40, 58, 0.9);
  --line: rgba(214, 178, 102, 0.28);
  --line-strong: rgba(232, 196, 112, 0.7);
  --gold: #e8c470;
  --gold-deep: #b98a35;
  --text: #ece4d2;
  --muted: #a99f8c;
  --dim: #6d675c;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg) url(/img/art/texture.webp) center top / 1600px auto repeat;
  font: 400 17px/1.5 'Alegreya Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { display: block; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; margin: 0; letter-spacing: 0.02em; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end;
  background: url(/img/art/hero.webp) center 35% / cover no-repeat;
  border-bottom: 1px solid var(--line-strong);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 14, 22, 0.15) 0%, rgba(10, 14, 22, 0.35) 45%, rgba(13, 19, 29, 0.97) 100%),
    radial-gradient(ellipse at 50% 100%, rgba(13, 19, 29, 0.6), transparent 60%);
}
.hero-inner {
  position: relative; width: 100%; max-width: 1080px; margin: 0 auto;
  padding: 64px 20px 72px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.crest { width: min(320px, 70vw); height: auto; filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.75)); margin-bottom: 18px; }
/* screens: #results replaces the hero */
.topbar, .screen, .foot { display: none; }
body:not([data-screen='home']) .hero { display: none; }
body:not([data-screen='home']) .topbar { display: flex; }
body:not([data-screen='home']) .foot { display: flex; }
body[data-screen='results'] #results { display: block; }

.topbar {
  align-items: center; justify-content: space-between; gap: 16px; padding: 10px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(10, 14, 22, 0.55), rgba(13, 19, 29, 0.95)), url(/img/art/hero.webp) center 40% / cover;
  border-bottom: 1px solid var(--line-strong);
}
.brand img { height: 56px; width: auto; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.7)); }

.hero h1 { font-size: clamp(36px, 7vw, 72px); font-weight: 900; line-height: 1.05; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85); }
.hero h1 span { color: var(--gold); background: linear-gradient(180deg, #fff1c2, #e8c470 50%, #b07a24); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.lede { max-width: 560px; margin: 14px auto 26px; font-size: 19px; color: #e2d8c3; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 12px 26px; border-radius: 6px; cursor: pointer; text-decoration: none;
  font-family: Cinzel, serif; font-weight: 700; font-size: 15px; letter-spacing: 0.06em;
  border: 1px solid transparent; transition: transform 0.12s, filter 0.12s, background 0.12s;
}
.btn:active { transform: translateY(1px); }
.btn-gold {
  color: #2a1a05; border-color: #f6dc97;
  background: linear-gradient(180deg, #f8dd92, #d9a947 55%, #a87322);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(217, 169, 71, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--gold); border-color: var(--line-strong); background: rgba(10, 14, 22, 0.55); }
.btn-ghost:hover { background: rgba(232, 196, 112, 0.12); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- panels ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
body[data-screen='home'] main { display: none; }
.panel {
  position: relative; margin: 40px 0; padding: 36px clamp(16px, 4vw, 40px);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 4px rgba(13, 19, 29, 0.9), inset 0 0 0 5px var(--line);
  backdrop-filter: blur(2px);
  scroll-margin-top: 16px;
}
.panel::before, .panel::after {
  content: '◆'; position: absolute; top: -9px; color: var(--gold); font-size: 14px; line-height: 1;
  text-shadow: 0 0 8px rgba(232, 196, 112, 0.6);
}
.panel::before { left: 24px; } .panel::after { right: 24px; }
.section-title { font-size: clamp(26px, 4vw, 34px); color: var(--gold); }
.section-sub { color: var(--muted); margin: 4px 0 0; }
.sub-title small { font: italic 400 15px 'Alegreya Sans', sans-serif; color: var(--muted); letter-spacing: 0; }
.sub-title { display: flex; align-items: center; gap: 10px; font-size: 20px; color: var(--gold); margin: 36px 0 14px; }
.sub-title b {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  font-size: 14px; color: #2a1a05; background: linear-gradient(180deg, #f8dd92, #b98a35);
}

/* ---------- roster ---------- */
.results-head .table-tools { margin-bottom: 0; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.role-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.role-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.role-list li { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; background: rgba(8, 12, 19, 0.5); font-size: 15px; }
.role-list li img { grid-row: span 2; border-radius: 4px; box-shadow: 0 0 0 1px #000; }
.role-list li.dim { display: block; font-style: italic; background: none; }
.role-pending { grid-column: 1 / -1; margin: 4px 0 0; color: var(--muted); font-style: italic; font-size: 15px; }
.rl-spec { color: var(--cc); font-size: 13px; line-height: 1.2; }
.role-list .name { line-height: 1.2; }
.role-card {
  display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line-strong);
}
.role-card img { border-radius: 8px; box-shadow: 0 0 0 1px #000; }
.role-body { display: flex; flex-direction: column; min-width: 0; }
.role-name { font-family: Cinzel, serif; font-weight: 700; font-size: 14px; color: var(--muted); }
.role-num { font-family: Cinzel, serif; font-weight: 900; font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }

.classes {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; align-items: end;
  padding: 16px 12px 12px; border-radius: 8px; background: rgba(8, 12, 19, 0.45); border: 1px solid var(--line);
}
.cbar { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.col-area { position: relative; width: 100%; max-width: 64px; height: 220px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--line-strong); }
.col-fill {
  width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; transition: height 0.5s ease;
  background: linear-gradient(180deg, var(--cc), color-mix(in srgb, var(--cc) 55%, #000));
}
.cnum { font-family: Cinzel, serif; font-weight: 900; font-size: 20px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.cbar img { border-radius: 5px; box-shadow: 0 0 0 1px #000; }
.cname { color: var(--cc); font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.table-tools input {
  font: inherit; color: var(--text); background: rgba(8, 12, 19, 0.75);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; width: 240px; max-width: 100%;
}
.table-tools input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 196, 112, 0.18); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.roster { width: 100%; border-collapse: collapse; font-size: 15px; }
.roster th { text-align: left; font-family: Cinzel, serif; font-size: 13px; color: var(--gold); padding: 10px 12px; background: rgba(8, 12, 19, 0.75); white-space: nowrap; }
.roster th[data-sort] { cursor: pointer; user-select: none; }
.roster th[aria-sort='ascending']::after { content: ' ▲'; font-size: 10px; }
.roster th[aria-sort='descending']::after { content: ' ▼'; font-size: 10px; }
.roster td { padding: 9px 12px; border-top: 1px solid rgba(214, 178, 102, 0.12); vertical-align: middle; }
.roster .name { font-weight: 700; white-space: nowrap; }
.roster .note { display: block; color: var(--muted); max-width: 280px; font-size: 14px; }
.roster td { white-space: nowrap; }
.roster td:has(.note) { white-space: normal; }
.roster .empty { text-align: center; color: var(--muted); padding: 28px; font-style: italic; }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who img { border-radius: 4px; box-shadow: 0 0 0 1px #000; }
.who b { color: var(--cc); font-weight: 700; }
.dim { color: var(--dim); }
.roster td.c-off, .roster td.c-altOff { color: #d9cfbb; }
.roster .c-off, .roster .c-altOff { padding-left: 28px; padding-right: 28px; }
.pill { font-size: 13px; padding: 2px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill-forever { color: #f0c977; border-color: rgba(240, 201, 119, 0.5); }
.pill-retail { color: #7cc4ff; border-color: rgba(124, 196, 255, 0.5); }
.pill-both { color: #d6b0ff; border-color: rgba(214, 176, 255, 0.5); }

/* phone layout for the response tables */
.cards { display: none; gap: 8px; }
.card { padding: 12px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-top .name { font-weight: 700; font-size: 17px; margin-right: auto; }
.card-main { display: flex; align-items: center; gap: 10px; }
.card-main img { border-radius: 4px; box-shadow: 0 0 0 1px #000; flex: none; }
.card-main b { color: var(--cc); font-weight: 700; }
.card-main i { color: var(--muted); }
.card-sub { color: #d9cfbb; font-size: 15px; padding-left: 34px; }
.card-note { color: var(--muted); font-style: italic; font-size: 15px; padding-left: 34px; }
.cards .empty { margin: 0; padding: 20px; text-align: center; color: var(--muted); font-style: italic; }
@media (max-width: 760px) {
  .table-wrap { display: none; }
  .cards { display: grid; }
}

.foot { max-width: 1080px; margin: 0 auto; padding: 8px 16px 48px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--dim); font-size: 14px; }

@media (max-width: 820px) {
  .roles { grid-template-columns: repeat(2, 1fr); }
  .roles .role-col { margin-bottom: 8px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero { background-position: 30% 35%; }
  .hero-inner { padding: 40px 16px 48px; }
  .hero-actions .btn { width: 100%; }
  .brand img { height: 44px; }
  .role-card { padding: 12px; gap: 10px; }
  .role-card img { width: 36px; height: 36px; }
  .role-num { font-size: 28px; }
  .classes { gap: 4px; padding: 12px 6px 10px; }
  .col-area { height: 160px; }
  .cbar img { width: 26px; height: 26px; }
  .cname { display: none; }
  .cnum { font-size: 16px; }
  .roles { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
