:root {
  --night: #0c1624;
  --night-2: #132033;
  --stone: #8b7355;
  --stone-light: #c4a574;
  --gold: #e8b84a;
  --gold-bright: #f5d76e;
  --gold-deep: #b8872a;
  --ink: #f3efe6;
  --muted: #9aa6b5;
  --good: #2ecc71;
  --mid: #e67e22;
  --bad: #e74c3c;
  --line: rgba(232, 184, 74, 0.18);
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "Source Sans 3", Georgia, serif;
  --scroll-track: #0a121c;
  --scroll-thumb: rgba(184, 135, 42, 0.55);
  --scroll-thumb-hover: rgba(232, 184, 74, 0.85);
}

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

/* Custom scrollbars — Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/* Custom scrollbars — Chromium / Safari / Edge */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
  min-height: 2rem;
  min-width: 2rem;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  background-clip: padding-box;
  border: 2px solid transparent;
}

*::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}

html {
  scroll-behavior: smooth;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:visited,
a:active {
  color: var(--gold);
}

a:hover {
  color: var(--gold-bright);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--night);
  line-height: 1.5;
  position: relative;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(232, 184, 74, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(139, 115, 85, 0.22), transparent 50%),
    linear-gradient(165deg, #0a121c 0%, #132033 45%, #0c1624 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 5vw;
  border-bottom: 1px solid var(--line);
  animation: fade-down 0.6s ease both;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand:visited,
.brand:active {
  color: inherit;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  line-height: 1;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  position: relative;
  padding: 0.2rem 0;
  transition: color 0.2s ease;
}

.nav a:visited,
.nav a:active {
  color: var(--muted);
}

.nav a:hover,
.nav a.active,
.nav a.active:visited {
  color: var(--gold-bright);
}

.nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35rem;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.main {
  padding: 0 5vw 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero {
  min-height: min(72vh, 640px);
  display: flex;
  align-items: center;
  padding: 3rem 0 2rem;
  animation: rise 0.8s ease both;
}

.hero-copy {
  max-width: 38rem;
}

.clan-badge {
  width: 96px;
  height: 96px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
  animation: badge-float 4s ease-in-out infinite;
}

.eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--stone-light);
  margin: 0 0 0.5rem;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:visited,
.eyebrow a:active {
  color: inherit;
}

.eyebrow a:hover {
  color: var(--gold);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
  margin: 0 0 0.75rem;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 45%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 32rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  color: #1a1205;
  box-shadow: 0 6px 20px rgba(232, 184, 74, 0.28);
}

a.btn-gold:visited,
a.btn-gold:active {
  color: #1a1205;
}

.btn-gold:hover {
  box-shadow: 0 8px 28px rgba(232, 184, 74, 0.4);
  color: #1a1205;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

a.btn-ghost:visited,
a.btn-ghost:active {
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.sync-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  min-height: 1.3em;
}

.sync-hint.ok {
  color: var(--good);
}

.sync-hint.err {
  color: var(--bad);
}

.page-head {
  padding: 2.5rem 0 1rem;
  animation: rise 0.55s ease both;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: 0.04em;
  margin: 0 0 0.35rem;
  color: var(--gold);
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.section {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  animation: rise 0.7s ease both;
  animation-delay: 0.08s;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.35rem;
  color: var(--stone-light);
}

.section-lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem 1.5rem;
}

.stat-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-list span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat-list strong {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  font-weight: 400;
}

.war-scoreline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2rem;
  margin-bottom: 0.75rem;
}

.war-scoreline.large strong {
  font-size: 2.4rem;
}

.war-scoreline .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.war-scoreline strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  display: block;
}

.war-scoreline em {
  font-style: normal;
  color: var(--stone-light);
}

.war-scoreline .vs {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--stone);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.meta a,
.meta a:visited,
.meta a:active {
  color: var(--gold);
}

.meta a:hover {
  color: var(--gold-bright);
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.top-list li {
  display: grid;
  grid-template-columns: 2rem minmax(5rem, 1fr) 1.75rem minmax(6rem, 1.2fr) 4.5rem;
  gap: 0.55rem 0.65rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.top-list .rank {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.2rem;
  line-height: 1;
}

.top-list .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-list .league-icon-slot {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-list .league-icon-slot .league-icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  display: block;
}

.top-list .league-name {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-list .trop {
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-light);
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  color: var(--gold);
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(232, 184, 74, 0.05);
}

/* Members table — keep name column visible on horizontal scroll */
#members-table {
  border-collapse: separate;
  border-spacing: 0;
}

#members-table th:first-child,
#members-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #101c2c;
  box-shadow: 6px 0 10px -6px rgba(0, 0, 0, 0.55);
}

#members-table th:first-child {
  z-index: 3;
  background: #132033;
}

