/* ===========================================================================
   Control console
   ---------------------------------------------------------------------------
   Dark theme, locked. One accent (lime), used only for primary action, active
   state, focus and selection. Status colour is reserved for real state.

   Radius rule, applied everywhere:
     controls, inputs, cells .......... --r-ctl   (8px)
     panels, cards, modals ............ --r-panel (16px)
     pills, avatars, chips ............ --r-pill  (999px)
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces. Near-black with a cool cast, never pure #000. */
  --bg:          #08090b;
  --bg-raised:   #0d0f12;
  --surface:     #101216;
  --surface-2:   #161920;
  --surface-3:   #1d212a;

  /* Lines */
  --line:        #22262f;
  --line-soft:   #191d24;
  --line-strong: #333947;

  /* Text */
  --fg:          #eceef2;
  --fg-2:        #a3a9b7;
  --fg-3:        #6c7383;
  --fg-4:        #464c59;

  /* Accent. Single, locked. */
  --acc:         #b8f14b;
  --acc-deep:    #8fce22;
  --acc-ink:     #0b0f04;
  --acc-wash:    rgba(184, 241, 75, .09);
  --acc-wash-2:  rgba(184, 241, 75, .16);
  --acc-line:    rgba(184, 241, 75, .32);

  /* Semantic state only. Never decoration. */
  --ok:          #52d98b;
  --warn:        #f2b63c;
  --danger:      #f4736f;
  --info:        #63a4fb;
  --gold:        #f2b63c;

  --rar-normal:    #7b828f;
  --rar-rare:      #63a4fb;
  --rar-epic:      #b98cf7;
  --rar-legendary: #f2b63c;
  --rar-secret:    #f4736f;

  /* Radius */
  --r-ctl:   8px;
  --r-panel: 16px;
  --r-pill:  999px;

  /* Glass */
  --glass-tint:  rgba(20, 23, 29, .62);
  --glass-blur:  22px;
  --glass-sat:   165%;
  --glass-edge:  rgba(255, 255, 255, .10);
  --glass-spec:  rgba(255, 255, 255, .16);
  --glass-lift:  0 18px 44px -18px rgba(0, 0, 0, .78);

  /* Motion */
  --ease:  cubic-bezier(.22, 1, .36, 1);
  --fast:  .14s var(--ease);
  --med:   .28s var(--ease);

  /* Bounded scroll regions. Keeps long lists from running off the page. */
  --rows-max:    clamp(280px, 52vh, 620px);
  --rows-max-sm: clamp(220px, 34vh, 400px);
}

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient field. Fixed and inert so it never repaints on scroll. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(184, 241, 75, .055), transparent 60%),
    radial-gradient(760px 480px at 92% 4%,  rgba(99, 164, 251, .045), transparent 62%),
    radial-gradient(680px 520px at 50% 108%, rgba(184, 241, 75, .028), transparent 60%);
}
body > * { position: relative; z-index: 1; }

.mono, .num {
  font-family: 'Geist Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

code {
  font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-ctl);
  color: var(--fg-2);
  white-space: nowrap;
}

a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: var(--r-ctl);
}

::selection { background: var(--acc-wash-2); color: var(--fg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: #4a5162; background-clip: content-box; }

.hidden { display: none !important; }
.spacer { flex: 1 1 auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------------
   Liquid glass
   ---------------------------------------------------------------------------
   Approximation, not Apple's material. Apple ships Liquid Glass for Apple
   platforms; there is no official web package. Three layers stack here:
   backdrop blur + saturation, a specular edge ring, and (Chromium only) an
   SVG displacement pass injected by app.js that bends the backdrop at the rim.
   --------------------------------------------------------------------------- */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-tint);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-spec),
    inset 0 -1px 0 rgba(255, 255, 255, .035),
    var(--glass-lift);
}

/* The rim. Bright at the top-left, dim at the bottom-right, so the surface
   reads as a solid slab catching a light source rather than a flat overlay. */
.glass::after {
  content: '';
  position: absolute; inset: 0;
  z-index: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    142deg,
    rgba(255, 255, 255, .30) 0%,
    rgba(255, 255, 255, .04) 32%,
    rgba(255, 255, 255, 0)   58%,
    rgba(255, 255, 255, .10) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.glass > * { position: relative; z-index: 1; }

/* Cursor-tracked highlight. app.js writes --lx / --ly; without JS it simply
   sits at the default position and stays still. */
.glass-lit { --lx: 50%; --ly: 0%; }
.glass-lit::before {
  content: '';
  position: absolute; inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    340px circle at var(--lx) var(--ly),
    rgba(255, 255, 255, .07),
    transparent 68%
  );
  opacity: 0;
  transition: opacity var(--med);
}
.glass-lit:hover::before { opacity: 1; }

