/* Wild Hearts · Raid Nights
   Chrome (home-bar, wallpaper, main, panels) is lifted from /ffxiv so the two
   pages read as one site. What is new here is the week grid, which borrows the
   same language -- thin gold rules, translucent slate panels -- rather than
   inventing a second one. */

:root {
  --void: #07151c;
  --deep: #0b1d28;
  --panel: rgba(18, 40, 56, 0.78);
  --panel-solid: #12283a;
  --rule: rgba(198, 166, 100, 0.38);
  --gold: #c6a664;
  --gold-bright: #e6cf95;
  --ink: #e8eef2;
  --ink-dim: #9db2c0;
  --ink-faint: #7d94a4;

  --ok: #6fbf73;
  --warn: #d4722a;

  /* Grand Company colours, from the in-game emblems -- same values as /ffxiv,
     so a character reads the same on both pages. Drives the plate accent. */
  --gc-maelstrom: #c0392b;
  --gc-adder: #d4b13f;
  --gc-flames: #d4722a;
  --gc-none: #7d94a4;
  --accent: var(--gc-none);

  --radius: 3px;
}

* { box-sizing: border-box; }

/* The hidden attribute is display:none in the UA sheet, which any author
   display rule outranks -- which is exactly what happened to #ev-poll-fields
   (display:flex), leaving the poll-length control on screen after the author
   had chosen a fixed time. Make hidden win everywhere instead of remembering
   to check it against every new layout rule. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--void);
  color: var(--ink);
  font-family: 'Roboto Condensed', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- wallpaper ---- */
/* Shares /ffxiv's key art rather than carrying a second copy of a 400kB jpg. */
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(180deg, rgba(7,21,28,0.86) 0%, rgba(7,21,28,0.94) 55%, rgba(7,21,28,0.99) 100%),
    url("../ffxiv/assets/keyart.jpg");
  background-size: cover;
  background-position: center 22%;
  background-attachment: fixed;
}
@media (max-width: 700px) {
  /* fixed attachment is janky on mobile and forces a full-size repaint on scroll */
  .wallpaper { background-attachment: scroll; }
}

/* ---- home bar (shared with /ffxiv and /palworld) ---- */
.home-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(5, 15, 21, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}
.account { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.gamerpic {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold) 0%, #8a6f30 100%);
  color: var(--void);
  font-family: 'Cinzel', serif;
  font-weight: 700;
}
/* nowrap on both lines: "Free Company Events" is long enough to wrap in the
   desktop header at tablet widths, which doubles the bar's height for no
   reason. The mobile rules below add min-width:0 so it can ellipsis instead. */
.account b { display: block; font-weight: 700; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; }
.account small { display: block; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; white-space: nowrap; }

.system-icons { display: flex; gap: 4px; margin-left: auto; }
.system-icons button,
.system-icons a {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-dim);
  width: 38px; height: 34px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: color .15s, background .15s, border-color .15s;
}
.system-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 19px;
  line-height: 1;
  color: var(--ink);
}
.system-icons button:hover,
.system-icons a:hover { color: var(--gold-bright); background: rgba(198,166,100,0.08); }
.system-icons button.is-active {
  color: var(--gold-bright);
  border-color: var(--rule);
  background: rgba(198,166,100,0.12);
}
.system-icons button:focus-visible,
.system-icons a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.system-status { margin-left: 8px; display: flex; align-items: center; gap: 10px; }
.stamp {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  white-space: nowrap;
}

.auth-btn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--gold-bright);
  font: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.auth-btn:hover { background: rgba(198,166,100,0.14); }
.auth-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 620px) { #stamp { display: none; } }

/* ---- layout ---- */
main { max-width: 1140px; margin: 0 auto; padding: 28px 20px 72px; }
.view { display: none; }
.view.is-active { display: block; }

.section-head { margin-bottom: 26px; }
.eyebrow {
  margin: 0 0 4px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}
h1 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  text-shadow: 0 2px 18px rgba(198,166,100,0.22);
}
.lede { margin: 6px 0 0; color: var(--ink-dim); font-weight: 300; }

.notice {
  border: 1px solid var(--rule);
  border-left-width: 3px;
  background: var(--panel);
  padding: 12px 16px;
  margin-bottom: 24px;
  color: var(--ink-dim);
  font-size: 14px;
}
.notice.is-warn { border-left-color: var(--warn); }
.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--gold-bright);
}

