/*
  Ectyria staff panel. One stylesheet, no inline styles anywhere (the page's security policy forbids them).
  Colours are tokens on :root: dark by default (deepslate with an amethyst accent), light when the system asks for it.
  The two chart series colours and the four status colours come from the data-viz palette that was checked for
  colour-blind separation and contrast against these surfaces. Status is never colour alone: it always has a shape and a word.
*/

:root {
  color-scheme: dark;

  --bg: #12161c;
  --surface: #1a2029;
  --raised: #232b36;
  --line: #2b3440;
  --line-strong: #3d4a5a;
  --ctl: #75849a; /* borders of inputs and buttons: 3:1 against the surfaces */

  --text: #eceff4;
  --text-2: #b9c3d0;
  --muted: #8e9bab;

  --accent: #b4a3ff;
  --accent-ink: #c4b8ff; /* accent used as text or a link */
  --accent-on: #14111f; /* text on an accent fill */
  --accent-wash: rgba(180, 163, 255, 0.14);
  --focus: #d4caff;

  --series-1: #3987e5; /* ticks per second */
  --series-2: #d95926; /* time per tick */

  --good: #0ca30c;
  --warn: #fab219;
  --bad: #d03b3b;

  --backdrop: rgba(6, 8, 12, 0.68);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;

  --r: 10px;
  --r-sm: 6px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #f2f4f7;
    --surface: #ffffff;
    --raised: #f7f8fa;
    --line: #dde2e9;
    --line-strong: #b9c2cf;
    --ctl: #7a8697;

    --text: #151a21;
    --text-2: #444e5c;
    --muted: #5f6b7a;

    --accent: #5a3fd0;
    --accent-ink: #4a30b8;
    --accent-on: #ffffff;
    --accent-wash: rgba(90, 63, 208, 0.1);
    --focus: #4a30b8;

    --series-1: #2a78d6;
    --series-2: #eb6834;

    --good: #0a7d0a;
    --warn: #9a6700;
    --bad: #c22f2f;

    --backdrop: rgba(20, 26, 34, 0.5);
    --shadow: 0 10px 30px rgba(20, 26, 34, 0.18);
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-ui);
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-head);
  font-weight: 650;
  line-height: 1.2;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

a {
  color: var(--accent-ink);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}

.muted {
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

main:focus,
.page-title:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px;
  top: -120px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-on);
  border-radius: var(--r-sm);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 8px;
}

.noscript,
.boot {
  max-width: 30rem;
  margin: 20vh auto 0;
  padding: 0 16px;
  text-align: center;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ctl);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--text-2);
  background: var(--line);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  filter: brightness(1.1);
}

.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.btn.danger:hover:not(:disabled) {
  background: var(--bad);
  border-color: var(--bad);
  filter: brightness(1.12);
}

.btn.danger-quiet {
  border-color: var(--bad);
}

.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn.quiet:hover:not(:disabled) {
  border-color: var(--ctl);
  background: transparent;
  color: var(--text);
}

.btn.small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.btn[aria-busy="true"] {
  cursor: progress;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ctl);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
  flex: none;
}

input::placeholder {
  color: var(--muted);
}

.field {
  min-width: 0;
}

.field.grow {
  flex: 1 1 16rem;
}

.field label,
.check label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
}

.field label {
  margin-bottom: 4px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.check label {
  color: var(--text);
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.form-msg {
  margin: 0;
}

.form-msg:not(:empty) {
  padding: 8px 12px;
  border-left: 4px solid var(--bad);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: color-mix(in srgb, var(--bad) 14%, transparent);
}

/* ---------- small parts ---------- */

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip {
  --st: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 9px 2px 7px;
  border: 1px solid var(--st);
  border-radius: 999px;
  background: var(--raised);
  background: color-mix(in srgb, var(--st) 15%, transparent);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}

.chip .icon {
  color: var(--st);
  font-size: 1.05em;
}

.chip-good {
  --st: var(--good);
}

.chip-warn {
  --st: var(--warn);
}

.chip-bad {
  --st: var(--bad);
}

.presence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
}

.presence .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.presence.is-on .dot {
  background: var(--good);
}

.presence.is-off {
  color: var(--text-2);
}

.presence.is-off .dot {
  border: 2px solid var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border: 1px solid var(--ctl);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-2);
}

.badge-owner {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

.badge-admin {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--text);
}

.badge-banned {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--text);
}

.badge-banned .icon {
  color: var(--bad);
}

.state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  color: var(--text-2);
  text-align: center;
}