/* Injected by app.js when the browser supports backdrop-filter: url(). */
.glass-refraction {
  position: absolute; inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
}

.glass-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Transparency is decorative. If the reader has asked for less of it, drop
   every blur and serve solid surfaces instead. */
@media (prefers-reduced-transparency: reduce) {
  .glass {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--line);
  }
  .glass::after, .glass-lit::before, .glass-refraction { display: none; }
}

/* ---------------------------------------------------------------------------
   Shell
   --------------------------------------------------------------------------- */

.layout { display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 6px;
  height: 60px;
  padding: 0 20px;
  border-width: 0 0 1px 0;
  border-radius: 0;
  --glass-tint: rgba(11, 13, 17, .72);
  --glass-lift: 0 12px 32px -20px rgba(0, 0, 0, .9);
}
.topbar::after { border-radius: 0; }

.brand { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--r-ctl);
  background: linear-gradient(150deg, var(--acc), var(--acc-deep));
  color: var(--acc-ink);
  box-shadow: 0 4px 14px -4px rgba(184, 241, 75, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-name {
  font-size: 12.5px; font-weight: 650;
  letter-spacing: .085em; text-transform: uppercase;
  color: var(--fg);
}

.nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 8px; }

.nav {
  display: flex; align-items: center; gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
}
.nav-link {
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 520;
  color: var(--fg-3);
  transition: color var(--fast), background var(--fast);
}
.nav-link:hover { color: var(--fg); background: rgba(255, 255, 255, .05); text-decoration: none; }
.nav-link.active {
  color: var(--acc-ink);
  background: var(--acc);
  box-shadow: 0 2px 10px -3px rgba(184, 241, 75, .5);
}
.nav-link.active:hover { color: var(--acc-ink); background: var(--acc); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; color: var(--fg-2);
}
.user-avatar {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--acc), var(--acc-deep));
  color: var(--acc-ink);
  font-size: 10px; font-weight: 700;
}

.content {
  flex: 1;
  width: 100%; max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-title { font-size: 20px; font-weight: 620; letter-spacing: -.02em; }
.page-sub { margin-top: 3px; font-size: 12.5px; color: var(--fg-3); }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 32px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--fg);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), transform .08s var(--ease), box-shadow var(--fast);
}
.btn:active:not(:disabled) { transform: scale(.975); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--acc-ink);
  font-weight: 620;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 18px -8px rgba(184, 241, 75, .7);
}
.btn-primary:hover:not(:disabled) { background: #c6f766; border-color: #c6f766; }

.btn-success {
  background: var(--ok); border-color: var(--ok); color: #04140a; font-weight: 620;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 18px -8px rgba(82, 217, 139, .6);
}
.btn-success:hover:not(:disabled) { background: #6ce6a0; border-color: #6ce6a0; }

.btn-danger {
  background: rgba(244, 115, 111, .12);
  border-color: rgba(244, 115, 111, .42);
  color: #ff9b98;
  font-weight: 580;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(244, 115, 111, .2); border-color: rgba(244, 115, 111, .6); color: #ffb3b0;
}

.btn-ghost {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
  color: var(--fg-2);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, .075); border-color: var(--line-strong); color: var(--fg);
}

.btn-plain { color: var(--fg-3); }
.btn-plain:hover:not(:disabled) { color: var(--fg); background: rgba(255, 255, 255, .05); }

.btn-sm { min-height: 27px; padding: 4px 10px; font-size: 11.5px; }
.btn-icon { padding: 0; width: 32px; min-height: 32px; }
.btn-full { width: 100%; }
.btn-lg { min-height: 38px; padding: 9px 18px; font-size: 13px; }

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-ctl);
}
.seg-btn {
  padding: 4px 12px;
  background: transparent;
  border: none;
  border-radius: 5px;
  font: inherit; font-size: 11.5px; font-weight: 520;
  color: var(--fg-3);
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.seg-btn:hover { color: var(--fg-2); }
.seg-btn.active {
  background: var(--surface-3);
  color: var(--fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 3px rgba(0, 0, 0, .4);
}

/* ---------------------------------------------------------------------------
   Inputs
   --------------------------------------------------------------------------- */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px; font-weight: 540;
  color: var(--fg-2);
}
.field-hint { margin-top: 5px; font-size: 11px; color: var(--fg-3); }

input[type="text"], input[type="password"], input[type="search"], select {
  width: 100%;
  min-height: 34px;
  padding: 8px 11px;
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font: inherit; font-size: 13px;
  color: var(--fg);
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input:hover:not(:focus), select:hover:not(:focus) { border-color: var(--line-strong); }
input:focus, select:focus {
  border-color: var(--acc-line);
  background: rgba(0, 0, 0, .45);
  box-shadow: 0 0 0 3px var(--acc-wash);
}
input::placeholder { color: var(--fg-4); }

select {
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7383' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.search {
  position: relative;
  display: inline-flex; align-items: center;
  min-width: 200px;
}
.search input {
  padding-left: 31px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%236c7383' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px center;
}

input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  width: 16px; height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(0, 0, 0, .4);
  cursor: pointer;
  position: relative;
  transition: background var(--fast), border-color var(--fast);
}
input[type="checkbox"]:hover { border-color: var(--acc-line); }
input[type="checkbox"]:checked { background: var(--acc); border-color: var(--acc); }
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute; left: 5px; top: 1.5px;
  width: 4px; height: 9px;
  border: solid var(--acc-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.error {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  background: rgba(244, 115, 111, .09);
  border: 1px solid rgba(244, 115, 111, .28);
  border-radius: var(--r-ctl);
  font-size: 12px; color: #ff9b98;
}
.error::before {
  content: '';
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--danger);
}

/* ---------------------------------------------------------------------------
   Metric strip
   ---------------------------------------------------------------------------
   Hairlines rather than a row of identical cards. At this density, boxes add
   noise without adding hierarchy.
   --------------------------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 16px;
  border-radius: var(--r-panel);
  overflow: hidden;
}
.metric {
  padding: 16px 20px;
  border-left: 1px solid var(--line-soft);
}
.metric:first-child { border-left: none; }
.metric-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 560;
  color: var(--fg-3);
}
.metric-label svg { color: var(--fg-4); }
.metric-value {
  margin-top: 10px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 27px; font-weight: 600;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.metric-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-size: 11px; color: var(--fg-3);
}

/* Real server state, so a live indicator earns its animation. */
.live-dot {
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(82, 217, 139, .5);
  animation: livepulse 2.4s var(--ease) infinite;
}
@keyframes livepulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(82, 217, 139, .45); }
  55%      { box-shadow: 0 0 0 5px rgba(82, 217, 139, 0); }
}