/* ---- panels with corner flourishes ---- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  backdrop-filter: blur(3px);
  padding: 18px;
  margin-bottom: 20px;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid var(--gold);
  opacity: 0.75;
  pointer-events: none;
}
.panel::before { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: 4px; right: 4px; border-left: 0; border-top: 0; }

.grid-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.grid-head h2 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.grid-note { margin: 0; color: var(--ink-faint); font-size: 12px; }

/* ---- the week grid ----------------------------------------------------
   One CSS grid for all three views. Column 1 is the hour gutter, then seven
   day columns. Rows are hours; row 1 is the day header.

   The grid is 24 rows tall, so it scrolls sideways on a phone rather than
   squeezing cells below a usable tap target. min() clamps the track floor to
   the container for the same reason /ffxiv's roster does -- a bare fixed
   minimum forces the page itself to scroll sideways in a narrow side panel. */
.grid-scroll { overflow-x: auto; padding-bottom: 4px; }

.wk {
  display: grid;
  grid-template-columns: 46px repeat(7, minmax(52px, 1fr));
  gap: 2px;
  min-width: 460px;
}

.dh {
  /* Shared by both grids -- the weekly .wk one and the event .dayg one. */
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  padding-bottom: 6px;
}
.hh {
  font-size: 11px;
  color: var(--ink-faint);
  text-align: right;
  padding-right: 8px;
  font-variant-numeric: tabular-nums;
  /* Nudged up so the label reads as the line between hours rather than as a
     caption centred on the cell below it. */
  transform: translateY(-3px);
}
/* Every third hour keeps its label; the rest are blank so the gutter does not
   turn into a wall of numbers at 24 rows tall. */
.hh.is-quiet { color: transparent; }

.cell {
  height: 22px;
  border: 1px solid rgba(198,166,100,0.16);
  border-radius: 2px;
  background: rgba(11, 29, 40, 0.55);
  padding: 0;
  /* Set per-cell by the renderer from the heat scale below. */
  transition: background .12s, border-color .12s;
}
/* A darker rule every 6 hours gives the eye something to count by. */
.cell.is-daybreak { border-top-color: rgba(198,166,100,0.42); }

/* Heat scale: transparent through to full gold. Kept as discrete steps rather
   than a continuous alpha because the counts are small integers and a
   continuous ramp makes 2-of-9 and 3-of-9 indistinguishable. */
.cell.h0 { background: rgba(11, 29, 40, 0.55); }
.cell.h1 { background: rgba(198, 166, 100, 0.16); }
.cell.h2 { background: rgba(198, 166, 100, 0.32); }
.cell.h3 { background: rgba(198, 166, 100, 0.50); }
.cell.h4 { background: rgba(198, 166, 100, 0.68); }
.cell.h5 { background: rgba(230, 207, 149, 0.88); }

button.cell { cursor: pointer; }
button.cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; z-index: 1; }

/* Editable grid: the member's own on/off state. Distinct from the heat scale
   because it is a binary, not a count. */
.is-editable .cell[aria-pressed="true"] {
  background: linear-gradient(160deg, var(--gold) 0%, #8a6f30 100%);
  border-color: var(--gold-bright);
}
.is-editable .cell:hover { border-color: var(--gold); }

.is-selectable .cell.is-picked {
  outline: 2px solid var(--gold-bright);
  outline-offset: -1px;
  z-index: 1;
}

.grid-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.ghost {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.ghost:hover { color: var(--gold-bright); background: rgba(198,166,100,0.1); }
.ghost:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- legend ---- */
.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-wrap: wrap;
}
.legend i {
  width: 22px; height: 12px;
  border: 1px solid rgba(198,166,100,0.24);
  border-radius: 2px;
  display: inline-block;
}

/* ---- best windows ---- */
.best { list-style: none; margin: 0; padding: 0; }
.best li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(198,166,100,0.14);
}
.best li:last-child { border-bottom: 0; }
.best b {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--gold-bright);
  font-size: 15px;
  min-width: 190px;
}
.best span { color: var(--ink-dim); font-size: 14px; }
.best .count { margin-left: auto; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ---- who lists (leader view) ---- */
.who { display: flex; flex-wrap: wrap; gap: 8px; }
.who .chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  background: rgba(11, 29, 40, 0.6);
  font-size: 14px;
}
.who .chip img {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--deep);
}
.who .chip .fallback {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--gold) 0%, #8a6f30 100%);
  color: var(--void);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
}
.who .chip.is-leader { border-color: var(--gold-bright); }
.who .chip .tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
}
.empty { color: var(--ink-faint); font-size: 14px; margin: 0; }

