/* =====================================================================
   chia-gaming-tracker — casino noir × cyberpunk, mirroring ChiaGaming
   ===================================================================== */

:root {
  /* Surface */
  --bg:                hsl(160 30% 5%);
  --bg-felt-deep:      hsl(152 45% 4%);
  --bg-felt-rim:       hsl(152 45% 14%);
  --surface:           hsl(160 25% 9%);
  --surface-raised:    hsl(160 22% 12%);
  --surface-input:     hsl(160 24% 8%);
  --rule:              hsl(160 22% 18% / 0.7);
  --rule-strong:       hsl(160 22% 24%);

  /* Ink */
  --ink:               hsl(42 25% 96%);
  --ink-mute:          hsl(42 12% 78%);
  --ink-soft:          hsl(160 8% 56%);
  --ink-faint:         hsl(160 10% 38%);
  --ink-inverse:       hsl(160 30% 6%);

  /* Accents */
  --gold:              hsl(48 95% 53%);
  --gold-bright:       hsl(48 100% 60%);
  --gold-soft:         hsl(48 100% 70%);
  --gold-glow:         hsl(48 100% 50% / 0.45);
  --coral:             hsl(15 80% 55%);

  /* Status — semantic */
  --status-waiting:    hsl(36 100% 60%);
  --status-active:     hsl(188 90% 58%);
  --status-playing:    hsl(142 76% 50%);
  --status-closed:     hsl(160 8% 50%);
  --status-error:      hsl(358 82% 64%);
  --sc-funding:        hsl(262 78% 72%);
  --sc-mempool:        hsl(22 95% 64%);
  --sc-open:           hsl(142 78% 56%);
  --sc-settling:       hsl(358 82% 66%);
  --sc-settled:        hsl(160 12% 60%);

  /* Type */
  --f-display:         "Cinzel", "Playfair Display", serif;
  --f-body:            "Inter", system-ui, sans-serif;
  --f-mono:            "JetBrains Mono", ui-monospace, monospace;

  /* Lengths */
  --r-sm:              4px;
  --r-md:              10px;
  --r-lg:              18px;
  --r-pill:            999px;
  --gap-row:           18px;
  --gap-col:           20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  font-family: var(--f-body);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  display: flex;
  flex-direction: column;
}

/* ====== Felt backdrop ============================================== */
.felt {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, var(--bg-felt-rim) 0%, var(--bg-felt-deep) 70%),
    radial-gradient(ellipse 50% 40% at 88% 90%, hsl(48 70% 30% / 0.18), transparent 70%),
    radial-gradient(ellipse 50% 40% at 12% 95%, hsl(15 70% 40% / 0.14), transparent 70%);
}
.felt-grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
}

::selection { background: var(--gold); color: var(--ink-inverse); }

a { color: var(--gold); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--gold-soft); }