/* ---------------------------------------------------------------------------
   Panels
   --------------------------------------------------------------------------- */

.panel {
  border-radius: var(--r-panel);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600;
  letter-spacing: -.01em;
}
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.count {
  padding: 2px 8px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px; font-weight: 500;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Tables
   ---------------------------------------------------------------------------
   Every list lives in a height-bounded scroll region with a pinned header, so
   a long result set scrolls inside its panel instead of stretching the page.
   --------------------------------------------------------------------------- */

.rows {
  overflow: auto;
  max-height: var(--rows-max);
  overscroll-behavior: contain;
}
.rows-sm { max-height: var(--rows-max-sm); }
.rows-auto { max-height: none; }

table { width: 100%; border-collapse: separate; border-spacing: 0; }

thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 18px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg-3);
  white-space: nowrap;
}
th.right, td.right { text-align: right; }

tbody td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--fast); }
tbody tr:hover { background: rgba(255, 255, 255, .028); }

tr.row-link { cursor: pointer; }
tr.row-link:hover .row-chevron { color: var(--acc); transform: translateX(2px); }
.row-chevron {
  display: inline-flex;
  color: var(--fg-4);
  transition: color var(--fast), transform var(--fast);
}

/* One highlight treatment, driven by real state, not decoration. */
tr.flagged td { background: linear-gradient(90deg, rgba(242, 182, 60, .09), rgba(242, 182, 60, .015)); }
tr.flagged td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
tr.flagged:hover td { background: linear-gradient(90deg, rgba(242, 182, 60, .15), rgba(242, 182, 60, .04)); }

/* Player identity cell */
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.identity-body { min-width: 0; }
.identity-name {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 13.5px; font-weight: 580;
  color: var(--fg);
}
.identity-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 3px;
  font-size: 11px; color: var(--fg-3);
}

.avatar {
  position: relative;
  display: grid; place-items: center;
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 10px;
  overflow: hidden;
  color: var(--acc-ink);
  font-size: 13px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 60px; height: 60px; border-radius: 14px; font-size: 22px; }
tr.flagged .avatar { box-shadow: inset 0 0 0 1px rgba(242, 182, 60, .6), 0 0 16px -4px rgba(242, 182, 60, .5); }

