/* ── Tokens ─────────────────────────────────────────────────────────────────
   One palette, gold on near-black, taken from 9kohorta.com (its own CSS variables:
   --gold #d4a843, --bg #07060a, --bg-card #1a1624, --text #f0e6cc, --text-dim #a09070).
   There is no light theme and no toggle: the guild's site is dark, and a second theme is a second
   set of contrast decisions to keep correct for no one's benefit. */
:root {
  color-scheme: dark;
  --page: #07060a;
  --surface: #1a1624;
  --ink: #f0e6cc;
  --ink-2: #a09070;
  --muted: #7d6f56;
  /* Chart furniture is gold at low alpha, so it sits under the data instead of next to it. */
  --grid: rgba(212, 168, 67, .12);
  --axis: rgba(212, 168, 67, .34);
  --border: rgba(212, 168, 67, .18);
  --series: #d4a843;
  --series-soft: #f0cc70;
  --good: #62d995;
  --bad: #f87171;
  /* Class colours: one hue per class, fixed (colour follows the entity, never its rank), stepped for
     a near-black surface. A ninth class (Fighter) gets no hue and falls back to --muted. These stay
     distinct rather than gold, because they are how a role reads at a glance — but they only ever
     tint an avatar ring or a pill border; the class name and icon carry the identity. */
  --cls-gladiator: #e66767; --cls-templar: #5b9ce8; --cls-ranger: #4fb985; --cls-assassin: #d4a843;
  --cls-elementalist: #45c49a; --cls-sorcerer: #a08ce9; --cls-cleric: #e08bb0; --cls-chanter: #e0803f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px -18px rgba(0, 0, 0, .85);
  --glass: var(--surface);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  /* Character and item names are CJK on kr/tw — keep a CJK-capable fallback chain. */
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Noto Sans TC", "PingFang TC",
    "Microsoft JhengHei", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


.shell { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }

/* ── Header + summary ───────────────────────────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 14px; }
.top__meta { color: var(--ink-2); font-size: 13.5px; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile {
  padding: 14px 16px; background: var(--glass); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms);
}
.tile__label { color: var(--ink-2); font-size: 12.5px; }
.tile__value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.tile__sub { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope { margin: -6px 0 14px; color: var(--ink-2); font-size: 13.5px; }
.scope a { color: var(--ink); }
.filters { margin: -6px 0 14px; }
.filter {
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 600; transition: background .2s, color .2s;
}
.filter:hover { color: var(--ink); }
.filter[aria-pressed="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); border-color: var(--ink-2); }

/* ── Roster rows ────────────────────────────────────────────────────────── */
.roster { display: grid; gap: 30px; }
.role { display: grid; gap: 12px; }
.role__head { display: flex; align-items: center; gap: 9px; padding: 0 4px; color: var(--ink-2); }
.role__head::after { content: ""; flex: 1; height: 1px; margin-left: 6px; background: var(--grid); }
.role__glyph { width: 18px; height: 18px; flex: none; }
.role__title { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.role__count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.role__list { display: grid; gap: 12px; }
.member {
  --accent: var(--muted);
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms);
  transition: border-color .3s, box-shadow .4s var(--ease);
}
.member[data-class="GLADIATOR"] { --accent: var(--cls-gladiator); }
.member[data-class="TEMPLAR"] { --accent: var(--cls-templar); }
.member[data-class="RANGER"] { --accent: var(--cls-ranger); }
.member[data-class="ASSASSIN"] { --accent: var(--cls-assassin); }
.member[data-class="ELEMENTALIST"] { --accent: var(--cls-elementalist); }
.member[data-class="SORCERER"] { --accent: var(--cls-sorcerer); }
.member[data-class="CLERIC"] { --accent: var(--cls-cleric); }
.member[data-class="CHANTER"] { --accent: var(--cls-chanter); }
.member.is-open { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.member__head {
  --mx: 50%; --my: 50%;
  position: relative; display: grid; width: 100%; align-items: center; text-align: left; cursor: pointer;
  grid-template-columns: 34px 56px minmax(0, 1fr) 70px 160px 190px 24px; column-gap: 16px;
  padding: 16px 20px 16px 22px; background: none; border: 0; border-radius: 20px;
}
.member__head::before { /* pointer spotlight */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.member__head:hover::before { opacity: 1; }

.rank { color: var(--ink-2); font-size: 20px; font-weight: 650; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.avatar {
  position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; overflow: hidden;
  color: #fff; font-size: 22px; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #000));
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--accent) 70%, transparent);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Wraps `.avatar` purely so the class badge can sit outside its rounded/clipped box, in the
   corner, without `.avatar` itself losing the overflow:hidden it needs to clip the photo. */
.avatar-wrap { position: relative; display: inline-block; transition: transform .4s var(--ease); }
.member__head:hover .avatar-wrap { transform: scale(1.05) rotate(-1.5deg); }
.avatar__badge {
  position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 8px;
  object-fit: cover; display: block; background: var(--surface);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent);
}
.avatar__badge--none { width: 14px; height: 14px; right: -1px; bottom: -1px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }

.who { min-width: 0; display: grid; gap: 1px; }
.name { font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Activity hint — deliberately quiet: a small dot, meaning carried by the tooltip. */
/* Sits beside the name in its own flex row so the name keeps its ellipsis. */
.nameline { display: flex; align-items: center; min-width: 0; }
.dot {
  flex: none; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 18%, transparent);
}
.dot.is-active { --tone: var(--good); }
.dot.is-unknown { --tone: #d9a520; }
.dot.is-inactive { --tone: var(--bad); }

.meta, .guild { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Class chip. Text wears text tokens; the accent only rings the icon. */
.cls { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; color: var(--ink); font-weight: 600; }
/* The class emblems carry their own opaque backdrop, so the tint is a thin outline rather than a
   filled plate — a heavier ring reads as a coloured frame around the art instead of a class cue. */
.cls__icon {
  width: 20px; height: 20px; flex: none; border-radius: 6px; object-fit: cover; display: block;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}
.cls__icon--none { border-radius: 50%; width: 9px; height: 9px; margin: 0 5.5px; background: var(--accent); box-shadow: none; }
.cls__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cls__tag { margin-left: 8px; padding: 0 7px; vertical-align: middle; font-size: 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); }
.meta__rest { margin-left: 6px; }
.guild::before { content: "◆"; font-size: 8px; vertical-align: 2px; margin-right: 6px; color: var(--accent); }
.guild--none { opacity: .75; }
.guild--none::before { content: none; }
.lvl { min-width: 0; }
.lvl__label { color: var(--ink-2); font-size: 12px; }
.lvl b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.025em; color: var(--ink); line-height: 1.15; }

.metric { min-width: 0; }
.metric__label { color: var(--ink-2); font-size: 12px; }
.metric__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metric__value { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.metric--cp .metric__value { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }

.chev { width: 24px; height: 24px; color: var(--ink-2); transition: transform .5s var(--ease), color .2s; }
.member__head:hover .chev { color: var(--ink); }
.member.is-open .chev { transform: rotate(180deg); }

/* Delta pill: direction is carried by the triangle + explicit sign, colour only tints. */
.delta {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; color: var(--ink);
  background: color-mix(in srgb, var(--tone) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 32%, transparent);
}
.delta svg { width: 9px; height: 9px; color: var(--tone); flex: none; }
.delta--up { --tone: var(--good); }
.delta--down { --tone: var(--bad); }
.delta--flat { --tone: var(--muted); font-weight: 500; color: var(--ink-2); padding-left: 8px; }
.delta--sm { font-size: 11.5px; padding: 0 6px 0 5px; }
.delta--sm svg { width: 8px; height: 8px; }

/* ── Expanding panel (grid 0fr → 1fr animates to content height, no JS measuring) ── */
.member__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease); }
.member.is-open .member__panel { grid-template-rows: 1fr; }
.member__clip { overflow: hidden; min-height: 0; }
.panel {
  display: grid; gap: 22px 28px; padding: 6px 24px 24px; border-top: 1px solid var(--border);
  margin: 0 20px; padding-inline: 2px; padding-top: 20px;
  opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .5s var(--ease);
}
.member.is-open .panel { opacity: 1; transform: none; transition-delay: .12s; }
/* Grid items default to min-width:auto and would grow to their content (long item names, the SVG)
   instead of shrinking — that pushed the panel past the card edge, where overflow:hidden clipped it. */
.panel { grid-template-columns: minmax(0, 1fr); }
.panel > section { min-width: 0; }
.tl { grid-template-columns: minmax(0, 1fr); }
.chip { min-width: 0; }
@media (min-width: 980px) { .panel:not(.panel--tabs):not(.tabpanel--eq) { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }

.panel h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; text-transform: uppercase; }
.panel__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.seg button {
  padding: 4px 12px; border: 0; border-radius: 7px; cursor: pointer; background: none; color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; transition: background .2s, color .2s;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

.rangesum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 6px; }
.rs { display: grid; gap: 3px; justify-items: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.rs__label { color: var(--ink-2); font-size: 12px; }
.rs__val { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }

/* Chart */
.chart { position: relative; touch-action: pan-y; outline-offset: 4px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series); opacity: .1; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .xhair { stroke: var(--axis); stroke-width: 1; }
.chart .endlabel { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart.is-drawing .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) .1s forwards; }
.chart.is-drawing .area { animation: fade .8s ease .5s backwards; }
.chart.is-drawing .dot--end { animation: pop .5s var(--ease) 1s backwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0); } }
.dot--end { transform-box: fill-box; transform-origin: center; }
.chart__empty { padding: 34px 0; text-align: center; color: var(--ink-2); font-size: 13.5px; }

