:root {
  --stone-950: #0c1710;
  --stone-900: #12251a;
  --stone-800: #193322;
  --stone-700: #2a5237;
  --parchment: #e1f2e4;
  --parchment-dim: #a8c7ae;
  --gold: #42a66b;
  --gold-bright: #78d496;
  --verified: #5fbe7d;
  --change-amber: #d98a3d;
  --change-amber-bright: #f0a856;
  --danger: #a8402c;
  --guild-banner: none;

  --font-display: "Cinzel", serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #1a3a25 0%, var(--stone-950) 60%);
  color: var(--parchment);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ambient torch glow, purely decorative, respects reduced motion */
.torch-glow {
  position: fixed;
  top: -10%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(66, 166, 107, 0.14) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.torch-glow.left { left: -10%; }
.torch-glow.right { right: -10%; top: 20%; }

@media (prefers-reduced-motion: no-preference) {
  .torch-glow { animation: flicker 6s ease-in-out infinite; }
  @keyframes flicker {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
  }
}

.site-lock {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* The `hidden` attribute normally beats everything via the UA stylesheet,
   but our own `display: flex` above is an author rule and outranks it -
   without this, toggling `.hidden = true` in JS stops actually hiding the
   lock screen once it has ever been shown. */
.site-lock[hidden] { display: none; }

.site-lock-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  text-align: center;
  padding: 36px 28px;
  border: 1px solid var(--stone-700);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(9, 30, 17, 0.94), rgba(12, 25, 16, 0.96));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.site-lock-box .crest { margin: 0 auto 16px; }
.site-lock-box h1 {
  font-size: 20px;
  margin: 0 0 6px;
}
.site-lock-subtitle {
  margin: 0 0 22px;
  color: var(--parchment-dim);
  font-size: 13px;
}
#site-lock-form { display: flex; gap: 8px; }
#site-lock-password {
  flex: 1;
  min-width: 0;
  background: var(--stone-900);
  border: 1px solid var(--stone-700);
  color: var(--parchment);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
}
#site-lock-password:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
#site-lock-form button {
  background: var(--stone-800);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--parchment);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
#site-lock-form button:hover { background: var(--gold); color: var(--stone-950); }
#site-lock-form button:disabled { opacity: 0.55; cursor: default; }

.site-lock-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 12px;
}

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--stone-700);
  background: linear-gradient(180deg, rgba(9, 30, 17, 0.92), rgba(12, 25, 16, 0.88));
  overflow: hidden;
}
.has-guild-banner .site-header {
  background-image:
    linear-gradient(90deg, rgba(9, 30, 17, 0.94), rgba(9, 30, 17, 0.68)),
    var(--guild-banner);
  background-position: center;
  /* Keep the complete Discord banner visible without stretching or cropping. */
  background-size: 100% 100%, contain;
  background-repeat: no-repeat;
}

.header-inner { display: flex; align-items: center; gap: 16px; }

.crest {
  font-size: 28px;
  color: var(--gold);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.08);
}

h1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--parchment);
  text-transform: uppercase;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--parchment-dim);
  font-size: 13px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--parchment-dim);
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--verified);
  box-shadow: 0 0 8px var(--verified);
}
.status-dot.stale { background: var(--change-amber); box-shadow: 0 0 8px var(--change-amber); }

#site-app main {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 28px;
}

