:root {
  --bg: #0d1117;
  --bg2: #131a24;
  --panel: #161f2b;
  --panel2: #1b2634;
  --line: #263447;
  --text: #dfe7f1;
  --muted: #8b9bb0;
  --gold: #d9b15c;
  --gold-dim: #8a7135;
  --blue: #5aa9e6;
  --green: #5fbf7f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1a2433 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #17202c 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", Roboto, system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header */
.top {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 172px;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(13,17,23,.08) 0%, rgba(13,17,23,.45) 48%, rgba(13,17,23,.96) 100%),
    linear-gradient(90deg, rgba(13,17,23,.94) 0%, rgba(13,17,23,.5) 42%, rgba(13,17,23,.02) 78%),
    url('/banner.jpg');
  background-size: cover;
  background-position: center, center, center 44%;
  background-repeat: no-repeat;
}
.top-inner {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 22px rgba(217,177,92,.28), 0 4px 14px rgba(0,0,0,.5);
  flex: 0 0 auto;
}
.brand h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .5px;
  text-shadow: 0 2px 14px rgba(0,0,0,.9);
}
.tagline {
  margin-top: 2px;
  font-size: 12px;
  color: #b9c7d8;
  text-shadow: 0 1px 8px rgba(0,0,0,.9);
}
.badges { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; }
.badge {
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  background: rgba(13,17,23,.72);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.badge.ghost { border-color: var(--line); color: var(--muted); }

@media (max-width: 1000px) {
  .top { min-height: 132px; }
  .brand h1 { font-size: 20px; }
  .brand-icon { width: 40px; height: 40px; }
  .tagline { display: none; }
}

/* layout */
main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 16px;
  padding: 16px 22px 8px;
  align-items: start;
}
.column { display: grid; gap: 16px; }
.left { display: grid; gap: 16px; align-content: start; }

/* region switch */
.region-switch { display: flex; gap: 4px; }
.region-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
}
.region-switch button.active { border-color: var(--gold-dim); color: var(--gold); background: rgba(217,177,92,.1); }

/* today */
.today-body { padding: 12px 14px 14px; }
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.today-card {
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.today-card.wide { grid-column: 1 / -1; }
.today-card h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.affix-row { display: flex; flex-wrap: wrap; gap: 6px; }
.affix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-size: 12.5px;
  color: #c9d6e6;
}
.affix:hover { border-color: var(--gold-dim); color: var(--gold); text-decoration: none; }
.affix img { width: 18px; height: 18px; border-radius: 4px; }
.cap-list { display: grid; gap: 4px; }
.cap-line { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #c9d6e6; }
.cap-line:hover { color: var(--gold); text-decoration: none; }
.cap-line img { width: 17px; height: 17px; border-radius: 3px; }
.cap-line b { margin-left: auto; color: var(--gold); font-weight: 600; font-size: 12.5px; }
.boss { font-size: 15px; }
.boss .mini { font-size: 11px; color: var(--muted); margin-left: 6px; }
.token { font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }
.token small { font-size: 11px; color: var(--muted); }
.token-chart { position: relative; margin-top: 6px; }
.token-chart svg { display: block; width: 100%; height: 64px; }
.token-range {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.token-tip {
  position: absolute;
  top: -4px;
  transform: translate(-50%, -100%);
  background: rgba(13,17,23,.95);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 11px;
  line-height: 1.4;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.countdown {
  font: 600 22px/1.2 ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.countdown.soon { color: #e0a15c; }
.reset-at { font-size: 11px; color: var(--muted); margin-top: 2px; }
.today-qty { color: var(--muted); font-size: 12px; }

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; }
}

/* panels */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gold);
}
.src { font-size: 12px; color: var(--muted); }
.head-right { display: flex; align-items: baseline; gap: 10px; }

.placeholder { color: var(--muted); padding: 18px 16px; font-size: 14px; }

/* news */
.news-scroll {
  max-height: calc(100vh - 190px);
  min-height: 420px;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}
.news-scroll::-webkit-scrollbar { width: 8px; }
.news-scroll::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 8px; }