#members-table tbody tr:hover td:first-child {
  background: #182636;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.player-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: min(100%, 18rem);
}

.player-filter-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-light);
  white-space: nowrap;
}

.player-filter-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(12, 22, 36, 0.85);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.7rem;
}

.player-filter-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 184, 74, 0.18);
}

.player-filter-count {
  font-size: 0.85rem;
}

.member-name-link,
.member-name-link:visited,
.member-name-link:active {
  color: inherit;
  text-decoration: none;
}

.member-name-link:hover {
  color: var(--gold-bright);
}

.member-profile .member-stats strong.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.member-notes-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.member-notes-block .label {
  display: inline-block;
  min-width: 5.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.5rem;
}

.member-notes-text {
  margin: 0.75rem 0 0;
  white-space: pre-wrap;
}

.member-stats .avg-score-cell {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.member-tag-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  background: var(--gold);
  vertical-align: middle;
}

.senior-fresh .member-tag-dot { background: #f0c14a; }
.senior-new .member-tag-dot { background: #e07a2f; }
.senior-mid .member-tag-dot { background: #2a9d8f; }
.senior-long .member-tag-dot { background: #1b4332; box-shadow: inset 0 0 0 1px rgba(243, 239, 230, 0.35); }

.unranked {
  color: var(--bad);
  font-weight: 700;
}

.war-pref {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.war-pref-in {
  color: #0f3d24;
  background: rgba(46, 204, 113, 0.28);
}

.war-pref-out {
  color: #f3efe6;
  background: rgba(231, 76, 60, 0.35);
}

.war-pref-unknown {
  color: var(--muted);
  background: rgba(154, 166, 181, 0.15);
}

.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  vertical-align: middle;
}

.league-icon,
.hdv-icon {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  flex-shrink: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 2rem !important;
}

.muted {
  color: var(--muted);
  font-size: 0.85em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.swatch.senior-fresh { background: #f0c14a; }
.swatch.senior-new { background: #e07a2f; }
.swatch.senior-mid { background: #2a9d8f; }
.swatch.senior-long { background: #1b4332; box-shadow: inset 0 0 0 1px rgba(243, 239, 230, 0.35); }
.swatch.score-good { background: var(--good); }
.swatch.score-mid { background: var(--mid); }
.swatch.score-bad { background: var(--bad); }

.war-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.war-item a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, padding-left 0.2s ease;
}

.war-item a:visited,
.war-item a:active {
  color: inherit;
}

.war-item a:hover {
  padding-left: 0.35rem;
  background: linear-gradient(90deg, rgba(232, 184, 74, 0.06), transparent);
}

.war-type {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 0.15rem;
}

.war-item-score {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  align-self: center;
}

.war-item-score .vs {
  color: var(--stone);
  margin: 0 0.35rem;
}

.war-item-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  color: var(--gold);
}

.score-good td {
  background: rgba(46, 204, 113, 0.12);
}

.score-mid td {
  background: rgba(230, 126, 34, 0.12);
}

.score-bad td {
  background: rgba(231, 76, 60, 0.12);
}

.score-cell {
  font-weight: 700;
}

.avg-score-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

td.avg-score-cell.score-good,
.avg-score-cell.score-good {
  background: rgba(46, 204, 113, 0.12);
  color: var(--good);
}

td.avg-score-cell.score-mid,
.avg-score-cell.score-mid {
  background: rgba(230, 126, 34, 0.12);
  color: var(--mid);
}

td.avg-score-cell.score-bad,
.avg-score-cell.score-bad {
  background: rgba(231, 76, 60, 0.12);
  color: var(--bad);
}

.war-table thead th {
  cursor: default;
}

.war-table-groups th {
  text-align: center;
  vertical-align: middle;
}

.war-table-groups .atk-group {
  letter-spacing: 0.06em;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}

.war-table-cols th {
  text-align: center;
  font-size: 0.7rem;
}

.war-table th.atk1,
.war-table td.atk1 {
  background: rgba(232, 184, 74, 0.04);
}

.war-table th.atk2,
.war-table td.atk2 {
  background: rgba(139, 115, 85, 0.08);
}

.war-table-groups th.atk2,
.war-table .atk-sep {
  border-left: 1px solid var(--line);
}

/* ——— Timeline matrix (members × wars) ——— */

.timeline-frame {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(12, 22, 36, 0.55);
}

.timeline-wrap {
  max-height: min(75vh, 900px);
  overflow: auto;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.timeline-panel:fullscreen .timeline-frame,
.timeline-panel.is-immersive .timeline-frame {
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
}

.timeline-panel:fullscreen .timeline-wrap,
.timeline-panel.is-immersive .timeline-wrap {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.timeline-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  min-width: 100%;
}

.timeline-table th,
.timeline-table td {
  padding: 0;
  border-bottom: 1px solid rgba(232, 184, 74, 0.08);
  border-right: 1px solid rgba(232, 184, 74, 0.06);
}

.timeline-table th.timeline-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #101c2c;
  text-align: left;
  padding: 0.55rem 1.1rem 0.55rem 1.35rem;
  min-width: 11rem;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  border-right: 1px solid var(--line);
}

thead .timeline-sticky {
  z-index: 3;
  top: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-light);
}

.timeline-member {
  font-weight: 600;
  color: var(--ink);
}

.timeline-member-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: inherit;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-member-link:visited,
.timeline-member-link:active {
  color: inherit;
}

.timeline-member-link:hover {
  color: var(--gold);
}

.timeline-panel {
  position: relative;
}

.timeline-tip {
  position: absolute;
  z-index: 10000;
  left: 0;
  top: 0;
  min-width: 12rem;
  max-width: min(20rem, calc(100% - 1.5rem));
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(12, 22, 36, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
}

.timeline-tip-title {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--gold);
}

.timeline-tip-line {
  color: var(--muted);
}

.timeline-tip-line + .timeline-tip-line {
  margin-top: 0.15rem;
}

.timeline-war {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101c2c;
  vertical-align: bottom;
  min-width: 4.6rem;
  max-width: 5.2rem;
}

.timeline-war a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.5rem 0.25rem;
  text-decoration: none;
  color: var(--muted);
  line-height: 1.15;
}

.timeline-war a:visited,
.timeline-war a:active {
  color: var(--muted);
}

.timeline-war a:hover {
  color: var(--gold);
  background: rgba(232, 184, 74, 0.08);
}

.timeline-date {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--stone-light);
  white-space: nowrap;
}

.timeline-type {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.timeline-opp {
  font-size: 0.58rem;
  max-width: 3.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-cell {
  text-align: center;
  vertical-align: middle;
  width: 4.6rem;
  height: 2.1rem;
}

.timeline-cell a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 2.1rem;
  text-decoration: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: filter 0.12s ease, transform 0.12s ease;
}

.timeline-cell a:visited,
.timeline-cell a:active {
  color: var(--ink);
}

.timeline-cell a:hover {
  filter: brightness(1.25);
  transform: scale(1.06);
}

.timeline-cell.score-good {
  background: rgba(46, 204, 113, 0.28);
}

.timeline-cell.score-mid {
  background: rgba(230, 126, 34, 0.28);
}

.timeline-cell.score-bad {
  background: rgba(231, 76, 60, 0.28);
}

.timeline-empty {
  background: rgba(255, 255, 255, 0.02);
}

.timeline-empty span {
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  margin: 0.8rem auto;
  border-radius: 1px;
  background: rgba(154, 166, 181, 0.25);
}

.swatch.timeline-empty-swatch {
  background: rgba(154, 166, 181, 0.35);
}

.timeline-table tbody tr:hover .timeline-sticky {
  background: #162536;
}

.timeline-table tbody tr:hover .timeline-empty {
  background: rgba(232, 184, 74, 0.04);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.btn-fullscreen {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(232, 184, 74, 0.08);
  color: var(--gold);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-fullscreen:hover {
  background: rgba(232, 184, 74, 0.16);
  border-color: rgba(232, 184, 74, 0.45);
}

.timeline-fs-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 28, 44, 0.95);
}

.timeline-fs-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.timeline-panel:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 70% 40% at 10% -10%, rgba(232, 184, 74, 0.12), transparent 55%),
    #0c1624;
}

body.timeline-immersive {
  overflow: hidden;
}

body.timeline-immersive .site-header,
body.timeline-immersive .site-footer,
body.timeline-immersive .timeline-head {
  display: none !important;
}

body.timeline-immersive .main {
  padding: 0;
  max-width: none;
}

body.timeline-immersive .section {
  padding: 0;
  border: none;
  animation: none;
}

.timeline-panel.is-immersive {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 70% 40% at 10% -10%, rgba(232, 184, 74, 0.12), transparent 55%),
    #0c1624;
}

.timeline-panel:fullscreen .timeline-fs-bar,
.timeline-panel.is-immersive .timeline-fs-bar {
  display: flex;
  flex-shrink: 0;
}

.timeline-legends {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
}

.timeline-legends .timeline-legend {
  margin: 0;
  padding: 0;
  border: none;
}

.timeline-frame > .score-help {
  margin: 0;
  width: 100%;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: rgba(16, 28, 44, 0.75);
  flex-shrink: 0;
}

.timeline-panel:fullscreen th.timeline-sticky,
.timeline-panel.is-immersive th.timeline-sticky {
  padding: 0.4rem 1rem 0.4rem 1.25rem;
  min-width: 10rem;
  font-size: 0.78rem;
}

.timeline-panel:fullscreen .timeline-war,
.timeline-panel.is-immersive .timeline-war {
  min-width: 4.2rem;
  max-width: 4.8rem;
}

.timeline-panel:fullscreen .timeline-war a,
.timeline-panel.is-immersive .timeline-war a {
  padding: 0.35rem 0.1rem;
}

.timeline-panel:fullscreen .timeline-opp,
.timeline-panel.is-immersive .timeline-opp {
  display: none;
}

.timeline-panel:fullscreen .timeline-cell,
.timeline-panel.is-immersive .timeline-cell {
  width: 4.2rem;
  height: 1.7rem;
}

.timeline-panel:fullscreen .timeline-cell a,
.timeline-panel.is-immersive .timeline-cell a {
  min-height: 1.7rem;
  font-size: 0.75rem;
}

.timeline-panel:fullscreen .timeline-empty span,
.timeline-panel.is-immersive .timeline-empty span {
  margin: 0.6rem auto;
}

.score-help {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(16, 28, 44, 0.65);
}

/* Align with .table-wrap which uses a slight negative horizontal margin */
.section > .score-help {
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  width: calc(100% + 0.5rem);
}

.score-help summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--gold);
  list-style: none;
  user-select: none;
}