.state p {
  margin: 0;
}

.state-title {
  color: var(--text);
  font-weight: 600;
}

.state-text {
  max-width: 44ch;
}

.state-icon {
  width: 1.6rem;
  height: 1.6rem;
  color: var(--bad);
}

.state-icon.is-neutral {
  color: var(--accent-ink);
}

.state-error .btn {
  margin-top: 6px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.banner .icon {
  color: var(--warn);
  margin-top: 0.3em;
}

.note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--raised);
}

.note .icon {
  color: var(--accent-ink);
  margin-top: 0.3em;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.panel > h2 {
  margin-bottom: 12px;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.table tbody th {
  font-weight: 500;
  overflow-wrap: break-word;
}

.table th.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table tbody tr:last-child th,
.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tfoot th,
.table tfoot td {
  border-top: 2px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--ctl);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.seg-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--ctl);
}

.seg-btn:hover {
  background: var(--raised);
  color: var(--text);
}

.seg-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
}

.seg-btn:focus-visible {
  outline-offset: -4px;
}

/* ---------- login ---------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 26rem;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 14px 0 8px;
  font-size: 1.7rem;
}

.login-help {
  margin-bottom: 20px;
  color: var(--text-2);
}

.login .form-msg {
  margin-top: 12px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.login-wait {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.glyph {
  width: 30px;
  height: 30px;
  flex: none;
}

.login .glyph {
  width: 48px;
  height: 48px;
}

.g-top {
  fill: var(--accent);
}

.g-left {
  fill: var(--accent);
  fill-opacity: 0.62;
}

.g-right {
  fill: var(--accent);
  fill-opacity: 0.34;
}

/* ---------- shell ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 24px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  color: var(--text);
  text-decoration: none;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
}

.brand-sub {
  color: var(--text-2);
  font-size: 0.875rem;
}

.nav {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--text-2);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
}

.nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}

.nav a:focus-visible {
  outline-offset: -4px;
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.who-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.page-title {
  margin: 4px 0 18px;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  overflow-wrap: anywhere;
}

.section {
  margin-top: 32px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.result-count {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

/* ---------- dashboard ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.tile-label {
  margin: 0;
  color: var(--text-2);
  font: 600 0.875rem/1.3 var(--font-ui);
}

.tile-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 0;
}

.tile .num {
  font-size: 1.9rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.tile .num-text {
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.tile .unit {
  color: var(--text-2);
  font-size: 0.9rem;
}

.tile-sub {
  margin: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.tile-state:empty {
  display: none;
}

.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--raised);
  border: 1px solid var(--line);
  overflow: hidden;
}

.meter-fill {
  --st: var(--good);
  width: 0;
  height: 100%;
  background: var(--st);
}

.meter-fill.s-good {
  --st: var(--good);
}

.meter-fill.s-warn {
  --st: var(--warn);
}

.meter-fill.s-bad {
  --st: var(--bad);
}

.tile-hero {
  --st: var(--line-strong);
  grid-column: 1 / -1;
  border-left: 5px solid var(--st);
  gap: 8px;
}

.tile-hero[data-state="good"] {
  --st: var(--good);
}

.tile-hero[data-state="warn"] {
  --st: var(--warn);
}

.tile-hero[data-state="bad"] {
  --st: var(--bad);
}

.hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.hero-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
}

.tile-hero .hero-value .num {
  font-size: clamp(3.25rem, 11vw, 4.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tile-hero .hero-value .unit {
  font-size: 1.1rem;
  font-weight: 600;
}

.trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.trio-item dt {
  color: var(--text-2);
  font-size: 0.8125rem;
}

.trio-item dd {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 0;
}

.trio-item .num {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.trio-item .chip {
  font-size: 0.75rem;
  padding: 1px 7px 1px 5px;
}

.stats-host .state {
  min-height: 12rem;
  align-content: center;
}

.chart {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.chart.is-busy .chart-plot {
  opacity: 0.55;
}

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0 0 10px;
}

.readout-item dt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.readout-item dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.key {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 3px solid var(--muted);
  border-radius: 2px;
}

.key-1 {
  border-color: var(--series-1);
}

.key-2 {
  border-color: var(--series-2);
}

.chart-plot {
  border-radius: 4px;
  cursor: crosshair;
  touch-action: pan-y;
  overflow: hidden;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ch-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.ch-labels text {
  fill: var(--muted);
  font: 11px var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.ch-labels .ch-title {
  fill: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.ch-limit line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.ch-limit text,
.ch-nodata text {
  fill: var(--muted);
  font: 11px var(--font-ui);
}

.ch-nodata text {
  font-style: italic;
}

.ch-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ch-line-1 {
  stroke: var(--series-1);
}

.ch-line-2 {
  stroke: var(--series-2);
}

.ch-area {
  stroke: none;
  fill-opacity: 0.1;
}

.ch-area-1 {
  fill: var(--series-1);
}

.ch-area-2 {
  fill: var(--series-2);
}

.ch-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.ch-dot-1 {
  fill: var(--series-1);
}

.ch-dot-2 {
  fill: var(--series-2);
}

.ch-end {
  fill: var(--text);
  font: 600 12px var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.ch-cross.is-off {
  display: none;
}

.ch-cross-line {
  stroke: var(--text-2);
  stroke-width: 1;
}

.chart-empty {
  margin: 0;
  padding: 36px 12px;
  color: var(--text-2);
  text-align: center;
}

.chart-summary {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

.chart-table {
  margin-top: 8px;
}

.chart-table summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-ink);
  cursor: pointer;
}

.chart-table .table-scroll {
  max-height: 18rem;
}

.hist-msg:empty {
  display: none;
}

.hist-msg {
  margin-bottom: 12px;
}

/* ---------- players ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px 24px;
}

.list-host.is-busy {
  opacity: 0.6;
}

.plist {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.prow:hover {
  border-color: var(--ctl);
  background: var(--raised);
}

.pname {
  flex: 1 1 100%;
  min-width: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.pseen {
  color: var(--text-2);
  font-size: 0.875rem;
}

.phead-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 14px 0 0;
}

.fact dt {
  color: var(--text-2);
  font-size: 0.8125rem;
}

.fact dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pbody {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

.actions .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions .hint {
  margin-top: 10px;
}

.sub {
  margin: 20px 0 10px;
  font: 600 1rem/1.3 var(--font-ui);
}

.give {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

.give .form-msg {
  grid-column: 1 / -1;
}

.combo-wrap {
  position: relative;
}

.combo-list {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 16rem;
  margin: 4px 0 0;
  padding: 4px;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--ctl);
  border-radius: var(--r-sm);
  background: var(--raised);
  box-shadow: var(--shadow);
}

.combo-opt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.combo-opt:hover {
  background: var(--line);
}

.combo-opt[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-on);
}

.combo-title {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.combo-detail {
  color: var(--text-2);
  font: 0.75rem var(--font-mono);
  overflow-wrap: anywhere;
}

.combo-opt[aria-selected="true"] .combo-detail {
  color: inherit;
}

.combo-note {
  padding: 8px 10px;
  color: var(--text-2);
}

.results {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--surface);
}

.result .icon {
  margin-top: 0.3em;
}

.result.is-ok {
  border-left-color: var(--good);
}

.result.is-ok .icon {
  color: var(--good);
}

.result.is-bad {
  border-left-color: var(--bad);
}

.result.is-bad .icon {
  color: var(--bad);
}

.result-time {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15em;
}

.result-text {
  overflow-wrap: anywhere;
}

.stats-two {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}

.stats-two h2 {
  margin-bottom: 10px;
}

.extra {
  margin: 0;
  padding: 2px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.extra-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.extra-row:last-child {
  border-bottom: 0;
}

.extra-row dt {
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.extra-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.tablist {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-bottom: 4px solid transparent;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}

.tab:focus-visible {
  outline-offset: -4px;
}

.tabpanel {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

/* An empty status line still has to exist (it is a live region), but it should not take up a row. */
.tabpanel .result-count:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.cont-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.cont-source {
  margin: 0;
  color: var(--text-2);
}