.site-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: start;
  padding: 10px;
  border: 1px solid var(--stone-700);
  border-radius: 9px;
  background: var(--stone-900);
}
.site-tab {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--parchment-dim);
  padding: 9px 12px;
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
}
.site-tab:hover { color: var(--parchment); }
.site-tab.is-active { border-left-color: var(--gold); color: var(--gold-bright); background: var(--stone-800); }
.site-content { min-width: 0; }
.site-tab[data-tab="pure"]::before { content: "◈ "; }
.site-tab[data-tab="zerkmed"]::before { content: "⚔ "; }
.site-tab[data-tab="main"]::before { content: "♛ "; }
.site-tab[data-tab="world-tracker"]::before { content: "🌐 "; }
.world-tracker-panel { border: 1px solid var(--stone-700); border-radius: 10px; overflow: hidden; background: var(--stone-900); }
.world-tracker-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px; }.world-tracker-controls h2 { margin: 0; font-family: var(--font-display); font-size: 18px; }.world-tracker-controls p { margin: 5px 0 0; color: var(--parchment-dim); font-size: 13px; }.world-tracker-controls button, .world-filter { border: 1px solid var(--stone-700); background: var(--stone-800); color: var(--parchment); padding: 8px 12px; border-radius: 6px; cursor: pointer; }.world-tracker-controls button:hover, .world-filter.is-active { color: var(--gold-bright); border-color: var(--gold); }
.world-tracker-actions { display: flex; gap: 7px; flex-wrap: wrap; }.world-tracker-actions select, .world-tracker-actions input { width: 82px; border: 1px solid var(--stone-700); border-radius: 6px; background: var(--stone-800); color: var(--parchment); padding: 8px; }.world-tracker-actions select { width: 110px; }.world-tracker-note { margin: 0 20px 15px; color: var(--parchment-dim); font-size: 12px; }.world-up { color: #62d084; }.world-down { color: #ef6461; }
.world-discord-toggle { display: flex; align-items: center; gap: 5px; color: var(--parchment); font-size: 12px; white-space: nowrap; }.world-tracker-actions .world-discord-toggle input { width: auto; }
.world-filters { display: flex; gap: 7px; padding: 0 20px 16px; }.world-table-wrap { overflow-x: auto; }.world-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; }.world-table th, .world-table td { padding: 10px 12px; border-top: 1px solid var(--stone-700); text-align: left; }.world-table th { color: var(--gold-bright); background: var(--stone-950); font-size: 11px; text-transform: uppercase; }.world-type-pvp { color: #ef6461; }.world-type-high-risk { color: #f2c94c; }.world-type-bounty { color: #c084fc; }

.xp-tracker-panel {
  border: 1px solid var(--stone-700);
  border-radius: 10px;
  background: var(--stone-900);
  overflow: hidden;
}
.xp-tracker-controls {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--stone-700);
}
.xp-tracker-controls h2 { margin: 0; font-family: var(--font-display); font-size: 18px; color: var(--parchment); }
.xp-tracker-controls p { margin: 5px 0 0; color: var(--parchment-dim); font-size: 13px; }
.xp-tracker-actions { display: flex; gap: 8px; }
.xp-tracker-actions button {
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--stone-800);
  color: var(--parchment);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}
.xp-tracker-actions button:hover { background: var(--gold); color: var(--stone-950); }
.xp-tracker-actions button:disabled { opacity: 0.5; cursor: default; }
.xp-tracker-note { margin: 14px 20px; color: var(--parchment-dim); font-size: 12px; }
.xp-tracker-table-wrap { overflow-x: auto; }
.xp-tracker-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.xp-tracker-table th, .xp-tracker-table td { padding: 10px 12px; border-top: 1px solid var(--stone-700); text-align: right; white-space: nowrap; }
.xp-tracker-table th { color: var(--gold-bright); background: var(--stone-950); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.xp-tracker-table th:first-child, .xp-tracker-table th:nth-child(2), .xp-tracker-table td:first-child, .xp-tracker-table td:nth-child(2) { text-align: left; }
.xp-tracker-table td { color: var(--parchment); }
.xp-tracker-table td[colspan] { text-align: center; color: var(--parchment-dim); padding: 24px; }

.attendance-panel {
  border: 1px solid var(--stone-700);
  border-radius: 10px;
  background: var(--stone-900);
  padding: 20px;
}
.attendance-note { margin: 4px 0 16px; color: var(--parchment-dim); font-size: 13px; }
.attendance-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}
.attendance-calendar-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.attendance-live-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.attendance-live-header h3 { margin: 0; font-family: var(--font-display); font-size: 15px; color: var(--parchment); }
.attendance-calendar h2 { margin: 0; font-family: var(--font-display); font-size: 18px; color: var(--parchment); }
.attendance-now-btn {
  background: var(--stone-800);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--gold-bright);
  padding: 5px 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.attendance-now-btn:hover { background: var(--gold); color: var(--stone-950); }
.attendance-now-btn:disabled { opacity: 0.6; cursor: wait; }
.attendance-now-status { margin: 6px 0 0; color: var(--danger); font-size: 12px; }
.attendance-loading { color: var(--parchment-dim); font-size: 13px; }
.attendance-months { max-height: 560px; overflow-y: auto; padding-right: 4px; }
.attendance-month-group { margin-bottom: 18px; }
.attendance-month-group h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.attendance-date-list { display: flex; flex-direction: column; gap: 4px; }
.attendance-date-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--stone-800);
  border: 1px solid var(--stone-700);
  border-radius: 6px;
  color: var(--parchment);
  padding: 7px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.attendance-date-btn:hover { border-color: var(--gold); }
.attendance-date-btn.is-selected { border-color: var(--gold); background: var(--stone-700); color: var(--gold-bright); }
.attendance-date-btn.is-sunday { border-left: 3px solid var(--gold); }
.attendance-date-weekday { color: var(--parchment-dim); font-size: 11px; }
.attendance-date-btn.is-sunday .attendance-date-weekday { color: var(--gold-bright); }

