:root {
  color-scheme: dark;
  --background-drift: 0px;
  --bg: #0b1220;
  --surface: rgba(17, 26, 43, .94);
  --surface-2: rgba(22, 33, 53, .96);
  --border: #26354d;
  --border-soft: #1e2b40;
  --text: #eef3f8;
  --muted: #94a3b8;
  --blue: #60a5fa;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --red: #fb7185;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; background: var(--bg); }
body {
  --page-background: url("/images/backgrounds/dashboard-calm-v2.webp");
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: -64px 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(7, 15, 28, .58) 0, rgba(11, 18, 32, .78) 46rem, rgba(11, 18, 32, .94) 92rem),
    var(--page-background);
  background-position: center top, center top;
  background-repeat: no-repeat;
  background-size: cover, cover;
  transform: translate3d(0, var(--background-drift), 0);
  will-change: transform;
}
body > :not(script) { position: relative; z-index: 1; }
body.page-dashboard { --page-background: url("/images/backgrounds/dashboard-calm-v2.webp"); }
body.page-pals { --page-background: url("/images/backgrounds/dashboard-calm-v2.webp"); }
body.page-trainers { --page-background: url("/images/backgrounds/trainers-calm.webp"); }
body.page-awards { --page-background: url("/images/backgrounds/awards-calm.webp"); }
body.page-milestones { --page-background: url("/images/backgrounds/milestones-calm.webp"); }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, .96);
  backdrop-filter: blur(10px);
}
.header-inner {
  width: min(1480px, calc(100% - 40px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7dd3fc, #60a5fa 58%, #34d399);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 18px rgba(34, 211, 238, .1);
  color: #07111f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { color: var(--muted); font-size: 11px; }
.main-nav { display: flex; gap: 4px; margin-right: auto; }
.main-nav a {
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.main-nav a:hover, .main-nav a:focus-visible { background: var(--surface-2); color: var(--text); }
.main-nav a.nav-active { background: var(--surface-2); color: var(--text); }
.header-status { display: flex; align-items: center; gap: 12px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 750; }
.status-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-badge.is-online i { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, .14); }
.status-badge.is-offline i { background: var(--red); }
.refresh-status { color: var(--muted); font-size: 11px; white-space: nowrap; }

.section-nav {
  margin: -12px 0 28px;
  padding: 9px 0;
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.section-nav span { margin-right: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.section-nav a { padding: 5px 8px; border-radius: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.section-nav a:hover, .section-nav a:focus-visible { background: var(--surface-2); color: var(--text); }

.page-shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 70px; }
.page-heading, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading { margin-bottom: 22px; }
.page-heading h1 { margin: 2px 0 4px; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; letter-spacing: -.035em; }
.eyebrow, .panel-kicker { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.muted, .section-heading p { color: var(--muted); }
.page-heading .muted { margin: 0; }
.range-control, .metric-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.range-control button, .metric-switch button, .map-filters button, .secondary-button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}
.range-control button { padding: 7px 11px; color: var(--muted); font-size: 12px; font-weight: 700; }
.range-control button.active, .metric-switch button.active { background: var(--surface-2); color: var(--text); }

.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card, .panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.summary-card { min-height: 112px; padding: 16px; }
.summary-card span, .summary-card small { display: block; color: var(--muted); }
.summary-card span { font-size: 12px; font-weight: 650; }
.summary-card strong { display: block; margin: 8px 0 4px; font-size: 25px; line-height: 1; letter-spacing: -.02em; }
.summary-card small { font-size: 11px; }

.dashboard-grid { display: grid; gap: 18px; }
.charts-grid { grid-template-columns: 1.15fr .85fr; margin-bottom: 18px; }
.overview-grid { grid-template-columns: .85fr .7fr 1.15fr; margin-top: 18px; }
.player-grid { grid-template-columns: .8fr 1.2fr; }
.scoreboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: 20px; }
.panel-heading { min-height: 36px; margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h2, .panel-heading h3 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.015em; }
.panel-note { margin: 0; color: var(--muted); font-size: 11px; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 3px; border-radius: 2px; }
.legend-dot.players { background: var(--blue); }
.legend-dot.peak { background: var(--cyan); }
.legend-dot.fps { background: var(--green); }
.legend-dot.frame { background: var(--amber); }
.canvas-wrap { height: 260px; }
.canvas-wrap canvas, .map-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.empty-state { margin: 16px 0 0; padding: 18px; border: 1px dashed var(--border); border-radius: 7px; color: var(--muted); text-align: center; }

.heatmap-panel { overflow: hidden; }
.heatmap { display: grid; grid-template-columns: 32px repeat(24, minmax(10px, 1fr)); gap: 3px; align-items: center; overflow-x: auto; padding-bottom: 3px; }
.heatmap-label { color: var(--muted); font-size: 10px; text-align: right; padding-right: 5px; }
.heatmap-hour { color: var(--muted); font-size: 9px; text-align: center; }
.heatmap-cell { min-width: 10px; height: 18px; border-radius: 2px; background: #1b2a3e; }
.heatmap-cell:hover { outline: 1px solid var(--text); outline-offset: 1px; }

.count-chip { min-width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--blue); font-size: 12px; font-weight: 800; }
.online-list { display: grid; gap: 8px; }
.online-player { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.online-player:last-child { border-bottom: 0; }
.avatar { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: #20314a; color: var(--blue); font-size: 11px; font-weight: 850; }
.player-portrait {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid hsl(var(--portrait-hue) 48% 42%);
  border-radius: 9px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 68% 25%, hsl(var(--portrait-hue) 72% 65% / .38), transparent 31%),
    linear-gradient(145deg, hsl(var(--portrait-hue) 42% 27%), hsl(var(--portrait-hue) 40% 14%));
  color: hsl(var(--portrait-hue) 76% 86%);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
}
.player-portrait::after { position: absolute; content: ""; inset: auto 5px 4px; height: 8px; border-radius: 50% 50% 3px 3px; background: hsl(var(--portrait-hue) 46% 62% / .22); }
.player-portrait img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.compact-portrait { width: 30px; height: 30px; border-radius: 7px; font-size: 10px; }
.pal-image { display: block; object-fit: contain; }
.pal-species-cell { display: inline-flex; align-items: center; gap: 8px; }
.pal-table-image { width: 32px; height: 32px; margin: -7px 0; }
.online-player strong, .online-player small { display: block; }
.online-player small { color: var(--muted); font-size: 11px; }
.online-player > small { text-align: right; }
.world-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--border-soft); }
.world-stats div { padding: 11px; background: var(--surface); }
.world-stats dt { color: var(--muted); font-size: 11px; }
.world-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 750; }
.event-list { max-height: 294px; margin: 0; padding: 0; list-style: none; overflow: auto; }
.event-list li { position: relative; padding: 0 0 13px 16px; border-left: 1px solid var(--border); }
.event-list li:last-child { padding-bottom: 0; }
.event-list li::before { position: absolute; content: ""; top: 5px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.event-list strong, .event-list small { display: block; }
.event-list strong { font-size: 12px; }
.event-list small { color: var(--muted); font-size: 11px; }

.section-block { padding-top: 70px; }
.section-heading { align-items: flex-start; margin-bottom: 18px; }
.section-heading h2 { margin: 2px 0 5px; font-size: 27px; letter-spacing: -.025em; }
.section-heading p { max-width: 680px; margin: 0; }
.split-heading .info-note { max-width: 430px; }
.info-note { padding: 11px 13px; border-left: 3px solid var(--blue); background: var(--surface); color: var(--muted); font-size: 12px; }
.info-note strong { color: var(--text); }
.metric-switch { flex-wrap: wrap; }
.metric-switch button { padding: 5px 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.player-bars { display: grid; gap: 11px; }
.scoreboard-heading, .dungeon-heading { margin: 26px 0 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.scoreboard-heading h3, .dungeon-heading h3 { margin: 0 0 3px; font-size: 16px; }
.scoreboard-heading p, .dungeon-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.scoreboard-icon { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 900; }
.scoreboard-icon.gold { background: rgba(251, 191, 36, .14); color: var(--amber); }
.scoreboard-icon.exp { background: rgba(167, 139, 250, .14); color: var(--violet); }
.scoreboard-list { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.scoreboard-list li { counter-increment: rank; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.scoreboard-list li:last-child { border-bottom: 0; }
.scoreboard-list li::before { content: counter(rank); width: 23px; height: 23px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 850; }
.scoreboard-list li:first-child::before { background: rgba(251, 191, 36, .14); color: var(--amber); }
.scoreboard-list strong { font-size: 12px; }
.scoreboard-list span { font-size: 12px; font-weight: 800; }
.scoreboard-list .score-empty { display: block; color: var(--muted); font-weight: 400; }
.scoreboard-list .score-empty::before { display: none; }
.player-bar-row { display: grid; grid-template-columns: minmax(80px, .8fr) 2fr auto; align-items: center; gap: 10px; }
.player-bar-row span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.player-bar-track { height: 8px; overflow: hidden; border-radius: 4px; background: #1d2a3c; }
.player-bar-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.player-bar-row strong { min-width: 54px; font-size: 11px; text-align: right; }
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; }
th { background: #131e30; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(96, 165, 250, .035); }
.name-cell { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.role-badge { display: inline-flex; padding: 2px 7px; border-radius: 10px; background: #20314a; color: var(--blue); font-size: 10px; font-weight: 800; }
.role-badge.base { background: #253528; color: var(--green); }
.health-cell { min-width: 110px; }
.health-line { width: 90px; height: 4px; margin-top: 4px; overflow: hidden; border-radius: 2px; background: #263348; }
.health-line i { display: block; height: 100%; background: var(--green); }

.map-panel { padding: 14px; }
.map-toolbar { min-height: 38px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.map-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.map-filters button, .secondary-button { padding: 7px 9px; border: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 700; }
.map-filters button { display: inline-flex; align-items: center; gap: 6px; }
.map-filters button.active, .secondary-button:hover { background: var(--surface-2); color: var(--text); }
.map-filters button:not(.active) .map-key { opacity: .35; }
.map-key { width: 8px; height: 8px; border-radius: 50%; }
.map-key.player { background: var(--blue); }
.map-key.base { border-radius: 2px; background: var(--amber); }
.map-key.party { background: var(--violet); }
.map-key.base-pal { background: var(--green); }
.map-key.wild { background: var(--cyan); }
.map-key.dungeon { border-radius: 2px; background: var(--red); }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 12px; }
.map-canvas-wrap { position: relative; min-height: 520px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: #0d1726; }
.map-canvas-wrap canvas { cursor: grab; touch-action: none; }
.map-canvas-wrap canvas.is-dragging { cursor: grabbing; }
.map-help { position: absolute; right: 9px; bottom: 8px; padding: 4px 7px; border-radius: 4px; background: rgba(7, 13, 23, .76); color: var(--muted); font-size: 10px; pointer-events: none; }
.map-detail { min-height: 200px; padding: 17px; border: 1px solid var(--border); border-radius: 8px; background: #0f1929; }
.map-detail h3 { margin: 4px 0 4px; font-size: 19px; }
.map-detail dl { margin: 16px 0 0; }
.map-detail div { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.map-detail dt { color: var(--muted); }
.map-detail dd { margin: 0; font-weight: 700; text-align: right; }
.map-roster { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.map-roster button { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.map-roster button:hover { color: var(--text); border-color: #3d526f; }
.dungeon-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dungeon-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.dungeon-card h4 { margin: 3px 0 10px; font-size: 15px; }
.dungeon-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }
.dungeon-meta span { padding: 3px 7px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 10px; }
.dungeon-pals { margin: 0; color: var(--muted); font-size: 12px; }
.dungeon-empty { grid-column: 1 / -1; padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; }

.site-footer { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 32px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.toast { position: fixed; z-index: 50; right: 18px; bottom: 18px; max-width: 360px; padding: 11px 14px; border: 1px solid #6c3340; border-radius: 7px; background: #291720; color: #fecdd3; font-size: 12px; }

.page-link { display: inline-flex; align-items: center; text-decoration: none; }
.trainers-page { min-height: calc(100vh - 130px); }
.trainers-heading { align-items: flex-end; }
.trainers-heading h1 { max-width: 820px; }
.trainer-heading-actions { display: flex; align-items: center; gap: 10px; }
.trainer-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trainer-method { margin: 2px 0 38px; padding: 12px 14px; border-left: 3px solid var(--blue); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); color: var(--muted); font-size: 12px; }
.trainer-method p { margin: 0; }
.trainer-method strong { color: var(--text); }
.trainer-method span { flex: 0 0 auto; }
.trainer-section-heading { margin-bottom: 15px; }
.trainer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.trainer-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.trainer-card-header { display: flex; align-items: center; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--border-soft); }
.trainer-avatar { width: 38px; height: 38px; flex: 0 0 auto; }
.trainer-name-line { display: flex; align-items: center; gap: 8px; }
.trainer-name-line h3 { margin: 0; font-size: 16px; }
.trainer-card-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.trainer-online { padding: 2px 6px; border-radius: 8px; background: rgba(52, 211, 153, .12); color: var(--green); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.favourite-pal { margin-top: 15px; padding: 13px; border: 1px solid #30445f; border-radius: 8px; background: #121f32; }
.favourite-pal-line { margin-top: 7px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.favourite-pal-image { width: 72px; height: 64px; flex: 0 0 auto; margin: -8px 0 -4px -5px; }
.favourite-pal strong, .favourite-pal span { display: block; }
.favourite-pal strong { font-size: 16px; }
.favourite-pal span { color: var(--muted); font-size: 11px; }
.favourite-time { text-align: right; }
.favourite-time strong { color: var(--blue); }
.pal-usage-breakdown { display: grid; gap: 9px; margin-top: 15px; }
.pal-usage-row { display: grid; grid-template-columns: minmax(90px, 1fr) 1.5fr 44px; align-items: center; gap: 10px; }
.pal-usage-label span, .pal-usage-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-usage-label span { font-size: 11px; font-weight: 700; }
.pal-usage-label small { color: var(--muted); font-size: 9px; }
.pal-usage-track { height: 6px; overflow: hidden; border-radius: 3px; background: #1d2a3c; }
.pal-usage-track i { display: block; height: 100%; border-radius: inherit; background: var(--violet); }
.pal-usage-row > strong { font-size: 10px; text-align: right; }
.trainer-last-seen { display: block; margin-top: 13px; color: var(--muted); font-size: 10px; }
.trainer-no-usage { margin: 16px 0 0; padding: 15px; border: 1px dashed var(--border); border-radius: 7px; color: var(--muted); font-size: 12px; text-align: center; }

.awards-page { min-height: calc(100vh - 130px); }
.awards-heading { align-items: flex-end; }
.awards-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.awards-note { margin: 2px 0 38px; padding: 12px 14px; border-left: 3px solid var(--violet); background: var(--surface); color: var(--muted); font-size: 12px; }
.awards-note p { margin: 0; }
.awards-note strong { color: var(--text); }
.awards-section-heading { align-items: flex-end; }
.award-filters { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.award-filters button { padding: 6px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.award-filters button.active, .award-filters button:hover { background: var(--surface-2); color: var(--text); }
.awards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.award-card { min-width: 0; min-height: 310px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; background: var(--surface); }
.award-card.is-unavailable { border-style: dashed; }
.award-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.award-category { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.award-state { padding: 2px 7px; border-radius: 9px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.award-state.available { background: rgba(52, 211, 153, .12); color: var(--green); }
.award-state.unavailable { background: var(--surface-2); color: var(--muted); }
.award-card h3 { margin: 13px 0 2px; font-size: 20px; letter-spacing: -.02em; }
.award-description { min-height: 42px; margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.award-winner { display: flex; align-items: center; gap: 12px; margin-top: auto; padding: 13px; border: 1px solid var(--border-soft); border-radius: 8px; background: #0f1929; }
.award-winner > div { min-width: 0; }
.award-winner strong, .award-winner small, .award-winner-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award-winner strong { font-size: 15px; }
.award-winner small, .award-winner-label { color: var(--muted); font-size: 10px; }
.award-winner-label { text-transform: uppercase; letter-spacing: .05em; }
.award-avatar { width: 44px; height: 44px; }
.award-pal-image { width: 54px; height: 54px; flex: 0 0 auto; }
.award-value { display: block; margin-top: 12px; color: var(--amber); font-size: 14px; }
.award-awaiting { margin-top: auto; padding: 14px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); }
.award-awaiting strong, .award-awaiting span { display: block; }
.award-awaiting strong { color: var(--text); font-size: 13px; }
.award-awaiting span { margin-top: 3px; font-size: 10px; }
.award-source { margin-top: 13px; color: var(--muted); font-size: 9px; }

.milestones-page { min-height: calc(100vh - 130px); }
.milestones-heading { align-items: flex-end; }
.milestones-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.milestones-note { margin: 2px 0 38px; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--surface); color: var(--muted); font-size: 12px; }
.milestones-note p { margin: 0; }
.milestones-note strong { color: var(--text); }
.milestones-section-heading { align-items: flex-end; }
.milestone-filters { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.milestone-filters button { padding: 6px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.milestone-filters button.active, .milestone-filters button:hover { background: var(--surface-2); color: var(--text); }
.milestone-timeline { position: relative; max-width: 980px; margin: 0 auto; padding-left: 32px; }
.milestone-timeline::before { position: absolute; content: ""; top: 12px; bottom: 0; left: 9px; width: 1px; background: var(--border); }
.milestone-year { position: relative; margin: 30px 0 12px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.milestone-year:first-child { margin-top: 0; }
.milestone-card { position: relative; min-height: 150px; margin-bottom: 13px; border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: 1fr; overflow: visible; background: var(--surface); }
.milestone-card.has-image { grid-template-columns: minmax(180px, 280px) 1fr; }
.milestone-card.is-featured { border-color: #405473; }
.milestone-marker { position: absolute; z-index: 2; top: 23px; left: -30px; width: 13px; height: 13px; border: 3px solid var(--bg); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--border); }
.milestone-card.is-featured .milestone-marker { background: var(--amber); }
.milestone-image { width: 100%; height: 100%; min-height: 180px; max-height: 270px; border-radius: 9px 0 0 9px; object-fit: cover; background: #0d1726; }
.milestone-body { min-width: 0; padding: 19px; display: flex; flex-direction: column; }
.milestone-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.milestone-category { padding: 2px 7px; border-radius: 9px; background: var(--surface-2); color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.milestone-card.is-featured .milestone-category { color: var(--amber); }
.milestone-body h3 { margin: 9px 0 3px; font-size: 19px; letter-spacing: -.02em; }
.milestone-description { margin: 0; color: var(--muted); font-size: 12px; }
.milestone-player { margin-top: 15px; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 750; }
.milestone-source { margin-top: auto; padding-top: 14px; color: var(--muted); font-size: 9px; }
.chronicle-section { padding-top: 42px; }
.daily-story-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.daily-story-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(17, 28, 47, .93); }
.daily-story-date { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.daily-story-card h3 { margin: 7px 0 5px; font-size: 18px; letter-spacing: -.02em; }
.daily-story-narrative { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.daily-story-facts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 5px; }
.daily-story-facts span { padding: 3px 7px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(11, 20, 35, .74); color: #bac7d8; font-size: 9px; font-weight: 700; }
.stories-toggle { display: block; margin: 15px auto 0; }
.achievement-section { padding-bottom: 24px; }
.achievement-toolbar { margin: 18px 0 14px; padding: 12px; display: grid; grid-template-columns: minmax(230px, .8fr) auto minmax(420px, 1.5fr); align-items: end; gap: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: rgba(13, 23, 40, .88); }
.achievement-search, .achievement-filter-group { min-width: 0; display: grid; gap: 5px; }
.achievement-search > span, .achievement-filter-group > span { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.achievement-search input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: 7px; outline: 0; background: rgba(9, 17, 30, .88); color: var(--text); }
.achievement-search input::placeholder { color: #66758b; }
.achievement-search input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(96, 165, 250, .12); }
.achievement-filter-group .milestone-filters { flex-wrap: nowrap; overflow-x: auto; }
.achievement-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.achievement-card { min-width: 0; min-height: 210px; padding: 15px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; background: rgba(17, 28, 47, .94); }
.achievement-card.is-unlocked { border-color: rgba(52, 211, 153, .4); box-shadow: inset 0 2px 0 rgba(52, 211, 153, .16); }
.achievement-card.is-locked { opacity: .78; }
.achievement-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.achievement-category { color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.achievement-state { padding: 2px 6px; border-radius: 9px; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.achievement-state.unlocked { background: rgba(52, 211, 153, .12); color: var(--green); }
.achievement-state.locked { background: var(--surface-2); color: var(--muted); }
.achievement-card h3 { margin: 12px 0 4px; font-size: 16px; line-height: 1.2; letter-spacing: -.015em; }
.achievement-description { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.achievement-progress { margin-top: auto; padding-top: 15px; }
.achievement-progress-line { height: 4px; overflow: hidden; border-radius: 3px; background: #26354d; }
.achievement-progress-line i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); }
.achievement-card.is-unlocked .achievement-progress-line i { background: var(--green); }
.achievement-progress > span { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }

.matrix-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.matrix-toolbar {
  margin: 20px 0 14px;
  padding: 12px;
  display: flex;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(13, 23, 40, .86);
}
.matrix-search { min-width: 230px; flex: 1 1 320px; display: grid; gap: 5px; }
.matrix-search span, .matrix-filter-label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.matrix-search input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: rgba(9, 17, 30, .88);
  color: var(--text);
}
.matrix-search input::placeholder { color: #66758b; }
.matrix-search input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(96, 165, 250, .12); }
.matrix-filter { display: grid; gap: 5px; }
.matrix-filter .range-control { margin: 0; }
.matrix-results { margin-left: auto; padding-bottom: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.matrix-table-shell {
  max-height: min(72vh, 820px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(11, 20, 35, .9);
  scrollbar-color: #354966 #111b2c;
}
.matrix-table { width: 100%; min-width: 780px; border-spacing: 0; border-collapse: separate; }
.matrix-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.matrix-table th, .matrix-table td { border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.matrix-table tr > :last-child { border-right: 0; }
.matrix-table tbody tr:last-child > * { border-bottom: 0; }
.matrix-table thead th {
  position: sticky;
  z-index: 5;
  top: 0;
  min-width: 180px;
  padding: 12px;
  background: rgba(16, 27, 46, .98);
  text-align: left;
  vertical-align: top;
}
.matrix-table thead th:first-child { z-index: 7; left: 0; min-width: 220px; }
.matrix-owner-heading { display: flex; align-items: center; gap: 9px; }
.matrix-owner-heading .player-portrait { width: 34px; height: 34px; flex: 0 0 auto; }
.matrix-owner-heading strong, .matrix-owner-heading small { display: block; }
.matrix-owner-heading strong { font-size: 12px; }
.matrix-owner-heading small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 600; }
.matrix-species-cell {
  position: sticky;
  z-index: 3;
  left: 0;
  min-width: 220px;
  padding: 13px 14px;
  background: rgba(15, 26, 44, .98);
  text-align: left;
}
.matrix-species { display: flex; align-items: center; gap: 10px; }
.matrix-species .pal-image { width: 42px; height: 42px; flex: 0 0 auto; }
.matrix-species strong, .matrix-species small { display: block; }
.matrix-species strong { font-size: 13px; }
.matrix-species small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 600; }
.matrix-cell { min-width: 180px; padding: 11px 12px; vertical-align: top; background: rgba(14, 24, 41, .82); }
.matrix-cell.has-pals { background: rgba(18, 32, 52, .92); }
.matrix-cell-empty { color: #536176; font-size: 18px; text-align: center; vertical-align: middle; }
.matrix-cell-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.matrix-cell-heading strong { font-size: 12px; }
.matrix-cell-heading span { color: var(--blue); font-size: 10px; font-weight: 800; }
.matrix-pal-names { margin-top: 5px; color: var(--text); font-size: 11px; line-height: 1.35; }
.matrix-cell-meta { margin-top: 7px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 9px; }
.matrix-cell-meta .role-badge { padding: 1px 5px; font-size: 8px; }
.matrix-note { align-items: flex-start; }
.matrix-note span { white-space: nowrap; }
.matrix-empty { margin-top: 0; border-radius: var(--radius); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

@media (max-width: 1120px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .trainer-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .charts-grid, .player-grid { grid-template-columns: 1fr; }
  .dungeon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .overview-grid > :last-child { grid-column: 1 / -1; }
  .awards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .achievement-toolbar { grid-template-columns: minmax(220px, 1fr) 1fr; }
  .achievement-categories { grid-column: 1 / -1; }
  .achievement-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  body::before { inset: -38px 0; }
  .header-inner, .page-shell, .site-footer { width: min(100% - 24px, 1480px); }
  .header-inner { min-height: 60px; padding: 10px 0 8px; flex-wrap: wrap; gap: 8px 14px; }
  .brand small, .refresh-status { display: none; }
  .header-status { margin-left: auto; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .main-nav a { flex: 1 0 auto; text-align: center; }
  .page-shell { padding-top: 26px; }
  .page-heading, .section-heading, .split-heading { display: block; }
  .range-control { margin-top: 17px; }
  .split-heading .info-note { max-width: none; margin-top: 13px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .trainer-summary { grid-template-columns: repeat(2, 1fr); }
  .awards-summary { grid-template-columns: repeat(3, 1fr); }
  .milestones-summary { grid-template-columns: repeat(2, 1fr); }
  .awards-grid { grid-template-columns: 1fr; }
  .awards-section-heading, .milestones-section-heading { display: block; }
  .award-filters, .milestone-filters { margin-top: 14px; }
  .trainer-grid { grid-template-columns: 1fr; }
  .trainer-method { align-items: flex-start; flex-direction: column; gap: 5px; }
  .trainer-heading-actions { align-items: flex-start; flex-direction: column; margin-top: 17px; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid > :last-child { grid-column: auto; }
  .map-layout { grid-template-columns: 1fr; }
  .scoreboard-grid, .dungeon-grid { grid-template-columns: 1fr; }
  .map-canvas-wrap { min-height: 420px; }
  .map-detail { min-height: 0; }
  .section-block { padding-top: 55px; }
  .canvas-wrap { height: 230px; }
  .heatmap { grid-template-columns: 28px repeat(24, 13px); }
  .matrix-toolbar { align-items: stretch; flex-direction: column; }
  .matrix-search { min-width: 0; }
  .matrix-results { margin-left: 0; padding: 0; }
  .matrix-filter .range-control { display: flex; overflow-x: auto; }
  .matrix-table-shell { max-height: 68vh; }
  .matrix-table thead th, .matrix-cell { min-width: 160px; }
  .matrix-table thead th:first-child, .matrix-species-cell { min-width: 180px; }
  .daily-story-grid { grid-template-columns: 1fr; }
  .achievement-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .achievement-categories { grid-column: auto; }
  .achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .summary-grid { gap: 8px; }
  .summary-card { min-height: 100px; padding: 13px; }
  .summary-card strong { font-size: 21px; }
  .panel { padding: 15px; }
  .map-panel { padding: 9px; }
  .map-toolbar { align-items: flex-start; }
  .secondary-button { white-space: nowrap; }
  .map-canvas-wrap { min-height: 350px; }
  .site-footer { display: grid; gap: 4px; }
  .favourite-pal-line { align-items: flex-start; flex-direction: column; gap: 8px; }
  .favourite-time { text-align: left; }
  .pal-usage-row { grid-template-columns: minmax(80px, 1fr) 1fr 38px; }
  .awards-summary { grid-template-columns: 1fr; }
  .milestones-summary { grid-template-columns: 1fr; }
  .milestone-card.has-image { grid-template-columns: 1fr; }
  .milestone-image { min-height: 190px; max-height: 260px; border-radius: 9px 9px 0 0; }
  .matrix-summary { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { transform: none; will-change: auto; }
}