.datatable { margin-top: 10px; font-size: 13px; }
.datatable summary { cursor: pointer; color: var(--ink-2); width: max-content; }
.datatable summary:hover { color: var(--ink); }
.datatable__scroll { max-height: 220px; overflow: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; }
.datatable table { width: 100%; border-collapse: collapse; }
.datatable th, .datatable td { padding: 6px 12px; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--grid); }
.datatable th:first-child, .datatable td:first-child { text-align: left; }
.datatable th { position: sticky; top: 0; background: var(--surface); color: var(--ink-2); font-weight: 600; }

/* Floating tooltip (values lead, labels follow) */
.tip {
  position: fixed; z-index: 20; pointer-events: none; min-width: 150px; padding: 9px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow), 0 12px 32px -10px rgba(0, 0, 0, .45);
  font-size: 12.5px; transform: translate(-50%, calc(-100% - 14px)); opacity: 0; transition: opacity .12s;
}
.tip.is-on { opacity: 1; }
.tip__when { color: var(--ink-2); }
.tip__row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip__key { width: 14px; height: 2px; border-radius: 2px; background: var(--series); flex: none; }
.tip__val { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.tip__sub { color: var(--ink-2); margin-top: 3px; }

/* Timeline */
.tl { position: relative; display: grid; gap: 14px; margin-top: 4px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--grid); }
.tl__item { position: relative; padding-left: 26px; }
.tl__item.is-new { animation: rise .5s var(--ease) both; animation-delay: calc(var(--n, 0) * 40ms); }
.tl__dot {
  position: absolute; left: 0; top: 5px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--axis);
}
.tl__item--up > .tl__dot { border-color: var(--good); }
.tl__item--down > .tl__dot { border-color: var(--bad); }
.tl__item--first > .tl__dot { border-color: var(--series); }
.tl__head { display: flex; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; }
.tl__when { font-weight: 600; font-size: 13.5px; }
.tl__when small { font-weight: 400; color: var(--ink-2); font-size: 12px; margin-left: 4px; }
.tl__stats { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; }
.tl__stat b { color: var(--ink); font-weight: 650; margin-right: 3px; }
.tl__tag { font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); }
.tl__quiet { position: relative; padding-left: 26px; color: var(--ink-2); font-size: 12.5px; }
.tl__quiet::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--axis); }
.tl__more { margin-top: 14px; }

