/* ===== Design tokens ===== */
:root {
  --bg: #0b1220;
  --bg-deep: #070c16;
  --surface: #12213a;
  --surface-2: #182a47;
  --parchment: #f1e6c8;
  --parchment-dim: #d9cca8;
  --gold: #d4af37;
  --crimson: #c1272d;
  --teal: #2fa8b0;
  --ink: #0b1220;

  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "Work Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 10px;
  --wrap: 1120px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #0f1b30 0%, var(--bg) 45%, var(--bg-deep) 100%);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

/* ===== Typography helpers ===== */
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--gold);
  margin: 0 0 10px;
}
.eyebrow--center { text-align: center; }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  margin: 0 0 16px;
  color: var(--parchment);
}
.section-title--center { text-align: center; }

.section-lead {
  max-width: 640px;
  color: var(--parchment-dim);
  font-size: 1.02rem;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 12, 22, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand__seal { width: 24px; height: 24px; display: block; }
.brand--small .brand__seal { width: 20px; height: 20px; }
.brand__text {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--parchment);
  font-size: 1.05rem;
}
.brand__text em { color: var(--gold); font-style: normal; }
.brand--small { font-size: 0.95rem; margin: 0; }

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.92rem;
}
.topnav a {
  text-decoration: none;
  color: var(--parchment-dim);
}
.topnav a:hover { color: var(--gold); }
.topnav__cta {
  border: 1px solid var(--gold);
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--gold) !important;
}
.topnav__cta:hover { background: var(--gold); color: var(--ink) !important; }
.topnav__cta--muted {
  background: none;
  cursor: pointer;
  font: inherit;
}
.logout-form { display: inline; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.96rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--crimson); color: #fff2ee; }
.btn--primary:hover { background: #a91f24; }
.btn--ghost { border-color: rgba(241, 230, 200, 0.35); color: var(--parchment); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn--block { width: 100%; }
.authform__foot {
  font-size: 0.82rem;
  text-align: center;
  margin-top: 10px;
}
.authform__foot a {
  color: rgba(11, 18, 32, 0.6);
  text-decoration: underline;
}
.authform__foot a:hover { color: var(--ink); }
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 84px 0 96px;
  overflow: hidden;
}
.hero__sea {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 480px;
  background: radial-gradient(closest-side, rgba(47, 168, 176, 0.22), transparent 70%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: center;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.12;
  margin: 0 0 20px;
  color: var(--parchment);
}
.hero__title .hl { color: var(--gold); }
.hero__sub {
  color: var(--parchment-dim);
  font-size: 1.08rem;
  max-width: 520px;
  margin: 0 0 32px;
}
.hero__actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* --- Signature: Log Pose countdown --- */
.logpose {
  justify-self: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  padding: 28px 24px 24px;
  width: min(280px, 100%);
}
.logpose__dial { width: 160px; height: 160px; margin: 0 auto 6px; display: block; }
.logpose__ring-outer { fill: none; stroke: rgba(212, 175, 55, 0.35); stroke-width: 2; }
.logpose__ring-inner { fill: rgba(7, 12, 22, 0.5); stroke: rgba(241, 230, 200, 0.18); stroke-width: 1; }
.logpose__ticks line { stroke: rgba(241, 230, 200, 0.4); stroke-width: 2; }
.logpose__needle {
  stroke: var(--crimson);
  stroke-width: 3;
  stroke-linecap: round;
  transform-origin: 110px 110px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.logpose__pin { fill: var(--gold); }
.logpose__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--parchment-dim);
  margin: 4px 0 2px;
}
.logpose__time {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
}
.logpose__hint {
  font-size: 0.78rem;
  color: var(--parchment-dim);
  margin: 0;
}

/* ===== About / cards ===== */
.about { padding: 88px 0; }
.about > .wrap { text-align: center; }
.about .section-lead { margin: 0 auto 48px; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
}
.card {
  background: var(--surface);
  border: 1px solid rgba(241, 230, 200, 0.1);
  border-radius: var(--radius);
  padding: 26px;
}
.card__icon { font-size: 1.6rem; display: block; margin-bottom: 14px; }
.card__icon-img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0 auto;
  border: 1px solid rgba(241, 230, 200, 0.18);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.wanted-poster { display: block; margin: 0 auto; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)); }
.card h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  margin: 0 0 8px;
  color: var(--parchment);
}
.card p { margin: 0; color: var(--parchment-dim); font-size: 0.95rem; }

.tag {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
}
.tag--soon { background: rgba(212, 175, 55, 0.15); color: var(--gold); }
.tag--done { background: rgba(47, 168, 176, 0.18); color: var(--teal); }

