/* The hub. Same committed dark look as the alchemy planner: the site is used beside
   the game, usually at night, and a white page next to the client is a flashbang.
   Greek and Cyrillic: IM Fell English has neither, so EB Garamond fills those glyphs
   in headings; Source Sans 3 and IBM Plex Mono carry both. */
:root {
  color-scheme: dark;
  --ground: #0e1217;
  --panel: #151b22;
  --panel-2: #1c242d;
  --panel-3: #232d38;
  --line: #2b3643;
  --line-soft: #1d2530;
  --ink: #e6ebf0;
  --muted: #93a1b0;
  --faint: #6f7d8d;
  --ember: #ff8a3d;
  --ember-dim: #a3552a;
  --ember-ink: #1c0d02;
  --ok: #5fd3a0;
  --warn: #ffc857;
  --danger: #ff6b6b;
  --info: #7cb4f0;
  --frost: #c9d4df;    /* the mark's horns; cold highlights, never body text */
  --serif: "IM Fell English", "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --tap: 40px;
  --rail: 68px;
  --menu: 228px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--ground); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--sans); }
[hidden] { display: none !important; }
a { color: var(--ember); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.05; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 18px; }
p { margin: 0; }
ul { margin: 0; padding-left: 1.2em; }
button, input, select { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.label { font: 600 11px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- preview strip */
.strip {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  padding: 7px 16px; background: #1f1712; border-bottom: 1px solid var(--ember-dim);
  font-size: 13px; color: var(--ink);
}
.strip b { color: var(--ember); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }
.strip .spacer { flex: 1; }
.strip .seg button { padding: 3px 9px; min-height: 28px; font-size: 12px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--rail) var(--menu) minmax(0, 1fr); min-height: calc(100% - 38px); }
.rail {
  background: #0a0d11; border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding-block: 14px;
  position: sticky; top: 38px; height: calc(100vh - 38px); overflow-y: auto;
}
.rail a { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.rail a[aria-current="true"] { border-color: var(--ember); background: var(--panel-2); }
.rail a[aria-current="true"]::before { content: ""; position: absolute; left: -11px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--ember); }
.rail a .game { position: absolute; right: -4px; bottom: -4px; font: 700 9px/1 var(--sans); background: var(--panel-3);
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 3px; color: var(--muted); letter-spacing: .04em; }
.rail .sep { width: 28px; height: 1px; background: var(--line); }
.rail .add { font-size: 22px; color: var(--ember); border-style: dashed; }

.menu {
  background: var(--panel); border-right: 1px solid var(--line-soft);
  position: sticky; top: 38px; height: calc(100vh - 38px); overflow-y: auto;
  display: flex; flex-direction: column;
}
.menu .ghead { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 16px 14px 14px; border-bottom: 1px solid var(--line-soft); }
.menu .ghead h2 { font-size: 20px; }
.menu .ghead .sub { font-size: 12px; color: var(--muted); }
.menu .ghead .parent { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.menu .ghead .parent a { color: var(--muted); }
.menu nav { display: grid; gap: 1px; padding: 10px 8px; }
.menu nav .label { padding: 12px 8px 6px; }
.menu nav a {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 4px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
}
.menu nav a:hover { color: var(--ink); background: var(--panel-2); }
.menu nav a[aria-current="page"] { color: var(--ink); background: var(--panel-3); box-shadow: inset 2px 0 0 var(--ember); }
.menu nav a .count { margin-left: auto; font: 600 11px/1 var(--mono); background: var(--ember); color: var(--ember-ink); border-radius: 9px; padding: 3px 6px; }
.menu nav svg, .tabbar svg { width: 18px; height: 18px; flex: none; }
.menu .foot { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.menu .foot a { color: var(--ink); text-decoration: none; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line-soft); }
.topbar .crumb { font-size: 13px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .search { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; min-width: 0; width: min(280px, 40vw);
  border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--faint); font-size: 13px; cursor: pointer; }
.topbar .search kbd { margin-left: auto; }
.topbar select { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; min-height: 34px; padding: 0 6px; }
.iconbtn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.menu-toggle { display: none; }
.content { padding: 24px 24px 64px; display: grid; gap: 22px; align-content: start; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.page-head .lede { color: var(--muted); max-width: 64ch; margin-top: 6px; }

kbd { font: 600 11px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); color: var(--muted); }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card > header h2, .card > header h3 { font-size: 19px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.stack { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.row .spacer { flex: 1; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ember-dim); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: var(--ember-ink); }
.btn.primary:hover { background: #ffa261; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 28px; padding: 0 9px; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; border-right: 1px solid var(--line); padding: 6px 12px; min-height: 32px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--ember); }

.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 11px/1 var(--sans); letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 3px; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.danger { color: var(--danger); }
.pill.info { color: var(--info); } .pill.muted { color: var(--faint); } .pill.ember { color: var(--ember); }
.pill.solid { background: var(--ember); color: var(--ember-ink); border-color: var(--ember); }

.table-wrap { overflow-x: auto; margin-inline: -16px; padding-inline: 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font: 600 11px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data td.n, table.data th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data tr.me td { background: color-mix(in srgb, var(--ember) 9%, transparent); }
table.data tr.me td:first-child { box-shadow: inset 2px 0 0 var(--ember); }
table.data tr.off td { color: var(--faint); }
.pos { color: var(--ok); } .neg { color: var(--danger); }

.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 700 11px/1 var(--sans); color: var(--ember-ink); }
.who .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .cl { color: var(--muted); font-size: 12px; white-space: nowrap; }

.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ember); }
.bar.ok > i { background: var(--ok); } .bar.info > i { background: var(--info); }

/* the pixel crest: L2 clan crests are 16×12 bitmaps, so group icons are too */
.crest { display: block; image-rendering: pixelated; border-radius: 2px; }
/* the Meadhall mark: the same grid as a crest, but never on a tile or a field of its own */
.mark { display: block; flex: none; image-rendering: pixelated; }
.lockup { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rail a.home { background: none; border-color: transparent; }
.rail a.home:hover { background: var(--panel); }

/* ---------------------------------------------------------------- dashboard */
.needs { display: grid; gap: 8px; }
.need { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); }
.need.hot { border-color: var(--ember-dim); background: linear-gradient(90deg, color-mix(in srgb, var(--ember) 10%, var(--panel)), var(--panel) 60%); }
.need .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--ember); }
.need .ic svg { width: 18px; height: 18px; }
.need b { font-weight: 600; }
.need .sub { color: var(--muted); font-size: 13px; }
.stat { display: grid; gap: 2px; }
.stat .v { font: 600 26px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 400; }
.feed { display: grid; gap: 10px; }
.feed > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; font-size: 14px; }
.feed time { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* ---------------------------------------------------------------- raids */
.bosses { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.boss { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 14px; display: grid; gap: 8px; }
.boss.open { border-color: var(--ok); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent) inset; }
.boss.soon { border-color: var(--ember-dim); }
.boss h3 { font-size: 21px; }
.boss .cd { font: 600 24px/1 var(--mono); font-variant-numeric: tabular-nums; }
.boss.open .cd { color: var(--ok); }
.timeline { position: relative; height: 8px; border-radius: 4px; background: var(--panel-3); }
.timeline .win { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 55%, transparent); border-radius: 4px; }
.timeline .now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }

/* ---------------------------------------------------------------- events */
.event { display: grid; grid-template-columns: 74px 1fr; gap: 14px; }
.event .when { text-align: center; border: 1px solid var(--line); border-radius: 6px; padding: 8px 4px; background: var(--panel-2); align-self: start; }
.event .when .d { font: 400 28px/1 var(--serif); }
.event .when .m { font: 600 11px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { font-size: 12px; padding: 4px 8px; border-radius: 3px; border: 1px dashed var(--line); color: var(--faint); white-space: nowrap; }
.slot.filled { border-style: solid; color: var(--ink); background: var(--panel-2); }
.slot.me { border-color: var(--ember); }
.role-tank { --rc: #89b0e8; } .role-healer { --rc: #8fc38a; } .role-support { --rc: #bb98f0; } .role-dps { --rc: #e27a62; }
.slot.filled::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rc); margin-right: 6px; }

/* ---------------------------------------------------------------- auctions */
.auction-live { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.auction-live .big { font: 600 44px/1 var(--mono); font-variant-numeric: tabular-nums; }
.bidbox { display: flex; gap: 8px; }
.bidbox input { width: 110px; min-height: 40px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line); background: var(--ground); font-family: var(--mono); font-size: 18px; }

/* ---------------------------------------------------------------- claims */
.shot { aspect-ratio: 16 / 9; max-width: 100%; border-radius: 4px; border: 1px solid var(--line); position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 30% 40%, #243142, #0b0f14 70%); }
.shot .hud { position: absolute; left: 6%; top: 10%; display: grid; gap: 3px; width: 26%; }
.shot .hud i { display: block; height: 7px; border-radius: 2px; background: linear-gradient(90deg, #b8423a 70%, #3a1d1b 70%); }
.shot .hud i:nth-child(even) { background: linear-gradient(90deg, #3e6fb8 55%, #1b2436 55%); height: 4px; }
.shot .boss-hp { position: absolute; left: 30%; right: 30%; top: 5%; height: 9px; border-radius: 2px; background: linear-gradient(90deg, #b8423a 8%, #3a1d1b 8%); }
.shot .stamp { position: absolute; right: 4%; bottom: 6%; font: 600 11px/1 var(--mono); color: #ece4d2cc; }
.shot .voice { position: absolute; right: 4%; top: 12%; width: 22%; height: 34%; border-radius: 3px; background: #1d2230cc; }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.checks .q { color: var(--warn); }

/* ---------------------------------------------------------------- coming soon */
.soon-card { border: 1px dashed var(--ember-dim); border-radius: 8px; padding: 22px; display: grid; gap: 14px; background:
  repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--ember) 4%, transparent) 14px 28px), var(--panel); }
.soon-card ul { display: grid; gap: 6px; color: var(--muted); }
.empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: 6px; display: grid; gap: 10px; justify-items: start; }

/* ---------------------------------------------------------------- toasts, drawer, tab bar */
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-3); border: 1px solid var(--ember-dim); border-radius: 6px; padding: 10px 14px; font-size: 14px; box-shadow: 0 8px 30px #0008; }
.tabbar { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail, .menu { position: fixed; top: 0; bottom: 0; z-index: 50; height: auto; transform: translateX(-110%); transition: transform .2s ease; }
  .rail { left: 0; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  /* the menu sits right of the rail, so it has to travel its own width plus the rail's */
  .menu { left: var(--rail); width: min(var(--menu), calc(100vw - var(--rail) - 24px)); padding-top: env(safe-area-inset-top, 0px);
    transform: translateX(calc(-100% - var(--rail) - 12px)); }
  body.drawer .rail, body.drawer .menu { transform: none; }
  body.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: #000a; }
  .menu-toggle { display: grid; }
  .topbar { padding: 10px 16px; }
  .topbar .search { width: auto; flex: 1; }
  .topbar .search span, .topbar .search kbd, .topbar .crumb { display: none; }
  .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around;
    background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; min-height: 48px;
    font: 600 11px/1 var(--sans); color: var(--muted); text-decoration: none; background: none; border: 0; }
  .tabbar a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 2px 0 var(--ember); }
  .auction-live { grid-template-columns: minmax(0, 1fr); }
  .strip { font-size: 12px; }
  .strip .hide-sm { display: none; }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------------------------------------------------------- command palette */
dialog.palette { width: min(560px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--ember-dim); border-radius: 8px;
  background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px #000c; }
dialog.palette::backdrop { background: #000a; }
dialog.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 14px 16px; font-size: 16px; outline: none; }
dialog.palette ul { list-style: none; margin: 0; padding: 6px; display: grid; gap: 1px; max-height: 50vh; overflow-y: auto; }
dialog.palette li { padding: 0; }
dialog.palette li.muted { padding: 10px; }
dialog.palette a { display: block; padding: 9px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; }
dialog.palette a:hover, dialog.palette a:focus, dialog.palette a.first { background: var(--panel-3); }

/* ---------------------------------------------------------------- front page */
body.home { padding-inline: 16px; }
body.home #app { max-width: 1120px; margin: 0 auto; display: grid; gap: 44px; padding-block: 0 48px; }
.home-top { display: flex; align-items: center; gap: 14px; padding-block: 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.home-top .brand { font: 400 28px/1 var(--serif); }
.home-top a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.home-top a.lockup { color: var(--ink); font-size: inherit; }
.home-top select { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; min-height: 30px; }
.home-top .spacer { flex: 1; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 40px; align-items: center; padding-top: 12px; }
.home-hero h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.02; letter-spacing: -.01em; }
.home-hero .lede { font-size: 18px; color: var(--muted); max-width: 56ch; }
.home-demo { display: grid; gap: 12px; transform: rotate(-1.2deg); }
.home-demo .boss:nth-child(2) { margin-left: 28px; transform: rotate(1.6deg); }
.home-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 28px 32px; }
.feat { display: grid; gap: 6px; align-content: start; }
.feat .ic { color: var(--ember); width: 26px; height: 26px; }
.feat .ic svg { width: 26px; height: 26px; }
.home-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.home-foot { border-top: 1px solid var(--line-soft); padding-top: 16px; }
@media (max-width: 760px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .home-demo { transform: none; } .home-demo .boss:nth-child(2) { margin-left: 0; transform: none; }
}