.changes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 3px 10px 3px 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 5%, transparent); border: 1px solid var(--border); font-size: 12.5px; color: var(--ink);
}
.chip--text { padding-left: 10px; }
.chip__label { color: var(--ink-2); flex: none; }
.chip__what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__arrow { color: var(--muted); margin: 0 3px; }
.gear {
  --grade: var(--axis);
  display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; overflow: hidden;
  background: color-mix(in srgb, var(--grade) 22%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--grade);
  font-size: 9.5px; font-weight: 700; color: var(--ink-2);
}
.gear img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Straight from the game's stylesheet (--grade-color-N), so the dashboard, the Discord sheet and
   the game itself all agree. Scale: Common < Rare < Legend < Unique < Epic < Mythic; Special is separate. */
[data-grade="None"],
[data-grade="Common"] { --grade: #ededeb; }
[data-grade="Rare"] { --grade: #52b35c; }
[data-grade="Legend"] { --grade: #3d94d8; }
[data-grade="Unique"] { --grade: #e9a43a; }
[data-grade="Epic"] { --grade: #ee6c2a; }
[data-grade="Mythic"] { --grade: #d33939; }
[data-grade="Special"] { --grade: #34b798; }

/* The tab bar owns the divider; the panels below it must not repeat it. */
.panel--tabs { padding-bottom: 0; }
.tabpanel { border-top: 0; padding-top: 12px; }
/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.tabs button {
  padding: 5px 14px; border: 0; border-radius: 8px; cursor: pointer; background: none; color: var(--ink-2);
  font-size: 13px; font-weight: 600; transition: background .2s, color .2s;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.tabpanel[hidden] { display: none !important; }
.tabpanel { animation: rise .45s var(--ease) both; }

/* ── Equipment ──────────────────────────────────────────────────────────── */
.eq { display: grid; gap: 18px; }
@media (min-width: 980px) { .eq { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.eq__main { display: grid; gap: 16px; min-width: 0; }
.eq__group h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .02em; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }

.slot {
  --grade: var(--axis);
  position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--grade) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--grade) 55%, transparent);
  border-radius: 12px; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s, border-color .2s;
}
.slot:hover { transform: translateY(-2px); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--grade) 80%, transparent); }
.slot[aria-pressed="true"] { border-color: var(--grade); box-shadow: 0 0 0 2px color-mix(in srgb, var(--grade) 45%, transparent); }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot__fallback { font-size: 10px; font-weight: 600; color: var(--ink-2); text-align: center; padding: 4px; line-height: 1.2; }
.slot__ench {
  position: absolute; right: 3px; bottom: 2px; padding: 0 4px; border-radius: 6px; font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(0, 0, 0, .68); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); font-variant-numeric: tabular-nums;
}
.slot__exceed { position: absolute; left: 3px; top: 2px; font-size: 10px; font-weight: 700; color: #ffd76e; text-shadow: 0 1px 2px rgba(0,0,0,.9); }

/* Side panel with the item's live details */
.eq__side { position: sticky; top: 16px; display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--ink) 3%, transparent); min-height: 140px; }
.eq__side h4 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.eq__hint { color: var(--ink-2); font-size: 13px; }
.item__top { display: flex; gap: 10px; align-items: flex-start; }
.item__icon { --grade: var(--axis); width: 46px; height: 46px; flex: none; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--grade) 18%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--grade); }
.item__icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item__grade { font-size: 12px; color: var(--ink-2); }
.item__meta { color: var(--ink-2); font-size: 12px; }
.statlist { display: grid; gap: 3px; font-size: 13px; }
.statlist div { display: flex; justify-content: space-between; gap: 10px; }
.statlist b { font-weight: 650; font-variant-numeric: tabular-nums; }
.statlist--sub { color: var(--ink-2); }
.item__section { border-top: 1px solid var(--border); padding-top: 9px; }
.item__section > span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: 5px; }
.godstone { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; }
.godstone img { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.godstone small { display: block; color: var(--ink-2); white-space: pre-line; margin-top: 2px; }
.eq__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; }
.eq__select { padding: 5px 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; }
.eq__note { padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border); background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink-2); font-size: 12.5px; }