/* ====== Masthead =================================================== */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 24px 36px 18px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, hsl(160 30% 4% / 0.85), transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  filter: drop-shadow(0 0 12px var(--gold-glow));
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-eyebrow {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.brand-title {
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 4px 0 0;
  color: var(--ink);
  text-shadow: 0 1px 18px var(--gold-glow);
}

.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: hsl(160 30% 4% / 0.7);
  box-shadow: inset 0 1px 0 hsl(48 60% 60% / 0.05);
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 22px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  transition: color .15s ease, background .2s ease, box-shadow .2s ease;
}
.tab:hover { color: var(--gold-soft); }
.tab-active {
  color: var(--ink-inverse);
  background: var(--gold);
  box-shadow: 0 0 18px var(--gold-glow), 0 4px 0 hsl(48 95% 35%);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-closed);
  box-shadow: 0 0 0 2px hsl(160 30% 4%), 0 0 10px transparent;
  transition: background .25s, box-shadow .25s;
}
.health-dot[data-health="ok"] {
  background: var(--status-playing);
  box-shadow: 0 0 0 2px hsl(160 30% 4%), 0 0 12px hsl(142 76% 50% / 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
.health-dot[data-health="error"] {
  background: var(--status-error);
  box-shadow: 0 0 0 2px hsl(160 30% 4%), 0 0 12px hsl(358 82% 64% / 0.7);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

/* ====== Stats strip ================================================ */
.stats-strip {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px 36px 0;
  margin-bottom: 4px;
}
.chip {
  flex: 1 0 130px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.chip::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.5;
}
.chip-num {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}
.chip-label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ====== Main + views =============================================== */
main {
  flex: 1;
  padding: 20px 36px 60px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.view { display: none; animation: fadeIn .35s ease; }
.view-active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.view-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}
.view-title {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0;
  color: var(--ink);
  position: relative;
  padding-bottom: 6px;
}
.view-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -19px;
  width: 90px;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}
.view-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ====== Form controls ============================================== */
.input {
  appearance: none;
  font: inherit;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-input);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  padding: 9px 16px;
  min-width: 200px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px hsl(48 70% 50% / 0.18);
}
.input::placeholder { color: var(--ink-faint); font-style: italic; }

.input-select {
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
                    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  min-width: 170px;
}

/* ====== Grid ======================================================= */
.grid {
  display: grid;
  gap: var(--gap-col);
}
.grid-games { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-rooms { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

/* ====== Card primitives ============================================ */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px hsl(0 0% 0% / 0.45);
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: hsl(48 70% 50% / 0.5);
  box-shadow: 0 22px 50px hsl(0 0% 0% / 0.55), 0 0 26px hsl(48 95% 50% / 0.15);
}
.card-glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(180px 80px at 80% -20%, hsl(48 90% 55% / 0.15), transparent 70%);
}

/* ====== Game card ================================================== */
.game-card {
  composes: card;
}
.game-card-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}
.game-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: radial-gradient(circle at 30% 30%, hsl(160 35% 14%), hsl(152 45% 6%));
  border: 1px solid hsl(48 70% 50% / 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow);
  flex-shrink: 0;
  overflow: hidden;
}
.game-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.game-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin: 0;
}
.game-version {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
}
.role-badge {
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid currentColor;
  vertical-align: middle;
  margin-left: 4px;
}
.role-contract {
  color: var(--gold);
  background: hsl(48 95% 53% / 0.1);
}
.role-ui {
  color: var(--ink-soft);
  background: hsl(160 20% 14% / 0.5);
}
.ui-count-badge {
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  color: var(--status-active);
  background: hsl(188 90% 58% / 0.1);
  border: 1px solid hsl(188 90% 58% / 0.3);
  vertical-align: middle;
  margin-left: 4px;
}
.game-author {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  font-style: italic;
}
.game-author-mark {
  display: inline-block;
  margin-right: 4px;
  color: var(--gold);
  font-style: normal;
}
.game-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  padding: 10px 0;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
}
.game-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.game-type-label {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: hsl(160 25% 12%);
  border: 1px solid var(--rule);
  color: var(--ink-mute);
  font-weight: 500;
  text-transform: capitalize;
}
.game-hash {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  cursor: default;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-hash-label {
  color: var(--gold);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-right: 2px;
  flex-shrink: 0;
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all .18s ease;
}
.button:hover {
  background: var(--gold);
  color: var(--ink-inverse);
  box-shadow: 0 0 22px var(--gold-glow);
  transform: translateY(-1px);
}
.button-solid {
  background: var(--gold);
  color: var(--ink-inverse);
  box-shadow: 0 4px 0 hsl(48 95% 35%);
}
.button-solid:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 hsl(48 95% 35%), 0 0 22px var(--gold-glow);
}

/* ====== Room card ================================================== */
.room-card {
  position: relative;
  padding-left: 26px;
}
.room-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--status-closed);
  border-radius: 4px 0 0 4px;
}
.room-card[data-status="waiting"]::before { background: var(--status-waiting); box-shadow: 6px 0 18px -4px var(--status-waiting); }
.room-card[data-status="active"]::before  { background: var(--status-active);  box-shadow: 6px 0 18px -4px var(--status-active); }
.room-card[data-status="playing"]::before { background: var(--status-playing); box-shadow: 6px 0 22px -2px var(--status-playing); }
.room-card[data-status="closed"]::before  { background: var(--status-closed); }

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.badge[data-status="waiting"] { color: var(--status-waiting); background: hsl(36 100% 60% / 0.08); }
.badge[data-status="active"]  { color: var(--status-active);  background: hsl(188 90% 58% / 0.08); }
.badge[data-status="playing"] { color: var(--status-playing); background: hsl(142 76% 50% / 0.08); }
.badge[data-status="closed"]  { color: var(--status-closed); background: hsl(160 8% 50% / 0.06); }
.badge[data-status="waiting"]::before,
.badge[data-status="playing"]::before {
  animation: pulse 1.6s ease-in-out infinite;
}