/* ===== Auth section ===== */
.auth {
  padding: 88px 0;
  background: linear-gradient(180deg, transparent, rgba(18, 33, 58, 0.5) 15%, rgba(18, 33, 58, 0.5) 85%, transparent);
}
.auth__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}
.alert {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(193, 39, 45, 0.14);
  border: 1px solid rgba(193, 39, 45, 0.4);
  color: #ffd7d7;
  font-size: 0.92rem;
}
.alert--ok {
  background: rgba(47, 168, 176, 0.14);
  border: 1px solid rgba(47, 168, 176, 0.4);
  color: #c9f1f3;
}

/* ===== Settings page ===== */
.settings__card--danger { border: 1px solid rgba(193, 39, 45, 0.55); }
.settings__title { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 6px; }
.settings__hint { font-size: 0.85rem; opacity: 0.75; margin: 0 0 18px; }
.settings__summary { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.settings__meta { margin: 0; flex: 1; display: grid; gap: 6px 28px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.settings__meta div { display: flex; gap: 10px; font-size: 0.88rem; }
.settings__meta dt { margin: 0; opacity: 0.6; font-weight: 600; }
.settings__meta dd { margin: 0; font-weight: 600; }
.settings__form { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }

/* ===== Standalone auth pages (forgot / reset / confirm) ===== */
.reset-page { max-width: 560px; }
.authcard--page { margin-top: 64px; }

.btn--danger { background: var(--crimson); color: #fff; }
.btn--danger:hover { background: #a91f24; }

.authcard {
  background: var(--parchment);
  color: var(--ink);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.authcard__tabs {
  display: flex;
  gap: 4px;
  background: rgba(11, 18, 32, 0.06);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.authcard__tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: rgba(11, 18, 32, 0.55);
}
.authcard__tab.is-active {
  background: var(--ink);
  color: var(--parchment);
}
.authform { display: none; flex-direction: column; gap: 14px; }
.authform.is-active { display: flex; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 600; }
.field input {
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(11, 18, 32, 0.2);
  background: #fff;
  color: var(--ink);
}
.field input:focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; }
.authcard__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: rgba(11, 18, 32, 0.45);
  font-size: 0.82rem;
}
.authcard__divider::before,
.authcard__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(11, 18, 32, 0.15);
}

/* ===== Tournament teaser ===== */
.tournament { padding: 88px 0 110px; }
.tournament__inner { text-align: center; }
.tournament .section-lead { margin: 0 auto 40px; }
.tourn-grid {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tourn-grid li {
  background: var(--surface);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  border-radius: var(--radius);
  padding: 18px 12px;
  font-size: 0.88rem;
  color: var(--parchment-dim);
}
.tourn-grid li span { display: block; font-size: 1.3rem; margin-bottom: 8px; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid rgba(212, 175, 55, 0.15); padding: 36px 0 48px; }
.site-footer__inner { display: flex; flex-direction: column; gap: 14px; }
.disclaimer { color: rgba(241, 230, 200, 0.45); font-size: 0.78rem; max-width: 680px; margin: 0; }

/* ===== Dashboard ===== */
.dash { padding: 56px 24px 80px; }
.dash__hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 48px;
}
.dash__id { display: flex; align-items: center; gap: 16px; }
.dash__avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--gold);
}
.dash__avatar--fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; background: var(--bg-deep);
}
.dash__name { font-family: var(--font-display); font-size: 1.6rem; margin: 2px 0 0; }
.dash__points { text-align: right; }
.dash__points-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.dash__points-label { font-size: 0.78rem; color: var(--parchment-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.cards--games { margin-top: 24px; }
.card--game { text-align: center; }

/* ===== Leaderboard ===== */
.board { padding: 64px 24px 90px; max-width: 760px; }
.board__empty { margin: 0 auto; text-align: center; }
.board__list { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.board__row {
  display: grid;
  grid-template-columns: 48px 40px 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: 10px;
  padding: 12px 18px;
}
.board__row--top { border: 1px solid rgba(212, 175, 55, 0.4); }
.board__rank { font-family: var(--font-mono); color: var(--gold); font-weight: 700; }
.board__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.board__avatar--fallback { display: flex; align-items: center; justify-content: center; background: var(--bg-deep); }
.board__name { font-weight: 600; }
.board__points { font-family: var(--font-mono); color: var(--gold); font-weight: 700; }

/* ===== 404 ===== */
.notfound { padding: 120px 24px; text-align: center; }
.notfound .section-lead { margin: 0 auto 28px; }

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .hero__inner { grid-template-columns: 1fr; }
  .logpose { justify-self: start; }
  .auth__inner { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .tourn-grid { grid-template-columns: repeat(2, 1fr); }
  .topnav { gap: 16px; font-size: 0.85rem; }
}
@media (max-width: 520px) {
  .tourn-grid { grid-template-columns: 1fr; }
  .board__row { grid-template-columns: 32px 32px 1fr auto; padding: 10px 12px; }
}
