
/* Colors come from the dashboard's assets/theme.css, so both sites always match.
   Edit them there. Sizes and spacing below follow the dashboard's style.css. */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  --selected: color-mix(in srgb, var(--accent) 14%, transparent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 16px;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Header */
.top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 28px; height: 28px; display: block; }
.top h1 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.25; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--text-muted); text-decoration: none; font-weight: 500; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.theme-btn {
  margin-left: auto; display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; cursor: pointer; color: var(--text-muted);
}
.theme-btn:hover { color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }

.notice { margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.notice.ok { border-color: var(--complete); }
.notice.err { border-color: var(--danger); }
.notice.warn { border-color: var(--warning); }
.notice strong { color: var(--warning); }
.notice ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-muted); }

/* Three panes */
.app {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr) minmax(250px, 320px); gap: 12px;
}
.pane {
  min-width: 0; min-height: 0; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.pane-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.pane-head h2 { margin: 0; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.pane-head h2 span { color: var(--text-muted); font-weight: 400; }
.search {
  width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.search::placeholder { color: var(--text-muted); }
.diff-select {
  width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}

/* Level list */
.list { list-style: none; margin: 0; padding: 4px; }
.row {
  display: grid; grid-template-columns: 36px 36px minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; text-decoration: none; color: inherit;
}
.row:hover { background: var(--surface-hover); }
.row[aria-current="true"] { background: var(--selected); }
.row img { width: 36px; height: 36px; }
.row .rank { color: var(--text-muted); font-size: 13px; text-align: right; }
.row[aria-current="true"] .rank { color: var(--accent); font-weight: 600; }
.row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.est .name { color: var(--text-muted); font-style: italic; }
.est-note { font-style: italic; }

/* Filters */
.frow { display: flex; gap: 6px; }
.fbtn {
  padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg);
  cursor: pointer; font-size: 13px;
}
.fbtn[aria-expanded="true"] { border-color: var(--accent); }
.fbtn.plain { background: none; border-color: transparent; color: var(--text-muted); }
.fbtn.plain:hover { color: var(--text); }
.fpanel { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }
.flabel { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.flabel small { opacity: 0.8; }
.fchips { display: flex; flex-wrap: wrap; gap: 4px; }
.fchip {
  padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border); background: none;
  font-size: 12.5px; cursor: pointer; color: var(--text-muted);
}
.fchip:hover { color: var(--text); }
.fchip[aria-pressed="true"] { background: var(--selected); border-color: var(--accent); color: var(--text); }

/* Leaderboard list switch */
.seg { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg a { flex: 1; text-align: center; padding: 5px 8px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a[aria-current="true"] { background: var(--selected); color: var(--text); }
.empty { color: var(--text-muted); padding: 16px; text-align: center; font-size: 13px; margin: 0; }

/* Level sheet */
.sheet { padding: 18px; display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.hero { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: center; }
.hero img { width: 88px; height: 88px; }
.hero h3 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
.hero .line { color: var(--text-muted); margin-top: 4px; }
.hero .line b { color: var(--text); font-weight: 500; }
.rating-epic { color: var(--epic); font-weight: 600; }
.rating-featured { color: var(--featured); font-weight: 600; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 20px; margin: 0; padding-top: 16px; border-top: 1px solid var(--border); }
.facts dt { font-size: 12px; color: var(--text-muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.pts { color: var(--points); font-weight: 600; }
.facts dd a { color: inherit; }
.copy { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 500; border-bottom: 1px dotted var(--text-muted); }
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copied { color: var(--text-muted); font-size: 12px; font-weight: 400; margin-left: 6px; }

.video-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; text-decoration: none; }
.dash-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; font-size: 13px; }
.dash-link:hover { background: var(--surface-hover); }
.video-link:hover { text-decoration: underline; }
.video-link svg { width: 14px; height: 14px; fill: currentColor; }
.video-embed { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.section-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.tags { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 12px; align-items: baseline; padding-top: 16px; border-top: 1px solid var(--border); }
.tags > span { color: var(--text-muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 5px;
  border: 1px solid var(--border); font-size: 13px;
}
.chip small { color: var(--text-muted); }

/* Records */
.rec-table { width: 100%; border-collapse: collapse; }
.rec-table th, .rec-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.rec-table th { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.rec-table td.num, .rec-table th.num { text-align: right; }
.rec-table td.done { color: var(--complete); font-weight: 600; }
.rec-table a { color: inherit; text-decoration: none; }
.rec-table a:hover { color: var(--accent); }
.rec-table .who { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-table .badge { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.rec-table .vid a { color: var(--accent); }

/* Leaderboard */
.lb-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
.lb-row .pts { color: var(--points); font-size: 13px; font-weight: 500; }
.points-table { width: 100%; border-collapse: collapse; }
.points-table th, .points-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.points-table th { font-size: 12px; font-weight: 500; color: var(--text-muted); position: sticky; top: 0; background: var(--surface); }
.points-table td:last-child, .points-table th:last-child { text-align: right; }
.points-table td:last-child { color: var(--points); }
.points-table a { color: inherit; text-decoration: none; }
.points-table a:hover { color: var(--accent); }

.plist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.plist a { display: grid; grid-template-columns: 40px 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-decoration: none; color: inherit; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.plist a:hover { background: var(--surface-hover); }
.plist img { width: 28px; height: 28px; }
.plist .rk { color: var(--text-muted); font-size: 13px; text-align: right; }
.plist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .r { font-size: 13px; text-align: right; color: var(--points); }
.plist .r small { color: var(--text-muted); margin-right: 8px; }

@media (min-width: 1081px) {
  .app.no-right { grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); }
  .pane.right { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  html, body { height: auto; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .pane { overflow: visible; }
  .pane.left { max-height: 46vh; overflow: auto; }
  .hero { grid-template-columns: 64px minmax(0, 1fr); }
  .hero img { width: 64px; height: 64px; }
  .hero h3 { font-size: 22px; }
  .sheet { padding: 16px; }
  .tags { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tags > span:not(:first-child) { margin-top: 8px; }
}

/* ---------- Account area: same buttons and menus as the dashboard (style.css there) ---------- */
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-right .theme-btn { margin-left: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 500; font-size: 14px;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; padding: 5px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); font-weight: 500; font-size: 13px;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: "▾"; margin-left: 6px; color: var(--text-muted); font-size: 11px; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.menu-list a, .menu-list button {
  display: block; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text);
  text-decoration: none; background: none; border: 0; cursor: pointer; width: 100%; font-size: 14px;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface-hover); }
.menu-list form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.menu-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.submit-link { align-self: flex-start; }
.hist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.hist li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.hist time { color: var(--text-muted); }
.hist .up { color: var(--complete); }
.hist .down { color: var(--warning); }
.notdemon { color: var(--warning); font-size: 13px; }
.who-icon { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who-icon img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.hero .picon { width: 88px; height: 88px; object-fit: contain; }
.app.only-mid { grid-template-columns: minmax(0, 1fr) !important; }
.changes { padding: 18px; max-width: 900px; }
.changes h3 { margin: 0 0 12px; font-size: 22px; }
.changes table { width: 100%; border-collapse: collapse; }
.changes td, .changes th { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
.changes th { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.changes td a { color: inherit; }
@media (max-width: 760px) {
  .top-right { width: 100%; }
  .hist li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
