@import url('https://fonts.googleapis.com/css2?family=Caprasimo&family=Figtree:wght@400;600;700;800;900&display=swap');

/* DarkLife / OneLife player portal — Organic theme.
   Same selectors as before: drop this in public/css/site.css, no HTML or JS changes. */

:root {
  color-scheme: light;

  /* ground + ink */
  --bg: #d3bf9c;
  --surface: #c6ae86;
  --surface-solid: #e6d8bf;
  --line: rgba(32, 30, 29, .22);
  --line-strong: rgba(32, 30, 29, .38);
  --text: #201e1d;
  --body: #474238;
  --muted: #645c50;
  --faint: #82796a;

  /* roles, taken from the two accent ramps */
  --rune: #b2622d;
  --rune-deep: #8c491a;
  --violet: #56633f;
  --gold: #c67139;
  --ember: #d67f48;
  --moss: #728157;
  --danger: #8c491a;

  --radius: 28px;
  --shadow-sm: 0 1px 2px rgba(46, 43, 37, .14);
  --shadow: 0 12px 32px rgba(46, 43, 37, .18);
  --font-display: "Caprasimo", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", "Noto Sans", "Hiragino Sans", "Microsoft YaHei", sans-serif;
}

:root:lang(ja), :root:lang(ko), :root:lang(zh), :root:lang(ru) { --font-display: var(--font-body); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 620px at 88% -12%, rgba(158, 176, 126, .45), transparent 62%),
    radial-gradient(760px 520px at -8% 24%, rgba(211, 164, 133, .5), transparent 62%),
    var(--bg);
}