/* ---------------------------------------------------------------------------
   Pills and badges
   ---------------------------------------------------------------------------
   One shape, one weight. Colour only where it carries meaning.
   --------------------------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .035);
  font-size: 10px; font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.6;
  color: var(--fg-3);
  white-space: nowrap;
}
.pill-gold   { color: var(--gold);   background: rgba(242, 182, 60, .11);  border-color: rgba(242, 182, 60, .32); }
.pill-danger { color: #ff9b98;       background: rgba(244, 115, 111, .11); border-color: rgba(244, 115, 111, .32); }
.pill-ok     { color: var(--ok);     background: rgba(82, 217, 139, .1);   border-color: rgba(82, 217, 139, .3); }
.pill-info   { color: var(--info);   background: rgba(99, 164, 251, .1);   border-color: rgba(99, 164, 251, .3); }
.pill-mono   { font-family: 'Geist Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.pill-truncate { max-width: 190px; display: inline-block; overflow: hidden; text-overflow: ellipsis; }

/* Presence: a dot plus a word, not a coloured block. */
.presence { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 540; color: var(--fg-3); }
.presence::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--fg-4);
}
.presence.online { color: var(--ok); }
.presence.online::before { background: var(--ok); box-shadow: 0 0 8px rgba(82, 217, 139, .7); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 580;
  line-height: 1.6;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: currentColor;
}
.badge-normal    { color: var(--rar-normal);    background: rgba(123, 130, 143, .1);  border-color: rgba(123, 130, 143, .24); }
.badge-rare      { color: var(--rar-rare);      background: rgba(99, 164, 251, .1);   border-color: rgba(99, 164, 251, .24); }
.badge-epic      { color: var(--rar-epic);      background: rgba(185, 140, 247, .1);  border-color: rgba(185, 140, 247, .24); }
.badge-legendary { color: var(--rar-legendary); background: rgba(242, 182, 60, .1);   border-color: rgba(242, 182, 60, .26); }
.badge-secret    { color: var(--rar-secret);    background: rgba(244, 115, 111, .1);  border-color: rgba(244, 115, 111, .26); }
.badge-og        { color: var(--gold);          background: rgba(242, 182, 60, .16);  border-color: rgba(242, 182, 60, .42); }

.event {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 74px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 620;
  text-transform: uppercase; letter-spacing: .05em;
}
.event::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: currentColor;
}
.event.joined { color: var(--ok);     background: rgba(82, 217, 139, .1);   border-color: rgba(82, 217, 139, .28); }
.event.left   { color: var(--danger); background: rgba(244, 115, 111, .09); border-color: rgba(244, 115, 111, .26); }

/* ---------------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------------- */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, .18);
}
.pager-info {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px; color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.pager-info b { color: var(--fg-2); font-weight: 600; }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager-pages {
  min-width: 92px;
  text-align: center;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px; color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.pager-size {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--fg-3);
}
.pager-size select { width: auto; min-height: 27px; padding: 3px 28px 3px 9px; font-size: 11.5px; }

/* ---------------------------------------------------------------------------
   Player page
   --------------------------------------------------------------------------- */

.player-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: var(--r-panel);
}
.player-header .spinner-wrap { padding: 8px 0; }
.player-info { flex: 1; min-width: 0; }
.player-name {
  font-size: 21px; font-weight: 640;
  letter-spacing: -.025em;
  line-height: 1.15;
}
.player-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 9px;
  font-size: 11.5px; color: var(--fg-3);
}
.player-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.player-meta svg { color: var(--fg-4); }

.trade-status {
  display: flex; align-items: flex-start; gap: 11px;
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-panel);
  font-size: 12.5px;
}
.stx-label {
  font-size: 10.5px; font-weight: 660;
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 3px;
}
.stx-text { color: var(--fg-2); }

.trade-status.pending,
.trade-status.selecting { background: rgba(242, 182, 60, .07); border-color: rgba(242, 182, 60, .26); color: var(--warn); }
.trade-status.ready     { background: rgba(99, 164, 251, .07); border-color: rgba(99, 164, 251, .26); color: var(--info); }
.trade-status.selected,
.trade-status.complete,
.trade-status.accepted  { background: rgba(82, 217, 139, .07); border-color: rgba(82, 217, 139, .28); color: var(--ok); }
.trade-status.cancelled { background: rgba(244, 115, 111, .07); border-color: rgba(244, 115, 111, .26); color: var(--danger); }