/* ---- footer ---- */
.credits {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
}
.credits p { margin: 0 0 4px; }
.credits a { color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- events ------------------------------------------------------------
   The day grid is the week grid with a variable column count: an event
   happens on a date, so its poll runs over absolute days rather than the
   recurring 0..167 week that /raid's own heatmap uses. --cols is set inline
   by the renderer from the event's poll window. */
.dayg {
  display: grid;
  grid-template-columns: 46px repeat(var(--cols, 14), minmax(46px, 1fr));
  gap: 2px;
  min-width: 100%;
}
.dayg .dh { line-height: 1.15; }
.dayg .dh small {
  display: block;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* ---- event list ---- */
.ev-list { display: grid; gap: 12px; }
.ev-card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: rgba(11, 29, 40, 0.55);
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 13px 15px;
  transition: background .15s, border-color .15s, transform .15s;
}
.ev-card:hover { background: rgba(198,166,100,0.08); transform: translateX(2px); }
.ev-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ev-card.is-scheduled { border-left-color: var(--ok); }
.ev-card.is-open      { border-left-color: var(--gold); }
.ev-card.is-cancelled { border-left-color: var(--ink-faint); opacity: 0.6; }

.ev-card h3 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-bright);
}
.ev-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 5px;
  font-size: 13px;
  color: var(--ink-dim);
}
.ev-meta .who { color: var(--ink-faint); }

.pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 9px;
  color: var(--gold);
  white-space: nowrap;
}
.pill.is-scheduled { color: var(--ok); border-color: rgba(111,191,115,0.5); }
.pill.is-cancelled { color: var(--ink-faint); }
.pill.is-mine      { color: var(--gold-bright); border-color: var(--gold-bright); }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field > label,
.field legend {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 5px;
  padding: 0;
}
.field input[type="text"],
.field input[type="search"],
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="number"],
.field select,
.field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(7, 21, 28, 0.6);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%;
  max-width: 460px;
}
.field textarea { resize: vertical; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
fieldset.field { border: 0; margin-inline: 0; padding: 0; }

.field.comp { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field.comp legend { width: 100%; }
.field.comp label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}
.field.comp input { width: 84px; }
.field.comp .hint { width: 100%; }

#ev-poll-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
#ev-poll-fields > label { margin: 0 0 10px; }
#ev-poll-fields input, #ev-poll-fields select { width: auto; }

.hint { margin: 5px 0 0; font-size: 12px; color: var(--ink-faint); }
.hint-inline { text-transform: none; letter-spacing: 0; color: var(--ink-faint); font-size: 11px; }
.err { color: var(--warn); font-size: 13px; margin: 0 0 12px; }

label.radio {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--ink-dim);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
label.radio b { color: var(--ink); font-weight: 700; }
label.radio input { margin-top: 4px; accent-color: var(--gold); }

.primary {
  background: linear-gradient(160deg, var(--gold) 0%, #8a6f30 100%);
  border: 1px solid var(--gold-bright);
  color: var(--void);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 8px 18px;
  border-radius: var(--radius);
  cursor: pointer;
}
.primary:hover { filter: brightness(1.1); }
.primary:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.primary:disabled { opacity: 0.5; cursor: default; filter: none; }

/* ---- event detail ---- */
.back-link {
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}
.back-link:hover { color: var(--gold-bright); }
.back-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.ev-when {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--gold-bright);
}
.ev-desc { color: var(--ink-dim); font-size: 14px; white-space: pre-wrap; margin: 10px 0 0; }

/* ---- role chooser ---- */
.roles { display: flex; flex-wrap: wrap; gap: 8px; }
.roles label {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  font-size: 14px;
  cursor: pointer;
  background: rgba(11, 29, 40, 0.6);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.roles label:hover { border-color: var(--gold); }
.roles input { accent-color: var(--gold); }
.roles label:has(input:checked) {
  border-color: var(--gold-bright);
  background: rgba(198,166,100,0.16);
}

/* Role colours follow the game's own: blue tank, green healer, red DPS. */
.r-tank   { color: #5aa9e6; }
.r-healer { color: #6fbf73; }
.r-dps    { color: #d9584f; }

/* ---- roster ---- */
.slots { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.slot-group h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.slot-group h4 .count { color: var(--ink-faint); font-size: 11px; }
.slot-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slot-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgba(11, 29, 40, 0.6);
  padding: 6px 10px;
  font-size: 14px;
}
.slot-list li.is-empty {
  border-style: dashed;
  border-color: rgba(198,166,100,0.22);
  color: var(--ink-faint);
  font-size: 12px;
  font-style: italic;
}
.slot-list li.is-you { border-color: var(--gold-bright); }
.slot-list .pos {
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  font-size: 12px;
  min-width: 18px;
}
.slot-list .can { margin-left: auto; font-size: 11px; color: var(--ink-faint); }
.slot-list img, .slot-list .fallback {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover; background: var(--deep);
}
.slot-list .fallback {
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--gold) 0%, #8a6f30 100%);
  color: var(--void);
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
}
.pin {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius);
  padding: 2px 7px;
  cursor: pointer;
}
.pin:hover { color: var(--gold-bright); border-color: var(--rule); }
.pin.is-pinned { color: var(--gold-bright); border-color: var(--gold-bright); }

/* ---- adventurer plates -------------------------------------------------
   Lifted from /ffxiv's .adventurer skin so a character looks the same on both
   pages: translucent slate panel, Grand Company accent on the top rule, gold
   corner flourishes. Trimmed to what a claim card needs -- the full card over
   there also carries gear, achievements and collections. */
.plate-grid {
  display: grid;
  /* min() clamps the track floor to the container, for the same reason
     /ffxiv's roster does it: a bare fixed minimum scrolls the page sideways
     inside a narrow panel. */
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 14px;
}

.adventurer {
  --accent: var(--gc-none);
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(3px);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.adventurer::before, .adventurer::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid var(--accent);
  opacity: 0.7;
  pointer-events: none;
}
.adventurer::before { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.adventurer::after { bottom: 4px; right: 4px; border-left: 0; border-top: 0; }

.gc-maelstrom { --accent: var(--gc-maelstrom); }
.gc-adder     { --accent: var(--gc-adder); }
.gc-flames    { --accent: var(--gc-flames); }

/* The claim list is a grid of buttons, so the plate has to work as one. */
button.adventurer {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
button.adventurer:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(0,0,0,0.4); }
button.adventurer:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.adventurer:disabled { cursor: default; opacity: 0.45; }
button.adventurer:disabled:hover { transform: none; box-shadow: none; }

.char-head { display: flex; gap: 12px; align-items: flex-start; }
.portrait {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--deep);
  flex-shrink: 0;
}
.char-id { min-width: 0; flex: 1; }
.char-name {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.char-title {
  display: block;
  font-size: 11px;
  font-style: italic;
  color: var(--gold);
  opacity: 0.9;
}
.char-meta {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.gc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px 6px;
  margin-top: 5px;
  opacity: 0.92;
}

.job {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(7, 21, 28, 0.55);
  border: 1px solid rgba(198,166,100,0.22);
  border-radius: 2px;
  padding: 3px 8px 3px 4px;
  font-size: 13px;
  color: var(--ink);
}
.job img { width: 20px; height: 20px; display: block; }
.job .lv { color: var(--gold-bright); font-weight: 700; font-variant-numeric: tabular-nums; }
.job.is-main { border-color: var(--accent); background: rgba(7,21,28,0.75); }
.job-list { display: flex; flex-wrap: wrap; gap: 6px; }

.plate-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 9px;
  border-top: 1px solid rgba(198,166,100,0.18);
}
.plate-foot .grid-note { margin-right: auto; }

/* The roles a character's levelled combat jobs say they can fill. */
.role-hint {
  display: inline-flex;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.claimed-by {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* The character name, where one is linked, standing in for a Discord handle
   on a shared roster. */
.char-tag {
  font-size: 11px;
  color: var(--gold);
  font-style: italic;
}

#char-search { max-width: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.claims-table { display: grid; gap: 8px; }
.claim-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgba(11, 29, 40, 0.6);
  padding: 8px 12px;
  font-size: 14px;
}
.claim-row .arrow { color: var(--ink-faint); }
.claim-row .spacer { margin-left: auto; }

/* Level + rule sit on one line: the number is meaningless without the strength
   of the claim next to it. */
.field.lvl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field.lvl label { width: 100%; }
.field.lvl input { width: 90px; }
.field.lvl select { width: auto; }
.field.lvl .hint { width: 100%; margin-top: 0; }

#tz-pick { max-width: 460px; }

/* An event's level, shown wherever the event is. */
.lvl-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 9px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.lvl-pill.is-required { color: var(--warn); border-color: var(--warn); }

.lvl-warn {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--warn);
}

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-top .back-link { margin-bottom: 0; }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- getting started ---- */
.guide { margin: 0; padding-left: 22px; display: grid; gap: 18px; }
.guide li { color: var(--ink-dim); }
.guide li::marker { color: var(--gold); font-family: 'Cinzel', serif; font-weight: 600; }
.guide h3 {
  margin: 0 0 4px;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
}
.guide p { margin: 0 0 6px; font-size: 14px; line-height: 1.6; }
.guide p:last-child { margin-bottom: 0; }
.guide b { color: var(--ink); }
.guide code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--gold-bright);
}
/* The one step that is not yet true, marked as such rather than left to read
   like the rest. */
.guide li.is-pending {
  border-left: 2px solid var(--warn);
  padding-left: 12px;
  margin-left: -12px;
  list-style: none;
}
.guide li.is-pending h3 { color: var(--warn); }

/* ---- welcome ----------------------------------------------------------
   The signed-out landing. The heatmap is the only thing the public may see,
   but on its own it is a wall of squares that explains neither what the site
   is nor what to do about it -- this says both before offering the grid. */
.hero {
  padding: 26px 0 30px;
  border-bottom: 1px solid rgba(198,166,100,0.18);
  margin-bottom: 26px;
}
.hero h1 { font-size: clamp(34px, 7vw, 56px); }
.hero-lede {
  margin: 10px 0 0;
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 300;
  color: var(--ink-dim);
  max-width: 46ch;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-note { margin: 14px 0 0; font-size: 14px; color: var(--gold); }

.primary.big, .ghost.big {
  font-size: 14px;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
/* Discord's own blurple, so the sign-in reads as the thing it is rather than
   as one more gold button among the gold buttons. */
#welcome-signin {
  background: linear-gradient(160deg, #5865f2 0%, #4650c8 100%);
  border-color: #7983f5;
  color: #fff;
}
#welcome-signin:hover { filter: brightness(1.08); }
#welcome-signin:focus-visible { outline: 2px solid #7983f5; outline-offset: 2px; }

.sells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.sell {
  border: 1px solid var(--rule);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  backdrop-filter: blur(3px);
}
.sell h2 {
  margin: 0 0 6px;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sell p { margin: 0; font-size: 14px; color: var(--ink-dim); line-height: 1.6; }

/* ---- the getting-started dialog ---- */
#guide {
  border: 0;
  background: transparent;
  padding: 20px;
  max-width: min(820px, 100%);
  width: 100%;
  max-height: 100dvh;
  color: var(--ink);
}
#guide::backdrop { background: rgba(4, 12, 17, 0.78); backdrop-filter: blur(2px); }
#guide .panel { margin: 0; max-height: calc(100dvh - 40px); overflow-y: auto; }

/* ---- phones --------------------------------------------------------------
   The header was one nowrap flex row: brand, six icons and Sign out. At 390px
   that came to 509px, so Sign out sat 119px off the right edge and the whole
   DOCUMENT scrolled sideways -- which is what made the rest of the page feel
   like it would not scroll properly. Letting the bar wrap and giving the icons
   a row of their own fixes the button and the page scroll together, since the
   header was the only thing overflowing. */
/* 800px, and the number is measured rather than picked. Above this width the
   header is a single no-wrap row, and that row's natural width is 745px:
   brand 213 (of which the "Wild Hearts · Malboro" subtitle is 169), nav 248,
   stamp and Sign out 216, plus padding and gaps. Anything below that and Sign
   out goes off the edge, which is what happened at 721px -- the original 720
   breakpoint was always too low, and the longer brand only made it visible.
   800 leaves room for the clock in the stamp to grow a character or two.
   Verified by sweeping 320px to 1600px, not by eye. */
@media (max-width: 800px) {
  main { padding: 20px 12px 60px; }
  .panel { padding: 13px; }

  .home-bar {
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 8px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  /* min-width:0 lets the brand shrink instead of forcing the row wider than
     the screen; nowrap stops "Wild Hearts · Malboro" stacking three deep. */
  .account { min-width: 0; flex: 1 1 auto; }
  .account b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
  .account small { overflow: hidden; text-overflow: ellipsis; }
  .system-status { order: 2; margin-left: auto; }
  .system-icons {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 2px;
  }
  .system-icons button,
  .system-icons a { flex: 1 1 auto; max-width: 64px; }

  /* The whole week, on screen at once. The 460px floor and the 52px per-day
     minimum together meant only five days fitted and the rest were behind a
     sideways scroll -- on the one view whose entire point is comparing days.
     Cells get taller as they get narrower, so they stay tappable. */
  .wk {
    grid-template-columns: 38px repeat(7, minmax(0, 1fr));
    min-width: 0;
    gap: 1px;
  }
  .cell { height: 26px; }
  .hh { font-size: 10px; padding-right: 4px; white-space: nowrap; }
  .dh { font-size: 10px; letter-spacing: 0.04em; }

  /* The event poll can be 28 days wide, so it still scrolls -- but narrower
     columns mean rather more of it lands on screen per swipe. */
  .dayg { grid-template-columns: 38px repeat(var(--cols, 14), minmax(34px, 1fr)); }

  .hero-cta > button { flex: 1 1 100%; justify-content: center; }
  .lvl-pill, .pill { white-space: nowrap; }
}

/* ---- job preference order ----------------------------------------------
   Up/down buttons are the primary mechanism, not a fallback: they work with a
   keyboard, with a screen reader and on a phone, none of which native HTML5
   drag-and-drop does. Dragging is layered on top for people with a mouse, who
   will reach for it first. */
.job-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.job-order li {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgba(11, 29, 40, 0.62);
  padding: 7px 10px;
  font-size: 14px;
}
.job-order li.is-dragging { opacity: 0.4; }
.job-order li.is-over { border-color: var(--gold-bright); }
.job-order .rank {
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  font-size: 12px;
  min-width: 20px;
}
.job-order img { width: 22px; height: 22px; display: block; }
.job-order .jname { font-weight: 700; }
.job-order .jlv { color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.job-order .jrole {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.job-order .grip {
  color: var(--ink-faint);
  cursor: grab;
  font-size: 14px;
  line-height: 1;
}
.job-order li:active .grip { cursor: grabbing; }

.nudge {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  border-radius: var(--radius);
  width: 30px;
  height: 28px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
}
.nudge:hover:not(:disabled) { color: var(--gold-bright); background: rgba(198,166,100,0.1); }
.nudge:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nudge:disabled { opacity: 0.3; cursor: default; }

.custom-char { margin-bottom: 20px; }
.custom-char .grid-head h2 { text-transform: none; letter-spacing: 0.06em; font-size: 16px; }

/* ---- character data provenance -----------------------------------------
   A member who reorders their jobs is looking straight at level numbers, so
   this is where "why does it still say 90" gets answered: when the snapshot
   was built, whether the nightly run succeeded, and which copy is on screen. */
.snap { margin-bottom: 20px; }
.snap .grid-head h2 { text-transform: none; letter-spacing: 0.06em; font-size: 16px; }

.snap-facts {
  margin: 0 0 12px;
  display: grid;
  gap: 6px 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  font-size: 13px;
}
.snap-facts > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.snap-facts dt {
  color: var(--ink-faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.snap-facts dd { margin: 0; color: var(--ink); }
.snap-abs { color: var(--ink-faint); font-size: 11px; }
.snap-ok { color: var(--ok); }
.snap-bad { color: var(--warn); }

#snap-cool { margin: 0; align-self: center; font-variant-numeric: tabular-nums; }