.cont-source strong {
  color: var(--text);
}

.filter {
  max-width: 24rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cards-empty {
  grid-column: 1 / -1;
}

.icard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

.icard-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.amount {
  flex: none;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--accent);
}

.iname {
  min-width: 0;
  overflow-wrap: anywhere;
}

.imeta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.imeta .id {
  color: var(--text);
}

.imeta span {
  overflow-wrap: anywhere;
}

.islot {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.lore summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--accent-ink);
  font-size: 0.875rem;
  cursor: pointer;
}

.lore-lines {
  padding: 6px 0 2px 10px;
  border-left: 2px solid var(--line-strong);
}

.lore-lines p {
  min-height: 1.2em;
  margin: 2px 0;
  color: var(--text-2);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.icard-actions {
  margin-top: auto;
  padding-top: 4px;
}

/* ---------- dialog ---------- */

.dlg {
  width: min(92vw, 30rem);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dlg::backdrop {
  background: var(--backdrop);
}

.dlg-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.dlg-title {
  margin: 0;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.dlg-intro {
  margin: 0;
  color: var(--text-2);
}

.dlg-code {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  font: 0.875rem/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.dlg.is-busy {
  cursor: progress;
}

/* ---------- console ---------- */

.console-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

.pane {
  height: 17rem;
  margin-bottom: 12px;
  padding: 8px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font: 0.8125rem/1.55 var(--font-mono);
}

.pane-empty {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
}

.out-line {
  display: flex;
  gap: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.out-line .icon {
  margin-top: 0.3em;
  color: var(--bad);
}

.out-cmd {
  margin-top: 8px;
  color: var(--accent-ink);
  font-weight: 700;
}

.out-cmd::before {
  content: ">";
}

.out-cmd:first-child {
  margin-top: 0;
}

.cmd-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.cmd-form .field.grow {
  flex-basis: 10rem;
}

.cmd-input {
  font-family: var(--font-mono);
}

.log-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.log-tools .check {
  margin-left: auto;
}

.log-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-line.is-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

.log-line.is-error {
  background: color-mix(in srgb, var(--bad) 20%, transparent);
}

.log-status {
  margin: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.pane:focus-visible {
  outline-offset: 0;
}

/* ---------- wider screens ---------- */

@media (max-width: 719px) {
  .top {
    gap: 0 12px;
  }

  .nav {
    order: 3;
    flex: 1 1 100%;
    margin: 0 -16px;
    padding: 0 12px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
  }

  .nav a {
    min-height: 48px;
  }

  .brand-sub {
    display: none;
  }

  .who-name {
    max-width: 8rem;
  }
}

@media (max-width: 480px) {
  .table {
    font-size: 0.875rem;
  }

  .table th,
  .table td {
    padding: 9px 8px;
  }

  .table thead th {
    white-space: normal;
  }

  .dlg-actions {
    flex-direction: column-reverse;
  }

  .dlg-actions .btn {
    width: 100%;
  }

  .seg-btn {
    padding: 0 10px;
  }

  .tile {
    padding: 12px;
  }

  .login-card {
    padding: 22px 18px;
  }

  .log-tools .check {
    margin-left: 0;
  }
}

@media (min-width: 560px) {
  /* Columns line up from row to row; the empty role slot keeps them in place for players who are not staff. */
  .prow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.5rem 6.5rem 8rem;
    gap: 4px 16px;
  }

  .prow .badge {
    justify-self: start;
  }

  .pseen {
    text-align: right;
  }
}

@media (min-width: 700px) {
  .give {
    grid-template-columns: minmax(0, 1fr) 8rem auto;
    align-items: end;
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 700px) {
  .pane {
    height: 22rem;
  }
}

@media (min-width: 900px) {
  .main {
    padding: 28px 24px 72px;
  }

  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tile-hero {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    justify-content: space-between;
  }

  .tile:nth-child(6),
  .tile:nth-child(7) {
    grid-column: span 2;
  }

  .stats-two {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }

  .top {
    padding: 0 24px;
  }
}

@media (min-width: 1000px) {
  .console-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .pane {
    height: 28rem;
  }
}

/* ---------- motion, only when asked for ---------- */

@media (prefers-reduced-motion: no-preference) {
  .meter-fill {
    transition: width 0.45s ease, background-color 0.3s ease;
  }

  .spinner {
    animation: spin 0.9s linear infinite;
  }

  .dlg[open] {
    animation: dlg-in 0.16s ease-out;
  }

  .dlg[open]::backdrop {
    animation: fade-in 0.16s ease-out;
  }

  .chart-plot,
  .list-host {
    transition: opacity 0.2s ease;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dlg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------- Windows high contrast and friends ---------- */

@media (forced-colors: active) {
  .meter {
    border-color: CanvasText;
  }

  .meter-fill {
    background: Highlight;
  }

  .chip,
  .badge,
  .amount,
  .result {
    border-color: CanvasText;
  }

  .presence.is-on .dot {
    background: CanvasText;
  }

  .ch-line-1 {
    stroke: Highlight;
  }

  .ch-line-2 {
    stroke: LinkText;
    stroke-dasharray: 6 3;
  }

  .seg-btn[aria-pressed="true"],
  .tab[aria-selected="true"] {
    outline: 2px solid Highlight;
    outline-offset: -4px;
  }
}
