/* Dedicated Waystone hiscores page. Layers on top of landing.css (which owns
   the :root tokens, masthead, footer, buttons and typography). Everything here
   is the OSRS-style hall: skill rail, ranked board and the character record. */

.subpage { min-height: 100vh; }
.subpage-main { padding-bottom: 96px; }
body.modal-open { overflow: hidden; }

/* ---- page hero ------------------------------------------------------- */
.page-hero {
  position: relative;
  padding: calc(96px + 4vw) 0 34px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 80% -20%, rgba(220, 169, 79, 0.14), transparent 55%),
    linear-gradient(180deg, var(--ink-850), var(--ink-900));
}
.page-hero__aura {
  position: absolute;
  inset: -40% 30% auto -10%;
  height: 460px;
  background: radial-gradient(60% 60% at 30% 40%, rgba(120, 152, 99, 0.16), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}
.page-hero__inner { position: relative; }
.page-hero h1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
  margin: 10px 0 16px;
  color: var(--paper);
}
.page-hero--hiscores h1 {
  background: linear-gradient(180deg, #fff4cf 0%, var(--gold-hot) 44%, var(--gold) 78%, #b9812f 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}
.page-hero__lead { max-width: 720px; color: var(--stone); font-size: 1.12rem; line-height: 1.62; }
.page-hero__meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hs-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px;
  font-family: var(--utility); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--stone);
  background: rgba(12, 22, 17, 0.7);
  border: 1px solid var(--line-strong);
}
.hs-chip--ghost { color: var(--quiet); background: transparent; }
.hs-chip .status-dot { width: 8px; height: 8px; }

/* ---- shell + search -------------------------------------------------- */
.hiscores-shell { margin-top: 30px; }
.hs-search { display: flex; gap: 12px; margin-bottom: 22px; }
.hs-search__field {
  position: relative; flex: 1; display: flex; align-items: center;
  background: var(--ink-850); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 0 14px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hs-search__field:focus-within { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(220, 169, 79, 0.14); }
.hs-search__field > svg { width: 20px; height: 20px; color: var(--quiet); flex: none; }
.hs-search__field input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--paper); font-family: var(--body); font-size: 1.02rem; padding: 15px 10px;
}
.hs-search__field input::placeholder { color: var(--quiet); }
.hs-search__clear {
  border: none; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1;
  cursor: pointer; padding: 0 4px; transition: color 0.15s ease;
}
.hs-search__clear:hover { color: var(--paper); }

/* ---- grid ------------------------------------------------------------ */
.hiscores-grid { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 22px; align-items: start; }

/* ---- skill rail ------------------------------------------------------ */
.skill-rail {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px; border-radius: 16px;
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-deep);
  position: sticky; top: 84px;
}
.skill-rail__loading { padding: 18px; color: var(--quiet); font-size: 0.9rem; }
.skill-rail__item {
  display: flex; align-items: center; gap: 13px;
  padding: 9px 12px; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--stone); cursor: pointer; text-align: left; width: 100%;
  font-family: var(--body); font-size: 0.98rem;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.skill-rail__item:hover { background: rgba(120, 152, 99, 0.09); color: var(--paper); }
.skill-rail__item.is-active {
  background: linear-gradient(180deg, rgba(220, 169, 79, 0.18), rgba(220, 169, 79, 0.06));
  border-color: rgba(220, 169, 79, 0.4);
  color: var(--gold-hot);
  box-shadow: inset 3px 0 0 var(--gold);
}
.skill-rail__badge {
  width: 42px; height: 42px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: radial-gradient(circle at 50% 34%, #22301f, #0c1510);
  border: 1px solid var(--line-strong);
}
.skill-rail__badge img { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.skill-rail__badge.is-overall svg { width: 24px; height: 24px; color: var(--gold-hot); }
.skill-rail__item.is-active .skill-rail__badge { border-color: rgba(220, 169, 79, 0.5); }
.skill-rail__label { font-family: var(--display); letter-spacing: 0.01em; font-size: 1.06rem; }

/* ---- score board ----------------------------------------------------- */
.score-board {
  border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-deep);
}
.board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(220, 169, 79, 0.1), transparent);
  border-bottom: 1px solid var(--line-strong);
}
.board-head__title { display: flex; align-items: center; gap: 14px; }
.board-head__icon { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.board-head__crown { width: 30px; height: 30px; color: var(--gold-hot); }
.board-head__title small { display: block; font-family: var(--utility); text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.72rem; color: var(--quiet); }
.board-head__title strong { font-family: var(--display); font-size: 1.7rem; color: var(--paper); }
.board-head__cols { display: none; }

.board-body { max-height: 72vh; overflow-y: auto; }
.board-empty { padding: 46px 24px; text-align: center; color: var(--quiet); font-size: 1rem; }

/* ---- table ----------------------------------------------------------- */
.hs-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hs-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #0a130e;
  font-family: var(--utility); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.74rem;
  color: var(--gold); font-weight: 600; text-align: left;
  padding: 13px 18px; border-bottom: 1px solid var(--line-strong);
}
.hs-table th.col-num, .hs-table td.col-num { text-align: right; }
.hs-table th.col-rank { width: 96px; }
.hs-table tbody td { padding: 11px 18px; border-bottom: 1px solid rgba(207, 218, 207, 0.06); }
.hs-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.014); }
.hs-table tbody tr:hover { background: rgba(120, 152, 99, 0.08); }
.hs-table tbody tr.is-match { background: rgba(220, 169, 79, 0.12); box-shadow: inset 2px 0 0 var(--gold-hot); }
.hs-table tbody tr:last-child td { border-bottom: none; }
.col-num { color: var(--stone); }
.col-xp { color: var(--muted); }