.attendance-detail { min-width: 0; }
.attendance-detail-nav { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--stone-700); }
.attendance-nav-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--parchment-dim);
  padding: 6px 2px 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.attendance-nav-btn:hover { color: var(--parchment); }
.attendance-nav-btn.is-active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.attendance-placeholder { color: var(--parchment-dim); font-size: 13px; }
.attendance-channel-picker h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 15px; color: var(--parchment); }
.attendance-channels { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attendance-channel-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--stone-800);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--parchment);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}
.attendance-channel-btn:hover { background: var(--gold); color: var(--stone-950); }
.attendance-channel-count { font-size: 11px; font-weight: 400; color: var(--parchment-dim); }
.attendance-channel-btn:hover .attendance-channel-count { color: var(--stone-800); }

.attendance-results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.attendance-results-header h3 { margin: 0; font-family: var(--font-display); font-size: 15px; color: var(--parchment); }
.attendance-back {
  background: transparent;
  border: 1px solid var(--stone-700);
  border-radius: 6px;
  color: var(--parchment-dim);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.attendance-back:hover { color: var(--parchment); border-color: var(--gold); }

.attendance-table-wrap { overflow-x: auto; }
.attendance-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.attendance-table th, .attendance-table td { padding: 8px 12px; border-top: 1px solid var(--stone-700); text-align: left; }
.attendance-table th { color: var(--gold-bright); background: var(--stone-950); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.attendance-table th.col-present, .attendance-table td.col-present { text-align: center; }
.attendance-check { color: var(--verified); font-weight: 700; }
.attendance-cross { color: var(--danger); font-weight: 700; }

.attendance-non-roster { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--stone-700); }
.attendance-non-roster h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--parchment-dim); }
.attendance-non-roster ul { margin: 0; padding-left: 18px; color: var(--parchment-dim); font-size: 12px; }

.attendance-log-trip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--stone-700);
}
.attendance-log-trip input[type="text"] {
  flex: 1 1 220px;
  background: var(--stone-800);
  border: 1px solid var(--stone-700);
  border-radius: 6px;
  color: var(--parchment);
  padding: 7px 10px;
  font-family: var(--font-body);
  font-size: 13px;
}
.attendance-log-trip input[type="text"]:focus { outline: none; border-color: var(--gold); }
.attendance-mandatory-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--parchment-dim);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.attendance-mandatory-check input { cursor: pointer; }
.attendance-log-btn {
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--stone-950);
  padding: 7px 14px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.attendance-log-btn:hover { background: var(--gold-bright); }
.attendance-log-btn:disabled { opacity: 0.6; cursor: wait; }
.attendance-log-status { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--parchment-dim); }
.attendance-log-status.is-success { color: var(--verified); }

.attendance-mandatory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.attendance-mandatory-header h3 { margin: 0; font-family: var(--font-display); font-size: 15px; color: var(--parchment); }
.attendance-mandatory-table th.col-mandatory-date, .attendance-mandatory-table td.col-mandatory-date { text-align: center; white-space: nowrap; }
.attendance-mandatory-table td.col-mandatory-date { font-size: 15px; }
.attendance-mandatory-table th.col-mandatory-date { vertical-align: top; }
.attendance-mandatory-reset {
  display: block;
  margin: 4px auto 0;
  background: none;
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  color: var(--parchment-dim);
  padding: 2px 6px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.attendance-mandatory-reset:hover:not(:disabled) { color: var(--gold-bright); border-color: var(--gold); }
.attendance-mandatory-reset:disabled { opacity: 0.35; cursor: default; }
.attendance-mandatory-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--gold);
  color: var(--stone-950);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.attendance-log-status.is-error { color: var(--danger); }

.attendance-history-list { display: flex; flex-direction: column; gap: 6px; }
.attendance-history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  background: var(--stone-800);
  border: 1px solid var(--stone-700);
  border-radius: 6px;
  color: var(--parchment);
  padding: 9px 12px;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.attendance-history-item:hover { border-color: var(--gold); }
.attendance-history-item-type { font-weight: 700; color: var(--gold-bright); }
.attendance-history-item-meta { color: var(--parchment-dim); font-size: 12px; }
.attendance-history-item-when { color: var(--parchment-dim); font-size: 11px; margin-left: auto; }

@media (max-width: 720px) {
  .attendance-layout { grid-template-columns: 1fr; }
  .attendance-months { max-height: 260px; }
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

#search {
  flex: 1;
  max-width: 360px;
  background: var(--stone-900);
  border: 1px solid var(--stone-700);
  color: var(--parchment);
  padding: 10px 14px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
}
#search:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
#search::placeholder { color: var(--parchment-dim); }