.score-help summary::-webkit-details-marker {
  display: none;
}

.score-help summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45rem;
  transition: transform 0.15s ease;
}

.score-help[open] summary::before {
  transform: rotate(90deg);
}

.score-help-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.score-help-body > p:first-child {
  margin-top: 0.85rem;
}

.score-help-body p {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.score-help-body strong {
  color: var(--ink);
}

.score-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.score-help-grid h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--stone-light);
  font-weight: 400;
}

.score-help-grid .muted {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}

.score-help-grid ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.score-help-grid li {
  margin: 0.2rem 0;
}

@media (max-width: 800px) {
  .score-help-grid {
    grid-template-columns: 1fr;
  }
}

.login-section {
  max-width: 24rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form input {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(12, 22, 36, 0.8);
  color: var(--ink);
}

.login-error {
  color: var(--bad);
  margin: 0 0 1rem;
}

.nav-user {
  color: var(--stone-light);
  font-size: 0.85rem;
  align-self: center;
}

.nav-logout {
  display: inline;
  margin: 0;
}

.nav-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.nav-link-btn:hover {
  color: var(--gold);
}

.notes-cell {
  min-width: 14rem;
  max-width: 18rem;
  width: 16rem;
  white-space: normal !important;
  vertical-align: top;
  position: relative;
}

.notes-edit {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.notes-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.member-notes {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.35;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(12, 22, 36, 0.75);
  color: var(--ink);
  resize: vertical;
  min-height: 3.2rem;
}

.member-category {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(12, 22, 36, 0.75);
  color: var(--ink);
  max-width: 100%;
}

.btn-save-member {
  margin: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  flex-shrink: 0;
  align-self: flex-start;
}

.member-save-hint {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
}

.member-save-hint.ok { color: var(--good); }
.member-save-hint.err { color: var(--bad); }

.role-cell {
  white-space: nowrap;
  vertical-align: top;
}

.member-notes-edit {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 36rem;
}

.member-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.member-field .member-notes,
.member-field .member-category {
  width: 100%;
}

.member-notes-edit .notes-actions {
  margin-top: 0;
}

.cat-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
}

.cat-exclude {
  background: rgba(231, 76, 60, 0.28);
  color: #ffb4ab;
}

.cat-watch {
  background: rgba(230, 126, 34, 0.28);
  color: #ffc48a;
}

.cat-neutral {
  background: rgba(154, 166, 181, 0.18);
  color: var(--muted);
}

.cat-strong {
  background: rgba(46, 204, 113, 0.28);
  color: #9af0c0;
}

.site-footer {
  padding: 2rem 5vw;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes badge-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 640px) {
  .war-item a {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 2rem;
  }

  .top-list li {
    grid-template-columns: 1.5rem minmax(0, 1fr) 1.75rem minmax(0, 1fr);
  }

  .top-list .trop {
    display: none;
  }
}