.rank-medal {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px;
  padding: 0 8px; border-radius: 7px; font-family: var(--utility); font-weight: 600; font-size: 0.9rem;
  color: var(--muted); background: rgba(255, 255, 255, 0.03); border: 1px solid transparent;
}
.rank-medal--1 { color: #23180a; background: linear-gradient(180deg, #ffe694, #e0a336); border-color: #ffed9e; }
.rank-medal--2 { color: #1c1c22; background: linear-gradient(180deg, #eaeef4, #b3bcca); border-color: #f2f5fa; }
.rank-medal--3 { color: #2a1408; background: linear-gradient(180deg, #e6a670, #b06a34); border-color: #eeb886; }

.hs-name {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--gold-hot); font-family: var(--body); font-size: 1.02rem; font-weight: 500;
  text-align: left; transition: color 0.13s ease;
}
.hs-name:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gold); }

.board-note { padding: 15px 24px; color: var(--quiet); font-size: 0.86rem; border-top: 1px solid var(--line); margin: 0; }

/* ---- character record modal ------------------------------------------ */
.record-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.record-modal[hidden] { display: none; }
.record-modal__scrim { position: absolute; inset: 0; background: rgba(3, 6, 5, 0.72); backdrop-filter: blur(3px); }
.record-modal__panel {
  position: relative; width: min(620px, 100%); max-height: 88vh; overflow-y: auto;
  border-radius: 18px; padding: 28px;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-900));
  border: 1px solid rgba(220, 169, 79, 0.34);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: record-in 0.18s ease;
}
@keyframes record-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.record-modal__close {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.3); color: var(--muted); cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.record-modal__close:hover { color: var(--paper); border-color: var(--gold-dark); }
.record-modal__close svg { width: 18px; height: 18px; }
.record-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.record-head__badge { width: 54px; height: 54px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: radial-gradient(circle at 50% 30%, #2a3a24, #0c1510); border: 1px solid rgba(220, 169, 79, 0.4); }
.record-head__badge svg { width: 30px; height: 30px; color: var(--gold-hot); }
.record-head__id small { font-family: var(--utility); text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.72rem; color: var(--quiet); }
.record-head__id h2 { font-family: var(--display); font-size: 2rem; color: var(--paper); line-height: 1.05; }
.record-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.record-total { text-align: center; padding: 16px 10px; border-radius: 12px; background: var(--ink-850); border: 1px solid var(--line-strong); }
.record-total strong { display: block; font-family: var(--display); font-size: 1.6rem; color: var(--paper); }
.record-total span { display: block; margin-top: 4px; font-family: var(--utility); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.68rem; color: var(--quiet); }
.record-total--rank strong { color: var(--gold-hot); }
.record-skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.record-skill {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px; cursor: pointer; text-align: left;
  background: var(--ink-850); border: 1px solid var(--line-strong); color: var(--stone);
  transition: border-color 0.13s ease, background 0.13s ease;
}
.record-skill:hover { border-color: var(--gold-dark); background: rgba(120, 152, 99, 0.08); }
.record-skill img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.record-skill__meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.record-skill__name { font-family: var(--display); font-size: 1.02rem; color: var(--paper); }
.record-skill__xp { font-size: 0.74rem; color: var(--quiet); }
.record-skill__lv { font-family: var(--utility); font-size: 1.2rem; font-weight: 700; color: var(--stone); }
.record-skill.is-max .record-skill__lv { color: var(--gold-hot); }

/* ---- responsive ------------------------------------------------------ */
@media (max-width: 860px) {
  .hiscores-grid { grid-template-columns: 1fr; }
  .skill-rail {
    position: static; flex-direction: row; overflow-x: auto; gap: 6px;
    scrollbar-width: thin; padding: 8px;
  }
  .skill-rail__item { flex-direction: column; gap: 6px; min-width: 78px; padding: 10px 8px; text-align: center; }
  .skill-rail__item.is-active { box-shadow: inset 0 3px 0 var(--gold); }
  .skill-rail__label { font-size: 0.82rem; }
  .board-body { max-height: none; }
  .record-totals { grid-template-columns: 1fr; }
  .record-skills { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hs-table thead th, .hs-table tbody td { padding-left: 12px; padding-right: 12px; }
  .col-xp { display: none; }
  .hs-table th.col-num:last-child { display: none; }
}