/* ── States, footer ─────────────────────────────────────────────────────── */
.state { padding: 60px 16px; text-align: center; color: var(--ink-2); }
.state:empty { display: none; }
.state button, .btn {
  margin-top: 12px; padding: 8px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
  background: var(--glass); color: var(--ink); border: 1px solid var(--border); transition: transform .2s var(--ease), border-color .2s;
}
.state button:hover, .btn:hover { transform: translateY(-1px); border-color: var(--axis); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 30px; color: var(--ink-2); font-size: 12.5px; }
.is-refetching .roster { opacity: .55; transition: opacity .2s; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member__head {
    grid-template-columns: 24px 52px minmax(0, 1fr) 24px; grid-template-areas: "rank avatar who chev" ". metrics metrics metrics";
    row-gap: 12px; column-gap: 12px; padding: 14px 14px 14px 18px;
  }
  .rank { grid-area: rank; } .avatar-wrap { grid-area: avatar; } .avatar { width: 52px; height: 52px; } .avatar__badge { width: 22px; height: 22px; } .who { grid-area: who; } .chev { grid-area: chev; }
  .metrics { grid-area: metrics; display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; }
  .panel { margin: 0 14px; }
}
@media (min-width: 901px) { .metrics { display: contents; } }
/* Phones: level | item level | combat power in one row, delta pills stacked under the values. */
@media (max-width: 560px) {
  .metrics { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: end; }
  .metric__row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .metric__value { font-size: 22px; }
  .lvl b { font-size: 22px; }
  .metric--cp .metric__value { font-size: 22px; }
  .tile__value { font-size: 22px; }
  .panel { margin: 0 12px; }
  .foot { flex-direction: column; }
}