.topbar, main, .footer { transition: opacity .25s ease; }
body:not(.ready) .topbar, body:not(.ready) main, body:not(.ready) .footer { opacity: 0; }
main { flex: 1; }
a { color: var(--rune-deep); text-decoration: none; }
a:hover { color: #643312; text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.015em; line-height: 1.14; margin: 0; }
:focus-visible { outline: 2px solid var(--rune); outline-offset: 2px; }
::selection { background: rgba(198, 113, 57, .3); }
.noscript { text-align: center; padding: 40px; color: var(--muted); }

.container { width: min(1180px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(880px, 100% - 40px); }

.ic { width: 20px; height: 20px; flex: none; stroke-width: 2.75; }
.ic-sm { width: 16px; height: 16px; }
.icon { display: inline-grid; place-items: center; flex: none; }

/* ── top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(211, 191, 156, .88);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--line);
}

.topbar-inner { width: min(1400px, 100% - 32px); margin-inline: auto; height: 72px; display: flex; align-items: center; gap: 20px; }

.brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  color: var(--text);
  font: 400 21px var(--font-display);
  letter-spacing: 0;
  text-decoration: none !important;
}

.brand img { border-radius: 999px; box-shadow: var(--shadow-sm); }

.nav { display: flex; gap: 4px; margin-right: auto; min-width: 0; }

.nav-link {
  color: var(--muted);
  padding: 9px 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none !important;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text); background: rgba(32, 30, 29, .06); }
.nav-link[aria-current="page"] { color: #722f0a; background: #e9bd9e; }
.nav-danger:hover { color: var(--danger); }
.nav-danger[aria-current="page"] { color: #fff2eb; background: var(--danger); }

.tools { display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: 700 14px var(--font-body);
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
}

.chip:hover { background: rgba(32, 30, 29, .07); }
.chip:active { background: rgba(32, 30, 29, .14); }
.chip-accent { background: #e9bd9e; border-color: transparent; color: #8c491a; }
.chip-accent:hover { background: #ffc6a5; }
.icon-only { width: 42px; padding: 0; justify-content: center; }
.menu-toggle { display: none; }

.avatar {
  width: 28px;
  height: 28px;
  margin-left: -6px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--rune);
  color: #f9f4ed;
  font-size: 13px;
  font-weight: 900;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 60;
}

.dropdown.open .menu { opacity: 1; transform: none; pointer-events: auto; }

.menu button, .menu a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: 600 14px var(--font-body);
  text-align: left;
  cursor: pointer;
  text-decoration: none !important;
}

.menu button:hover, .menu a:hover { background: #e9bd9e; color: #8c491a; }
.menu [aria-selected="true"] { color: #8c491a; font-weight: 800; }
.menu [aria-selected="true"] .ic { margin-left: auto; }
.menu-head { padding: 10px 14px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); display: grid; }
.menu-head strong { font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.menu-head small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ── footer ──────────────────────────────────────────────── */
.footer { margin-top: 72px; background: var(--surface); }

.footer-inner {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
  padding: 28px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { border-radius: 999px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: #8c491a; }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  --h: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 400 16px var(--font-display);
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: transform .12s ease, background .2s ease, opacity .2s ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { --h: 38px; padding: 0 18px; font-size: 14px; gap: 8px; }
.btn-block { width: 100%; }

.btn-primary { color: #fff2eb; background: var(--rune); }
.btn-primary:hover:not(:disabled) { background: #8c491a; }
.btn-primary:active:not(:disabled) { background: #643312; }

.btn-google { width: 100%; color: var(--text); background: var(--surface-solid); border-color: var(--line-strong); }
.btn-google:hover:not(:disabled) { background: #d8c8a9; }

.btn-ghost { color: var(--text); background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: rgba(32, 30, 29, .07); }
.btn-ghost:active:not(:disabled) { background: rgba(32, 30, 29, .14); }

.btn-danger { color: #fff2eb; background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #643312; }

.btn[aria-busy="true"] > * { visibility: hidden; }

.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}

.link { background: none; border: 0; padding: 4px 0; margin-top: 14px; color: var(--rune-deep); font: 700 14px var(--font-body); cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── text ────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #c9dcab;
  color: #3d472b;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.eyebrow-danger { background: #e9bd9e; color: #643312; }
.lead { font-size: 18px; color: var(--body); max-width: 58ch; margin: 20px 0 0; }
.muted { color: var(--muted); margin: 6px 0 0; }
.fine { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; color: var(--faint); font-size: 13px; line-height: 1.5; }
.fine .icon { margin-top: 1px; }

/* ── surfaces ────────────────────────────────────────────── */
.card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

form { display: grid; gap: 16px; }
.spaced { margin-top: 20px; }
.field { display: grid; gap: 6px; font-weight: 700; font-size: 13px; color: var(--muted); }

.field input, .field select, .field textarea {
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: 600 15px var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field textarea { height: auto; min-height: 104px; padding: 14px 18px; border-radius: 22px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(32, 30, 29, .45); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--rune); box-shadow: 0 0 0 3px rgba(198, 113, 57, .18); }
.field select option { background: var(--surface-solid); }

.notice { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 13px 18px; border-radius: 22px; font-size: 14px; font-weight: 600; line-height: 1.45; }
.notice .icon { margin-top: 1px; }
.notice-error { background: #e9bd9e; border: 1px solid rgba(140, 73, 26, .3); color: #643312; }
.notice-error .icon { color: #8c491a; }
.notice-success { background: #c9dcab; border: 1px solid rgba(86, 99, 63, .3); color: #3d472b; }
.notice-success .icon { color: #56633f; }
.notice-info { background: var(--surface); border: 1px solid var(--line); color: var(--body); }
.notice-info .icon { color: var(--rune); }

.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgba(198, 113, 57, .25); border-top-color: var(--rune); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { display: grid; place-items: center; min-height: 50vh; }
.loading { display: flex; align-items: center; gap: 12px; padding: 32px 0; color: var(--muted); }

/* ── hero ────────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; min-height: calc(100vh - 72px); display: flex; align-items: center; padding: 64px 0; }

.hero-art {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(60%, 880px);
  background: url("/img/hero.jpg") center 35% / cover no-repeat;
  filter: saturate(.55) contrast(.92) brightness(1.04) sepia(.4);
  mix-blend-mode: multiply;
  opacity: .72;
  -webkit-mask-image: radial-gradient(ellipse 115% 95% at 82% 42%, #000 18%, transparent 74%);
  mask-image: radial-gradient(ellipse 115% 95% at 82% 42%, #000 18%, transparent 74%);
}

.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(211, 191, 156, .45) 30%, transparent 70%),
    linear-gradient(0deg, var(--bg) 0%, transparent 28%);
}

.hero-inner { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: center; }

.hero h1 { font-size: clamp(36px, 5.2vw, 62px); color: var(--text); }

.features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.features li { display: flex; align-items: center; gap: 14px; font-weight: 700; color: var(--body); }
.features .icon { width: 42px; height: 42px; border-radius: 999px; background: #e9bd9e; color: #8c491a; }

.login-card { position: relative; padding: 34px; }
.login-card h2 { font-size: 27px; }
.login-card .btn-google { margin-top: 22px; }
.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--faint); font-size: 13px; font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── saves ───────────────────────────────────────────────── */
.saves { padding-top: 48px; }
.saves-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.saves-head h1, .page-head h1 { font-size: clamp(30px, 4vw, 46px); }
.saves-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.block + .block { margin-top: 44px; }
.block-head { display: flex; align-items: center; gap: 12px; }
.block-head h2 { font-size: 24px; }
.block > .muted { margin: 4px 0 18px; font-size: 15px; }
.pill { padding: 4px 12px; border-radius: 999px; background: #c9dcab; color: #3d472b; font-weight: 800; font-size: 12px; white-space: nowrap; }
.save-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }

.save-card {
  --accent: var(--rune);
  position: relative;
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}

.save-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent); }
.save-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.kind-main { --accent: var(--gold); }
.kind-recent { --accent: var(--rune); }
.kind-daily { --accent: var(--moss); }
.kind-weekly { --accent: var(--violet); }
.kind-restore { --accent: var(--ember); }

.save-card.is-main { padding: 30px; background: var(--surface); border-color: rgba(198, 113, 57, .32); }
.save-card.is-invalid { opacity: .65; }
.save-top { display: flex; align-items: center; gap: 16px; }

.emblem {
  flex: none;
  width: 60px;
  height: 60px;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 3px var(--accent);
  color: var(--text);
}

.emblem strong { font: 400 20px/1 var(--font-display); }
.emblem small { font-weight: 900; font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.is-main .emblem { width: 72px; height: 72px; }
.is-main .emblem strong { font-size: 25px; }
.save-id { min-width: 0; flex: 1; }
.save-id h3 { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-main .save-id h3 { font-size: 23px; }
.when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.when .sep { opacity: .5; }

.tag {
  flex: none;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
  color: color-mix(in srgb, var(--accent) 65%, #201e1d);
  background: color-mix(in srgb, var(--accent) 18%, #e6d8bf);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.xp { display: grid; gap: 6px; }
.xp-bar { height: 10px; border-radius: 999px; background: rgba(32, 30, 29, .1); overflow: hidden; }
.xp-bar span { display: block; height: 100%; border-radius: inherit; background: var(--rune); }
.xp small { color: var(--muted); font-size: 12px; }
.xp small b { color: var(--text); margin-right: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.is-main .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats div { min-width: 0; padding: 12px 14px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); }
.stats dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.stats dt span { overflow: hidden; text-overflow: ellipsis; }
.stats dd { margin: 3px 0 0; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.stats div:nth-child(1) .ic, .stats div:nth-child(4) .ic { color: var(--gold); }
.stats div:nth-child(2) .ic { color: var(--violet); }
.stats div:nth-child(3) .ic, .stats div:nth-child(5) .ic { color: var(--rune); }
.stats div:nth-child(6) .ic { color: var(--moss); }

.save-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.attrs { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.attrs b { color: var(--text); font-weight: 800; }
.device { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.save-foot .btn { margin-left: auto; }

.empty { padding: 56px 32px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.empty h2 { font-size: 23px; max-width: 30ch; }
.empty-icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 999px; background: #e9bd9e; color: #8c491a; }
.empty-icon .ic { width: 32px; height: 32px; }
.empty-mini { padding: 24px; border-radius: var(--radius); border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; }

.how { position: sticky; top: 96px; padding: 26px; background: var(--surface); }
.how h2 { font-size: 19px; margin-bottom: 18px; }
.how ol { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 16px; }
.how li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; color: var(--body); font-size: 14px; }

.how li::before {
  content: counter(step);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rune);
  color: #fff2eb;
  font: 400 15px var(--font-display);
}

.how .fine { margin-top: 20px; }

/* ── dialog ──────────────────────────────────────────────── */
.dialog {
  width: min(580px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(46, 43, 37, .32);
}

.dialog::backdrop { background: rgba(46, 43, 37, .5); backdrop-filter: blur(4px); }
.dialog-body { display: grid; gap: 18px; padding: 30px; }
.dialog-body h2 { font-size: 24px; }
.dialog-body > .muted { margin: -10px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 22px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td { padding: 10px 16px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.compare-table th[scope="row"] { text-align: left; color: var(--muted); font-weight: 700; }
.compare-table thead th { background: var(--surface); color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; vertical-align: bottom; }
.compare-table thead th small { display: block; max-width: 180px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 13px; font-weight: 800; letter-spacing: 0; text-transform: none; }
.compare-table tbody tr:last-child > * { border-bottom: 0; }
.delta { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.delta.up { color: #333c23; background: #c9dcab; }
.delta.down { color: #643312; background: #e9bd9e; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--rune); }

/* ── toasts ──────────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); display: grid; gap: 8px; width: min(480px, calc(100% - 32px)); }

.toast {
  padding: 15px 22px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: toast-in .25s ease;
  transition: opacity .4s ease, transform .4s ease;
}

.toast-success { border-color: rgba(86, 99, 63, .45); background: #d5e8b8; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── legal ───────────────────────────────────────────────── */
.legal { padding-top: 48px; }
.legal-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: 96px; max-height: calc(100vh - 128px); overflow: auto; padding: 22px; background: var(--surface); }
.toc-title { margin: 0 0 12px; color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc li { counter-increment: toc; }
.toc a { display: grid; grid-template-columns: 26px 1fr; padding: 7px 12px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.4; text-decoration: none; }
.toc a::before { content: counter(toc) "."; color: var(--faint); }
.toc a:hover { background: #e9bd9e; color: #8c491a; }
.legal-doc { padding: clamp(26px, 4vw, 52px); counter-reset: sec; }
.legal-doc .lead { margin: 22px 0 6px; color: var(--body); }
.legal-doc section { counter-increment: sec; margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); scroll-margin-top: 96px; }
.legal-doc h2 { display: flex; gap: 14px; align-items: center; font-size: 22px; }

.legal-doc h2::before {
  content: counter(sec);
  flex: none;
  min-width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e9bd9e;
  color: #8c491a;
  font: 400 16px var(--font-display);
}

.legal-doc p { margin: 14px 0 0; color: var(--body); }
.legal-doc ul { display: grid; gap: 8px; margin: 14px 0 0; padding-left: 22px; color: var(--body); }
.legal-doc li::marker { color: var(--rune); }
.legal-doc strong { color: var(--text); }
.legal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ── delete account ──────────────────────────────────────── */
.delete { padding-top: 48px; }
.page-head { margin-bottom: 32px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.info-card { padding: 26px; }
.info-card h2, .panel h2 { font-size: 20px; margin-bottom: 14px; }
.bullets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--body); font-size: 15px; }
.bullets li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; }
.bullets li::before { content: ""; width: 9px; height: 9px; margin: 9px 0 0 4px; border-radius: 50%; background: var(--accent, var(--rune)); }
.bullets-danger { --accent: var(--danger); }
.bullets-gold { --accent: var(--gold); }
.panel { margin-top: 18px; padding: 30px; }
.panel h2 + .muted { margin-top: -6px; }
.danger-card { border-color: rgba(140, 73, 26, .35); background: #e9bd9e; }
.danger-card .btn-danger { justify-self: start; }
#form-request .btn { justify-self: start; }
.done-card { display: grid; justify-items: center; gap: 14px; padding: 48px 26px; text-align: center; }
.done-icon { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 50%; background: #c9dcab; color: #56633f; }
.done-icon .ic { width: 30px; height: 30px; }

/* ── 404 ─────────────────────────────────────────────────── */
.notfound { display: grid; justify-items: center; gap: 16px; padding: 96px 0 40px; text-align: center; }
.notfound .code { margin: 0; font: 400 clamp(80px, 14vw, 132px)/1 var(--font-display); color: var(--rune); }

.chip-cta { color: #fff2eb; background: var(--rune); border-color: transparent; }
.chip-cta:hover { background: #8c491a; }
.hero-cta { margin: 30px 0 0; }

/* ── ranking ─────────────────────────────────────────────── */
.ranking { padding-top: 48px; }
.ranking-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.season-clock { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 14px 20px; border-radius: 999px; background: var(--surface); color: var(--body); font-size: 14px; font-weight: 700; }
.season-clock .icon { color: var(--rune); }
.ranking-controls { display: grid; gap: 10px; margin: 26px 0; }
.segmented { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }

.segmented button {
  flex: none;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font: 700 14px var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}

.segmented button:hover { color: var(--text); background: rgba(32, 30, 29, .07); }
.segmented button[aria-selected="true"] { color: #fff2eb; border-color: transparent; background: var(--rune); }
.segmented-gold button[aria-selected="true"] { background: var(--violet); }
.season-label { margin: 0 0 20px; color: var(--muted); font-weight: 700; }
.ranking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: end; margin: 16px 0 20px; }
.podium .empty { grid-column: 1 / -1; }

.podium-card {
  --medal: #c0b6a5;
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 30px 16px 22px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--medal) 45%, transparent);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.podium-card.place-1 { --medal: #c67139; order: 2; padding-top: 44px; background: var(--surface); box-shadow: var(--shadow); }
.podium-card.place-2 { --medal: #c0b6a5; order: 1; }
.podium-card.place-3 { --medal: #8fa073; order: 3; }
.podium-card.is-me { box-shadow: 0 0 0 2px var(--rune), var(--shadow-sm); }

.medal {
  position: absolute;
  top: -15px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--medal);
  color: var(--text);
  font: 400 15px var(--font-display);
}

.podium-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--medal);
  color: var(--text);
  font: 400 25px var(--font-display);
}

.place-1 .podium-avatar { width: 80px; height: 80px; font-size: 31px; }
.podium-card h3 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.podium-waves { margin: 2px 0 0; color: color-mix(in srgb, var(--medal) 70%, #201e1d); font: 400 30px/1 var(--font-display); }
.podium-waves small { display: block; margin-top: 5px; color: var(--muted); font: 800 11px var(--font-body); letter-spacing: .1em; text-transform: uppercase; }
.podium-meta, .my-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 4px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.podium-meta span, .my-stats span { display: inline-flex; align-items: center; gap: 4px; }
.table-card { overflow: hidden; }
.table-card .table-wrap { border: 0; border-radius: 0; }
.rank-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank-table th, .rank-table td { padding: 13px 18px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rank-table th { background: var(--surface); color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.rank-table th:nth-child(-n+2), .rank-table td:nth-child(-n+2) { text-align: left; }
.rank-table td.rank { width: 60px; color: var(--muted); font-weight: 800; }
.rank-table tbody tr:hover { background: rgba(32, 30, 29, .04); }
.rank-table tbody tr:last-child td { border-bottom: 0; }
.rank-table tr.is-me { background: #e9bd9e; }
.who { display: flex; align-items: center; gap: 10px; }
.row-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #e9bd9e; color: #8c491a; font-size: 13px; font-weight: 900; }
.row-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.tag-you { --accent: var(--rune); }
.ranking-side { position: sticky; top: 96px; display: grid; gap: 18px; }
.side-card { padding: 26px; }
.side-card h2 { margin-bottom: 8px; font-size: 19px; }
.side-card .btn { margin-top: 16px; }
.my-rank { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin: 12px 0 8px; font-weight: 700; }
.my-rank strong { color: var(--rune); font: 400 44px/1 var(--font-display); }
.my-stats { justify-content: flex-start; font-size: 13px; }
.my-prize { display: grid; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.prizes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.prize { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); }
.prize-rank { color: var(--muted); font-weight: 900; font-variant-numeric: tabular-nums; }
.prize-1 .prize-rank { color: #b2622d; }
.prize-2 .prize-rank { color: #82796a; }
.prize-3 .prize-rank { color: #728157; }
.prize-items { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--body); font-size: 13px; font-weight: 700; }
.prize-items span { display: inline-flex; align-items: center; gap: 5px; }
.prize-items .ic { color: var(--gold); }

/* ── download ────────────────────────────────────────────── */
.store-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  height: 70px;
  padding: 0 30px 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--text);
  color: #f9f4ed;
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: transform .12s ease, background .2s ease;
}

.store-btn:hover { background: #2e2b25; transform: translateY(-1px); }
.store-logo svg { display: block; width: 30px; height: 30px; }
.store-text { display: grid; line-height: 1.15; }
.store-text small { color: #dcd3c4; font-size: 12px; font-weight: 600; }
.store-text strong { font: 400 22px var(--font-display); }
.meta-pills { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; padding: 0; }
.meta-pills li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--body); font-size: 13px; font-weight: 700; }
.meta-pills .icon { color: var(--rune); }
.app-card { display: grid; justify-items: center; gap: 8px; padding: 36px 30px; text-align: center; }
.app-card img { width: 120px; height: 120px; border-radius: 34px; box-shadow: var(--shadow); }
.app-card h2 { margin-top: 10px; font-size: 30px; }
.app-card .muted { margin: 0; }
.app-card .features { justify-self: stretch; margin-top: 20px; text-align: left; }

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 1040px) {
  .saves-layout, .legal-layout, .ranking-layout { grid-template-columns: 1fr; }
  .how, .ranking-side { position: static; }
  .toc { display: none; }
  .is-main .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1380px) {
  .menu-toggle { display: inline-flex; }
  .tools { margin-left: auto; }
  .topbar-inner { gap: 12px; }

  .nav {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 14px 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }

  body.nav-open .nav { opacity: 1; transform: none; pointer-events: auto; }
  .nav-link { padding: 13px 18px; font-size: 16px; }
  .lang-picker .chip-text, .account-name { display: none; }
  .lang-picker .chip { padding: 0 12px; }
}

@media (max-width: 900px) {
  .hero { min-height: auto; padding: 44px 0 28px; }
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-art { width: 100%; opacity: .45; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container, .narrow { width: calc(100% - 28px); }
  .stats, .is-main .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-card, .save-card.is-main { padding: 24px; }
  .dialog-body { padding: 24px; }
  .dialog-actions .btn { flex: 1; }
  .save-foot .btn { width: 100%; margin-left: 0; }
  .tools .chip-text { display: none; }
  .tools .chip { padding: 0 12px; }
  .podium { grid-template-columns: 1fr; }
  .podium .podium-card { order: 0; }
  .store-btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