.room-id {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.players {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}
.player {
  padding: 12px 14px;
  background: var(--surface-raised);
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.player-role {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-name {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-wallet {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-empty {
  background:
    repeating-linear-gradient(
      135deg,
      var(--surface-raised) 0 8px,
      hsl(160 22% 8%) 8px 16px
    );
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.players-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.1em;
  align-self: center;
}

.room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}
.room-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.room-meta-key { color: var(--ink-faint); }
.room-meta-val { color: var(--ink); font-weight: 600; }
.room-meta-val.gold { color: var(--gold); }

.sc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--surface-input);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--sc-border, var(--ink-faint));
  border-radius: var(--r-sm);
}
.sc-tag {
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 9.5px;
  color: var(--sc-color, var(--ink-mute));
}
.sc-funding    { --sc-border: var(--sc-funding); --sc-color: var(--sc-funding); }
.sc-mempool    { --sc-border: var(--sc-mempool); --sc-color: var(--sc-mempool); }
.sc-open       { --sc-border: var(--sc-open);    --sc-color: var(--sc-open); }
.sc-settling   { --sc-border: var(--sc-settling);--sc-color: var(--sc-settling); }
.sc-settling_mempool { --sc-border: var(--sc-settling); --sc-color: var(--sc-settling); }
.sc-settled    { --sc-border: var(--sc-settled); --sc-color: var(--sc-settled); }
.sc-pending, .sc-locked, .sc-active, .sc-cancelled { --sc-border: var(--ink-faint); --sc-color: var(--ink-mute); }

.room-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.room-time {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* ====== Modal ====================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(160 40% 2% / 0.82);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 32px 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn .2s ease; }

.modal-panel {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow:
    0 40px 100px hsl(0 0% 0% / 0.65),
    0 0 50px hsl(48 90% 50% / 0.12),
    0 0 0 1px hsl(48 80% 60% / 0.15);
  position: relative;
}
.modal-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, var(--gold), var(--coral), var(--gold));
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px dashed var(--rule);
}
.modal-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0;
}
.modal-close {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 22px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s;
}
.modal-close:hover { color: var(--coral); border-color: var(--coral); }

.manifest-body { padding: 18px 24px 24px; }
.manifest-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dotted hsl(160 18% 16% / 0.7);
  font-size: 13px;
  align-items: baseline;
}
.manifest-row:last-child { border-bottom: none; }
.manifest-label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 2px;
}
.manifest-value {
  color: var(--ink-mute);
  word-break: break-word;
  line-height: 1.5;
}
.manifest-value a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.manifest-value code {
  font-family: var(--f-mono);
  font-size: 12px;
  background: hsl(160 30% 6%);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: default;
}

.uis-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.uis-item {
  padding: 16px;
  background: hsl(160 25% 7%);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.uis-item-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.uis-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: radial-gradient(circle at 30% 30%, hsl(160 35% 14%), hsl(152 45% 6%));
  border: 1px solid hsl(48 70% 50% / 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  overflow: hidden;
}
.uis-item-icon svg { width: 100%; height: 100%; }
.uis-item-info { flex: 1; min-width: 0; }
.uis-item-name {
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.uis-item-author {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 2px;
}
.uis-item-url {
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uis-item-url a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ui-count-badge {
  cursor: pointer;
}
.ui-count-badge:hover {
  background: hsl(188 90% 58% / 0.2);
  border-color: var(--status-active);
}

/* ====== Empty state ================================================ */
.empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--rule);
  border-radius: var(--r-lg);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.empty-hint {
  display: block;
  margin-top: 10px;
  text-transform: none;
  letter-spacing: 0.04em;
  font-style: italic;
  color: var(--ink-faint);
}
.empty-hint code {
  background: var(--surface-input);
  border: 1px solid var(--rule);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gold);
}

.hidden { display: none !important; }

/* ====== Skeleton =================================================== */
.skeleton {
  height: 200px;
  border-radius: var(--r-lg);
  background: linear-gradient(
    100deg,
    hsl(160 22% 11%) 30%,
    hsl(160 25% 16%) 50%,
    hsl(160 22% 11%) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--rule);
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ====== Footer ===================================================== */
.footer {
  padding: 22px 36px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.footer-mark { color: var(--ink-soft); }
.footer-mark::first-letter { color: var(--gold); }

/* ====== Toast ====================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 30px);
  padding: 12px 22px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  box-shadow: 0 12px 30px hsl(0 0% 0% / 0.6), 0 0 18px hsl(48 90% 50% / 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast-error {
  border-color: var(--status-error);
  color: var(--status-error);
}

/* ====== Responsive ================================================= */
@media (max-width: 880px) {
  .masthead {
    grid-template-columns: 1fr;
    padding: 18px 20px;
    text-align: left;
  }
  .tabs { justify-self: start; }
  .health { justify-self: start; }
  .stats-strip { padding: 14px 20px 0; }
  main { padding: 16px 20px 50px; }
  .footer { padding: 18px 20px; flex-direction: column; gap: 10px; }
  .view-header { grid-template-columns: 1fr; }
  .view-tools { width: 100%; }
  .view-tools .input { flex: 1; min-width: 0; }
  .grid-rooms, .grid-games { grid-template-columns: 1fr; }
  .players { grid-template-columns: 1fr; }
  .players-vs { display: none; }
}