/* Motion is decoration — never a requirement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .chart.is-drawing .line { stroke-dasharray: none; stroke-dashoffset: 0; }
}

/* ── Group builder (/grupy) ─────────────────────────────────────────────────
   Shares the tokens, avatar and class chip with the roster page. Member rows are `.seat`, not
   `.slot` — that one already belongs to the equipment grid, and both pages load this file. */
/* Header navigation, shared by both pages. Deliberately not `.tabs` — that class already belongs to
   the Przebieg/Ekwipunek tablist inside a character card, and both pages load this stylesheet. */
.topnav { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.topnav__tab {
  padding: 6px 14px; border-radius: 9px; color: var(--ink-2); font-size: 13px; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: background .2s, color .2s;
}
.topnav__tab:hover { color: var(--ink); }
.topnav__tab[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

.builder { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.builder__col { display: grid; gap: 12px; min-width: 0; }
.builder__col--pool { position: sticky; top: 14px; }
.builder__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.builder__title { font-size: 15px; font-weight: 650; letter-spacing: .01em; }
.builder__hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 12.5px; }
/* .btn carries a top margin for its use under .state; in toolbars it must sit flush. */
.builder .btn { margin-top: 0; }
.btn--primary { background: var(--series); border-color: transparent; color: #17120a; }
.btn--primary:hover { border-color: transparent; filter: brightness(1.08); }
.btn--ghost { background: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.input {
  min-width: 0; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.input:disabled { opacity: .45; }
.input--num { width: 70px; }
.input--quota { width: 58px; text-align: center; }
.input--search { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink-2); font-size: 12.5px; }

.groups { display: grid; gap: 12px; }
.grp {
  display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
}
.grp.is-active { border-color: color-mix(in srgb, var(--series) 55%, var(--border)); }
.grp.is-dirty { box-shadow: var(--shadow), inset 3px 0 0 var(--series); }
.grp__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grp__name { flex: 1; min-width: 150px; font-weight: 650; }
.grp__name--static { padding: 7px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp__count { font-weight: 650; font-variant-numeric: tabular-nums; }
.grp__comp { color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.grp__dirty { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--series); background: color-mix(in srgb, var(--series) 14%, transparent); }
.grp__tools { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 10px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.grp__actions { display: flex; gap: 8px; margin-left: auto; }
.grp__members { display: grid; gap: 6px; }
.grp__empty { padding: 6px 2px; color: var(--ink-2); font-size: 13px; }
.grp__empty--page { padding: 28px; text-align: center; border: 1px dashed var(--border); border-radius: 16px; }
.grp__status { font-size: 12.5px; }
.grp__status--ok { color: var(--good); }
.grp__status--warn { color: var(--ink-2); }
.grp__status--bad { color: var(--bad); }

.field { display: grid; gap: 5px; }
.field__label { color: var(--ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.quotas { display: flex; gap: 6px; }
.quota { display: grid; gap: 3px; justify-items: center; }
.quota__label { color: var(--ink-2); font-size: 11px; }

.seat, .pool__row {
  --accent: var(--muted);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.seat__no { width: 20px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.seat__who, .pool__who { flex: 1; min-width: 0; display: grid; gap: 1px; }
.seat__name, .pool__name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.seat__meta, .pool__meta { min-width: 0; color: var(--ink-2); font-size: 12px; }
.seat__nums, .pool__nums { display: grid; justify-items: end; gap: 0; line-height: 1.25; }
.seat__gs, .pool__gs { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.seat__cp, .pool__cp { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.avatar--sm {
  width: 34px; height: 34px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px color-mix(in srgb, var(--accent) 60%, transparent);
}

.poolbar { display: flex; align-items: center; gap: 10px; }
.pool { display: grid; gap: 14px; max-height: calc(100vh - 220px); overflow: auto; padding-right: 2px; }
.poolsec { display: grid; gap: 6px; }
.poolsec__head { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.poolsec__count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.poolsec__list { display: grid; gap: 6px; }
.builder__count { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.pool__row.is-taken { opacity: .6; }
.pool__empty { padding: 10px 2px; color: var(--ink-2); font-size: 13px; }

.pill { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); font-size: 11px; font-weight: 650; white-space: nowrap; }
.pill--tank { color: var(--cls-templar); border-color: color-mix(in srgb, var(--cls-templar) 40%, var(--border)); }
.pill--healer { color: var(--cls-cleric); border-color: color-mix(in srgb, var(--cls-cleric) 40%, var(--border)); }
.pill--support { color: var(--cls-chanter); border-color: color-mix(in srgb, var(--cls-chanter) 40%, var(--border)); }
.pill--dps { color: var(--cls-gladiator); border-color: color-mix(in srgb, var(--cls-gladiator) 40%, var(--border)); }

/* Amber, never red: being in two groups is a note, not an error. */
.warn { color: #f0b429; font-size: 12px; line-height: 1; }
.warn--none { width: 10px; }

.iconbtn {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; padding: 0;
  border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--ink-2);
  line-height: 0; cursor: pointer; transition: color .2s, border-color .2s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--axis); }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }
.iconbtn--danger:hover { color: var(--bad); border-color: var(--bad); }


/* Two parties played as one Abyss raid, joined by the chain between them. */
.raid {
  display: grid; gap: 8px; padding: 10px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--series) 35%, var(--border));
  background: color-mix(in srgb, var(--series) 4%, transparent);
}
.raid__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 2px 4px 0; }
.raid__title { color: var(--series); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.raid__count { font-weight: 650; font-variant-numeric: tabular-nums; }
.raid__dup { color: #f0b429; font-size: 12px; }
.raid .grp { border-radius: 14px; }

.chainrow { display: grid; place-items: center; }
.chain {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--muted);
  cursor: pointer; transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.chain:hover { color: var(--ink); border-color: var(--axis); transform: scale(1.08); }
.chain.is-linked { color: var(--series); border-color: color-mix(in srgb, var(--series) 45%, var(--border)); }

:is(.seat, .pool__row)[data-class="GLADIATOR"] { --accent: var(--cls-gladiator); }
:is(.seat, .pool__row)[data-class="TEMPLAR"] { --accent: var(--cls-templar); }
:is(.seat, .pool__row)[data-class="RANGER"] { --accent: var(--cls-ranger); }
:is(.seat, .pool__row)[data-class="ASSASSIN"] { --accent: var(--cls-assassin); }
:is(.seat, .pool__row)[data-class="ELEMENTALIST"] { --accent: var(--cls-elementalist); }
:is(.seat, .pool__row)[data-class="SORCERER"] { --accent: var(--cls-sorcerer); }
:is(.seat, .pool__row)[data-class="CLERIC"] { --accent: var(--cls-cleric); }
:is(.seat, .pool__row)[data-class="CHANTER"] { --accent: var(--cls-chanter); }

@media (max-width: 900px) {
  .builder { grid-template-columns: minmax(0, 1fr); }
  .builder__col--pool { position: static; }
  .pool { max-height: none; }
  .grp__actions { margin-left: 0; }
}

/* ── Logowanie (chip w nagłówku + ekran /auth) ───────────────────────────────
   Shares the shell/tokens with the rest of the app; `.top` already used flex space-between, so the
   chip is a third flex item that pushes to the far right without touching .topnav's own layout. */
.top { flex-wrap: wrap; }
.user { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.user:empty { display: none; }
.user__avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.user__name { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user__level { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); font-size: 11px; font-weight: 650; white-space: nowrap; color: var(--ink-2); }
.user__level--editor { color: var(--series); border-color: color-mix(in srgb, var(--series) 40%, var(--border)); }
.user__level--admin { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.user__logout {
  padding: 4px 9px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--ink-2);
  font-size: 12px; cursor: pointer; transition: color .2s, border-color .2s;
}
.user__logout:hover { color: var(--ink); border-color: var(--axis); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card {
  width: 100%; max-width: 380px; padding: 32px 28px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: grid; gap: 14px; justify-items: center; text-align: center;
}
.login__title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.login__lead { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.login__reason { color: var(--bad); font-size: 13px; line-height: 1.5; }
.login__state { color: var(--ink-2); font-size: 12.5px; }
.btn--discord {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 10px 18px;
  text-decoration: none;
}
.link-btn {
  background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 12.5px; text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

@media (max-width: 560px) {
  .user__name { max-width: 88px; }
}

/* Server picker (`/`): only ever seen by someone who can open more than one panel. */
.picker { display: grid; gap: 8px; width: 100%; }
.picker__row { display: block; }
.picker__link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--glass);
  color: var(--ink); text-decoration: none; transition: border-color .2s, transform .2s var(--ease);
}
.picker__link:hover { border-color: var(--axis); transform: translateY(-1px); }
.picker__name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user__server {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none;
}
.user__server:hover { color: var(--ink); }
@media (max-width: 560px) { .user__server { max-width: 90px; } }

/* ─── language switch (filled by i18n.js) ─────────────────────────────────── */
.langswitch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.langswitch:empty { display: none; }
.langswitch__btn {
  padding: 4px 9px; border: 0; border-radius: 7px; background: none; color: var(--ink-2);
  font: inherit; font-size: 12px; font-weight: 650; letter-spacing: .02em; cursor: pointer; transition: background .2s, color .2s;
}
.langswitch__btn:hover { color: var(--ink); }
.langswitch__btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.login__card .langswitch { margin-top: 18px; }