.dot {
  position: relative;
  flex-shrink: 0;
  width: 8px; height: 8px;
  margin-top: 5px;
  border-radius: var(--r-pill);
  background: currentColor;
}
.dot::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: var(--r-pill);
  background: currentColor;
  animation: ping 1.8s var(--ease) infinite;
}
@keyframes ping {
  0%   { transform: scale(1);   opacity: .45; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Inventory grid. Explicit column widths keep the rows aligned without a
   table, which matters because rows are click targets. */
.inv-head, .inv-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 130px 150px 110px;
  align-items: center;
}
.inv-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.inv-head .inv-cell {
  padding: 10px 12px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg-3);
}
.inv-row {
  position: relative;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background var(--fast);
}
.inv-row:last-child { border-bottom: none; }
.inv-row:hover { background: rgba(255, 255, 255, .028); }
.inv-row.selected { background: var(--acc-wash); }
.inv-row.selected::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--acc);
}
.inv-cell {
  min-width: 0;
  padding: 11px 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.col-check { padding-left: 18px; }
.col-name { font-size: 13px; font-weight: 550; color: var(--fg); }
.col-mut { color: var(--fg-2); }
.col-mps {
  padding-right: 18px;
  text-align: right;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--acc);
}

/* Action bar */
.action-bar {
  position: sticky; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px;
  border-width: 1px 0 0 0;
  border-radius: 0;
  --glass-tint: rgba(11, 13, 17, .8);
}
.action-bar::after { border-radius: 0; }
.sel-summary { flex: 1 1 200px; min-width: 0; }
.sel-count { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); }
.sel-count-num {
  padding: 2px 9px;
  background: var(--acc-wash-2);
  border: 1px solid var(--acc-line);
  border-radius: var(--r-pill);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px; font-weight: 620;
  color: var(--acc);
  font-variant-numeric: tabular-nums;
}
.sel-hint { margin-top: 3px; font-size: 11px; color: var(--fg-3); }
.target-input { width: 168px; }
.target-input input {
  font-family: 'Geist Mono', ui-monospace, monospace;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Auth
   --------------------------------------------------------------------------- */

.auth-page {
  display: grid; place-items: center;
  min-height: 100dvh;
  padding: 24px;
}
.auth-wrap { width: 100%; max-width: 372px; }

.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 26px;
}
.auth-brand .brand-mark { width: 30px; height: 30px; }
.auth-brand-text { font-size: 14px; font-weight: 620; letter-spacing: .04em; text-transform: uppercase; }
.auth-brand-text .dim { color: var(--fg-3); font-weight: 500; }

.auth-card { padding: 30px 28px; border-radius: 20px; }
.auth-heading { font-size: 19px; font-weight: 620; letter-spacing: -.02em; }
.auth-sub { margin: 5px 0 24px; font-size: 12.5px; color: var(--fg-3); }
.auth-foot {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  font-size: 10.5px; font-weight: 560;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--fg-4);
}

/* ---------------------------------------------------------------------------
   Empty, loading, toast
   --------------------------------------------------------------------------- */

.empty { padding: 52px 24px; text-align: center; }
.empty-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  color: var(--fg-4);
}
.empty-title { font-size: 13.5px; font-weight: 580; color: var(--fg-2); }
.empty-sub { margin-top: 4px; font-size: 12px; color: var(--fg-4); }

.spinner-wrap { display: grid; place-items: center; padding: 44px 20px; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--acc);
  border-radius: var(--r-pill);
  animation: spin .68s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton rows match the shape of the real content they replace. */
.skeleton {
  height: 11px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 340px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .85);
  font-size: 12.5px; color: var(--fg);
  opacity: 1; transform: translateY(0);
  transition: opacity var(--med), transform var(--med);
}
.toast-out { opacity: 0; transform: translateY(6px); }
.toast-error   { border-color: rgba(244, 115, 111, .4); color: #ff9b98; }
.toast-success { border-color: rgba(82, 217, 139, .4);  color: var(--ok); }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
  .metric:nth-child(-n+2) { border-top: none; }
  .metric:nth-child(odd) { border-left: none; }
  .inv-head, .inv-row { grid-template-columns: 42px minmax(0, 1fr) 110px 96px; }
  .col-mut { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 16px 12px 32px; }
  .topbar { height: auto; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .user-chip span { display: none; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-left: none; }
  .metric:first-child { border-top: none; }
  .metric-value { font-size: 23px; }
  .search { min-width: 0; width: 100%; }
  .panel-tools { width: 100%; }
  .action-bar { padding: 10px 12px; }
  .action-bar .btn { flex: 1 1 auto; }
  .target-input { width: 100%; }
  .pager { justify-content: center; }

  /* Drop MPS as well, so the item name keeps a readable share of the row
     instead of being squeezed to a couple of words. */
  .inv-head, .inv-row { grid-template-columns: 38px minmax(0, 1fr) 100px; }
  .col-mps { display: none; }
  .inv-cell { padding: 10px 8px; }
  .col-check { padding-left: 14px; }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