.news-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(38,52,71,.6);
}
.news-item:last-child { border-bottom: 0; }
.news-item:hover { background: rgba(255,255,255,.025); }
.thumb {
  width: 84px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel2);
}
.news-item h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.news-item h3 a { color: var(--text); }
.news-item h3 a:hover { color: var(--gold); text-decoration: none; }
.news-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.news-excerpt { font-size: 13px; color: #a9b7c9; margin: 0; }

/* meta */
.meta-body {
  padding: 10px 16px 14px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}
.meta-body::-webkit-scrollbar { width: 8px; }
.meta-body::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 8px; }
.meta-note {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 12px;
  padding-left: 10px;
  border-left: 2px solid var(--gold-dim);
}
.spec-row {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.spec-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.role-icon { display: inline-flex; width: 12px; height: 12px; flex: 0 0 auto; opacity: .9; }
.role-icon svg { width: 12px; height: 12px; }
.role-tank { color: #5b9bd5; }
.role-healer { color: #58c47a; }
.role-dps { color: #d9755a; }
.spec-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.spec-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.spec-label:hover { color: var(--gold); text-decoration: none; }
.spec-share { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 5px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 4px; }
.dungeons { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

/* cutoffs */
.cutoffs-body { padding: 10px 16px 14px; }
.cutoff-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: #a9b7c9; margin-bottom: 8px; }
.cutoff-head b { color: var(--gold); font-weight: 600; }
.muted { color: var(--muted); }
.cutoff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cutoff-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.cutoff-table th:nth-child(2), .cutoff-table th:nth-child(3) { text-align: right; }
.cutoff-table td { padding: 4px 6px; border-bottom: 1px solid rgba(38,52,71,.5); }
.cutoff-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* top runs */
.runs-body { padding: 6px 12px 10px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gold-dim) transparent; }
.runs-body::-webkit-scrollbar { width: 8px; }
.runs-body::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 8px; }
.run-card { padding: 7px 4px 8px; border-bottom: 1px solid rgba(38,52,71,.45); }
.run-card:last-child { border-bottom: 0; }
.run-head {
  display: grid;
  grid-template-columns: 28px 34px 1fr 44px 42px 42px;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.run-rank { color: var(--muted); }
.run-key { color: var(--gold); font-weight: 600; }
.run-dungeon { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-time { color: #a9b7c9; text-align: right; }
.run-left { color: var(--green); text-align: right; }
.run-left.over { color: #d96c6c; }
.run-score { color: var(--gold); text-align: right; }
.run-roster { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; padding-left: 2px; }
.member {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: #b9c7d8;
  line-height: 1.5;
}
a.member:hover { border-color: var(--gold-dim); color: var(--gold); text-decoration: none; }
.member-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* search */
.search-form { display: flex; gap: 8px; padding: 12px 16px 4px; }
.search-form input {
  flex: 1;
  background: #0f1720;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
.search-form input:focus { border-color: var(--gold-dim); }
.search-form button {
  background: linear-gradient(180deg, #2a2010, #1c150a);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  cursor: pointer;
}
.search-form button:hover { background: #2f2412; }
.results { padding: 8px 16px 14px; max-height: 320px; overflow-y: auto; }
.result-group { margin-top: 8px; }
.result-group h4 {
  margin: 6px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  font-weight: 600;
}
.result-item {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: #c9d6e6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-item:hover { background: rgba(217,177,92,.1); color: var(--gold); text-decoration: none; }

/* footer */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px 16px;
  color: var(--muted);
  font-size: 12px;
}
.foot-status.ok { color: var(--green); }
.foot-status.warn { color: #d99a5c; }
.foot-status.err { color: #d96c6c; }

.error-box {
  margin: 12px 16px;
  padding: 10px 12px;
  border: 1px solid #5a2b2b;
  background: rgba(217,108,108,.08);
  color: #e3a3a3;
  border-radius: 8px;
  font-size: 13px;
}