.refresh-roster {
  background: var(--stone-800);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--parchment);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.refresh-roster:hover { background: var(--gold); color: var(--stone-950); }
.refresh-roster:disabled { opacity: 0.55; cursor: default; }

.member-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--parchment-dim);
}

.roster-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
  border: 1px solid var(--stone-700);
  border-radius: 8px;
  overflow: hidden;
  background: var(--stone-900);
}
.roster-alert {
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid var(--change-amber);
  border-radius: 7px;
  background: rgba(217, 138, 61, 0.12);
  color: var(--parchment);
  font-family: var(--font-mono);
  font-size: 12px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--stone-700);
}
.summary-item:last-child { border-right: none; }
.summary-item span { color: var(--parchment-dim); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.summary-item strong { color: var(--gold-bright); font-family: var(--font-mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.roster-table-wrap {
  border: 1px solid var(--stone-700);
  border-radius: 10px;
  overflow: auto;
  background: var(--stone-900);
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.roster-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--stone-950);
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 2px solid var(--gold);
  border-right: 1px solid var(--stone-700);
}
.roster-table thead th:last-child { border-right: none; }
.roster-table thead th.col-rank { text-align: right; }
.sort-header {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.sort-header:hover, .sort-header.is-active { color: var(--parchment); }
.roster-table thead th.col-combat, .row-combat { text-align: right; }
.role-filter-label { display: inline-flex; align-items: center; gap: 6px; }
.role-filter {
  max-width: 110px;
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  background: var(--stone-900);
  color: var(--gold-bright);
  padding: 3px 5px;
  font: inherit;
  font-size: 10px;
  text-transform: uppercase;
}
.role-filter:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Column widths are pinned here, on <col>, not on the header cells - a
   <colgroup> is the one thing that keeps every row's borders locked to the
   same x-position regardless of cell content or rows added/removed by JS
   (the alt-accounts heading, the inline member editor). */
.roster-table col.col-rank { width: 44px; }
.roster-table col.col-name { width: 20%; }
.roster-table col.col-role { width: 15%; }
.roster-table col.col-combat { width: 86px; }
.roster-table col.col-rsns { width: auto; }

.roster-table tbody td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--stone-700);
  border-right: 1px solid var(--stone-700);
  vertical-align: middle;
}
.roster-table tbody td:last-child { border-right: none; }
.roster-table tbody tr:last-child td { border-bottom: none; }

.alt-accounts-heading {
  padding: 10px 16px;
  border-top: 2px solid var(--gold);
  background: var(--stone-950);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.member-row {
  --role-color: var(--gold-bright);
  background: var(--stone-900);
  border-left: 3px solid var(--role-color);
  transition: background 0.15s ease;
}
.member-row:nth-of-type(even) { background: rgba(255, 255, 255, 0.02); }
.member-row:hover { background: var(--stone-800); }

.member-row.has-alert {
  box-shadow: inset 0 0 0 1px rgba(217, 138, 61, 0.25);
}

.member-editor-row { background: var(--stone-800); }
.member-editor-row td { border-right: none !important; }

.row-rank {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--parchment-dim);
  text-align: right;
}

.row-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--parchment);
}

.row-role {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--role-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-badge {
  display: inline-flex;
  width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 11px;
}
.row-combat { color: var(--parchment); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }

.row-name-clickable {
  cursor: pointer;
  border-radius: 4px;
}
.row-name-clickable:hover,
.row-name-clickable.is-open { color: var(--gold-bright); }
.row-name-clickable:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.add-rsn-row {
  padding: 10px 16px 14px;
  background: var(--stone-800);
}

.add-rsn-row .add-rsn-form {
  display: flex;
  gap: 6px;
  max-width: 360px;
}
.add-rsn-row .add-rsn-form input {
  flex: 1;
  background: var(--stone-900);
  border: 1px solid var(--stone-700);
  color: var(--parchment);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-width: 0;
}
.add-rsn-row .add-rsn-form input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.add-rsn-row .add-rsn-form button {
  background: var(--stone-700);
  color: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.add-rsn-row .add-rsn-form button:hover { background: var(--gold); color: var(--stone-950); }
.add-rsn-row .add-rsn-form button:disabled { opacity: 0.5; cursor: default; }

.add-rsn-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 12px;
}

.alt-account-btn {
  display: block;
  margin-top: 14px;
  background: transparent;
  border: 1px solid var(--stone-700);
  border-radius: 5px;
  color: var(--parchment-dim);
  padding: 6px 9px;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
}
.alt-account-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.alt-account-btn:disabled { opacity: 0.55; cursor: default; }

.display-name-form {
  margin-top: 12px;
  max-width: 360px;
}
.display-name-form label,
.display-name-form small {
  display: block;
  color: var(--parchment-dim);
  font-size: 11px;
}
.display-name-form label { margin-bottom: 4px; font-family: var(--font-mono); }
.display-name-form small { margin-top: 4px; }
.display-name-form div { display: flex; gap: 6px; }
.display-name-form input {
  flex: 1;
  min-width: 0;
  background: var(--stone-900);
  border: 1px solid var(--stone-700);
  color: var(--parchment);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 12.5px;
}
.display-name-form button {
  background: var(--stone-700);
  color: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}
.display-name-form button:hover { background: var(--gold); color: var(--stone-950); }
.display-name-form button:disabled { opacity: 0.5; cursor: default; }

.row-rsns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--parchment-dim);
}

.rsn-inline {
  color: var(--parchment);
  cursor: help;
  position: relative;
  outline: none;
}
.rsn-inline:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.rsn-stats-tooltip {
  /* These tooltips are appended to <body> and positioned from viewport
     coordinates in app.js, so they must not scroll with the document. */
  position: fixed;
  z-index: 20;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 12px;
  min-width: 158px;
  padding: 9px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--stone-950);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  color: var(--parchment-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  /* The bubble must never count as hovering the RSN itself. */
  pointer-events: none;
}
/* Explicitly respect the JavaScript hidden state despite the grid layout. */
.rsn-stats-tooltip[hidden] { display: none; }
.rsn-stats-tooltip strong { color: var(--parchment); text-align: right; }

.rsn-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rsn-classification {
  border: 1px solid var(--stone-700);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--parchment-dim);
  font-size: 9px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rsn-classification-pure { border-color: #749bd0; color: #a8cdfb; }
.rsn-classification-zerk { border-color: #c07855; color: #efad7f; }
.rsn-classification-med { border-color: #9174c8; color: #c8adfb; }
.rsn-classification-main { border-color: #5f9271; color: #9bd2ad; }

.rsn-classifications {
  margin-top: 12px;
  max-width: 360px;
}
.rsn-classifications > label {
  display: block;
  margin-bottom: 4px;
  color: var(--parchment-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}
.rsn-classification-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.rsn-classification-row select {
  background: var(--stone-900);
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  color: var(--parchment);
  padding: 4px 6px;
  font-family: var(--font-body);
  font-size: 12px;
}

.rsn-remove-btn {
  background: transparent;
  color: var(--parchment-dim);
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 1px 5px 3px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.rsn-entry:hover .rsn-remove-btn,
.rsn-entry:focus-within .rsn-remove-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.rsn-remove-btn:hover { border-color: var(--danger); color: #f19a8d; }
.rsn-remove-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.rsn-remove-btn:disabled { opacity: 0.55; cursor: default; }

/* the signature element: the RSN-change chip, now inline instead of bubbled */
.rsn-change-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--change-amber-bright);
}
.rsn-change-inline .old-name { text-decoration: line-through; opacity: 0.7; }
.rsn-change-inline .arrow { color: var(--change-amber); }
.rsn-change-inline .new-name { font-weight: 600; }
.rsn-change-inline button {
  margin-left: 2px;
  background: var(--change-amber);
  color: var(--stone-950);
  border: none;
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
}
.rsn-change-inline button:hover { background: var(--change-amber-bright); }
.rsn-change-inline button:focus-visible { outline: 2px solid var(--parchment); outline-offset: 1px; }

@media (max-width: 640px) {
  #site-app main { display: block; padding: 20px 14px 42px; }
  .site-tabs { flex-direction: row; overflow-x: auto; margin-bottom: 18px; }
  .site-tab { width: auto; white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .site-tab.is-active { border-left-color: transparent; border-bottom-color: var(--gold); }
  .roster-table { table-layout: auto; }
  .roster-table thead th.col-role,
  .roster-table tbody td.row-role { display: none; }
  .roster-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item:nth-child(2) { border-right: none; }
  .summary-item:nth-child(3) { border-top: 1px solid var(--stone-700); }
}

.empty-state {
  text-align: center;
  color: var(--parchment-dim);
  padding: 48px 0;
  font-family: var(--font-mono);
}

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  color: var(--parchment-dim);
  font-size: 12px;
  font-family: var(--font-mono);
  border-top: 1px solid var(--stone-700);
}

@media (max-width: 520px) {
  .site-header { padding: 20px 18px; }
  main { padding: 24px 16px 48px; }
}
