:root {
  /* Logo palette: cream stone, blackstone plates, gold trim. */
  --bg: #efe9de;
  --bg-raised: #f8f5ee;
  --bg-sunken: #e5ddcf;
  --line: #d5cab6;
  --text: #1b1916;
  --text-muted: #675e51;
  --ink: #151311;
  --ink-raised: #221f1b;
  --ink-line: #3a342c;
  --ink-text: #efe9de;
  --gold: #e8b72e;
  --gold-strong: #f5c845;
  --gold-text: #82600f;
  --good: #2f7d3b;
  --bad: #b23a2a;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

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

a { color: var(--gold-text); text-underline-offset: 3px; }
a:hover { color: var(--text); }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header and footer: blackstone with a gold trim line. */
.site-header { background: var(--ink); border-bottom: 2px solid var(--gold); color: var(--ink-text); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink-text); text-decoration: none; }
.brand:hover { color: var(--ink-text); }
.brand img { width: 32px; height: 32px; }
.brand-name { font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; font-size: 1.05rem; }
.brand-name b { color: var(--gold); font-weight: 800; }
.nav-account { display: flex; align-items: center; gap: 10px; }
.nav-account img { width: 24px; height: 24px; border-radius: 3px; image-rendering: pixelated; }
.site-header .button { background: var(--ink-raised); border-color: var(--ink-line); color: var(--ink-text); }
.site-header .button:hover { border-color: var(--gold); color: var(--gold-strong); }

.site-footer { background: var(--ink); border-top: 2px solid var(--gold); color: #b9ae9c; font-size: 0.9rem; padding: 20px 0; }

/* Buttons: primary is a blackstone plate with gold trim, like the logo. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-raised); color: var(--text);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--text-muted); color: var(--text); }
.button.primary { background: var(--ink); border: 1px solid var(--gold); color: var(--gold-strong); box-shadow: inset 0 0 0 1px #000; }
.button.primary:hover { background: var(--ink-raised); color: var(--gold-strong); }
.button.danger { color: var(--bad); }
.button:disabled { opacity: 0.5; cursor: default; }
.button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

main { flex: 1; padding: 40px 0 64px; }

/* Home */
.hero { text-align: center; padding: 24px 0 40px; }
.hero img { width: 112px; height: 112px; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 3.8rem); line-height: 1; margin: 12px 0 0; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 900; }
.hero h1 b { color: var(--gold-text); font-weight: 900; }
.plate {
  display: inline-block; margin: 14px 0 0; padding: 4px 18px; background: var(--ink); color: var(--gold);
  border: 1px solid var(--gold); border-radius: 3px; letter-spacing: 0.4em; text-transform: uppercase; font-weight: 700; font-size: 0.95rem;
}
.tagline { margin: 20px 0 0; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.95rem; }
.tagline span + span::before { content: "◆"; color: var(--gold); margin: 0 14px; font-size: 0.7em; vertical-align: 2px; }
.hero p.lede { color: var(--text-muted); font-size: 1.1rem; max-width: 34em; margin: 18px auto 24px; }
.address {
  display: inline-flex; align-items: center; gap: 16px; text-align: left;
  padding: 10px 10px 10px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised);
}
.address .label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.address code { font-family: var(--mono); font-size: 1.05rem; color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--bg-raised); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: 18px 20px; }
.card h2, .card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-muted); }

section + section { margin-top: 48px; }
.section-title { font-size: 1.35rem; margin: 0 0 14px; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: baseline; }
.steps li::before {
  content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--gold); font-weight: 800; font-size: 0.9rem;
}

kbd, .mono { font-family: var(--mono); font-size: 0.92em; background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }

/* Panels (login, account) */
.panel { max-width: 520px; margin: 0 auto; }
.panel h1 { font-size: 1.9rem; margin: 0 0 6px; }
.panel .lede { color: var(--text-muted); margin: 0 0 24px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 650; }
.field .hint { color: var(--text-muted); font-size: 0.9rem; }
input[type="text"], select {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit;
}
input.code { font-family: var(--mono); font-size: 1.3rem; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; }

.notice { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-raised); margin-bottom: 16px; }
.notice.error { border-color: var(--bad); color: var(--bad); }
.notice.ok { border-color: var(--good); color: var(--good); }

.option { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); }
.option + .option { margin-top: 12px; }
.option .tag { flex: none; align-self: flex-start; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; background: var(--ink); color: var(--gold); padding: 2px 8px; border-radius: 3px; }
.option p { margin: 4px 0 0; color: var(--text-muted); }
.option.soon { opacity: 0.65; }

.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.profile-head img { width: 64px; height: 64px; border-radius: 4px; image-rendering: pixelated; background: var(--bg-sunken); border: 2px solid var(--ink); }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 0; color: var(--text-muted); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--text-muted); }
.small { font-size: 0.9rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
[hidden] { display: none !important; }

@media (max-width: 520px) {
  main { padding-top: 24px; }
  .brand-name { letter-spacing: 0.1em; }
  .tagline span + span::before { margin: 0 8px; }
  .address { width: 100%; justify-content: space-between; }
  .row .button { flex: 1; }
}

/* Navigation */
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link { color: var(--ink-text); text-decoration: none; font-weight: 650; padding: 8px 10px; border-radius: var(--radius); }
.nav-link:hover { color: var(--gold-strong); }

/* Players list and search */
.search { display: flex; gap: 8px; margin: 0 0 20px; }
.search input { flex: 1; }
.player-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.player-list a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-decoration: none; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.player-list a:hover { border-color: var(--ink); color: var(--text); }
.player-list img { width: 32px; height: 32px; border-radius: 3px; image-rendering: pixelated; }
.player-list .number { margin-left: auto; color: var(--text-muted); font-family: var(--mono); font-size: 0.9rem; }

/* Profile */
.profile-banner { display: flex; gap: 20px; align-items: center; padding: 24px; margin-bottom: 20px;
  background: var(--ink); color: var(--ink-text); border: 1px solid var(--gold); border-radius: var(--radius); }
.profile-banner img { width: 96px; height: 96px; border-radius: 6px; image-rendering: pixelated; background: var(--ink-raised); flex: none; }
.profile-banner h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); line-height: 1.1; overflow-wrap: anywhere; }
.profile-number { display: inline-block; margin-bottom: 6px; padding: 1px 8px; border: 1px solid var(--gold); border-radius: 3px;
  color: var(--gold); font-family: var(--mono); font-size: 0.85rem; }
.profile-meta { color: #b9ae9c; margin: 6px 0 0; font-size: 0.95rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #7a7064; margin-right: 6px; vertical-align: 1px; }
.status-dot.online { background: #5fd36e; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--ink-line); background: var(--ink-raised); font-size: 0.85rem; }
.chip b { color: var(--gold); font-weight: 650; margin-right: 4px; }

.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.section-card { background: var(--bg-raised); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.section-card > h2 { margin: 0 0 12px; font-size: 1.1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-card.is-hidden { opacity: 0.6; border-style: dashed; }
.badge { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 3px; background: var(--bg-sunken); color: var(--text-muted); }
.block + .block { margin-top: 16px; }
.block > h3 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; min-width: 0; }
.stat .label { display: block; font-size: 0.78rem; color: var(--text-muted); }
.stat .value { display: block; font-weight: 750; font-size: 1.05rem; overflow-wrap: anywhere; }

.bars { display: grid; gap: 10px; }
.bar-row .bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.95rem; }
.bar-row .bar-head span:last-child { font-weight: 700; white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--bg-sunken); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--gold); border-right: 2px solid var(--ink); }
.bar-row .detail { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.rows li:last-child { border-bottom: 0; }
.rows .right { color: var(--text-muted); text-align: right; white-space: nowrap; }
.rows .tag { margin-left: 6px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; background: var(--bg-sunken); border: 1px solid var(--line); }
.pill.gold { background: var(--ink); color: var(--gold); border-color: var(--gold); }
.pill.easy { background: #e3f1e1; border-color: #a9cfa3; }
.pill.medium { background: #f6efcf; border-color: #dcc977; }
.pill.hard { background: #f6dcd6; border-color: #d99a8c; }
.pill.very-hard { background: #eadff3; border-color: #b99ad0; }
.pill.muted { color: var(--text-muted); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.mini-table th, .mini-table td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); }
.mini-table th { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.table-wrap { overflow-x: auto; }

.checks { display: grid; gap: 6px; margin: 8px 0 16px; }
.checks label { display: flex; gap: 10px; align-items: center; }
.checks input { width: 18px; height: 18px; accent-color: var(--ink); }

@media (max-width: 520px) {
  .profile-banner { flex-direction: column; align-items: flex-start; padding: 18px; }
  .profile-banner img { width: 72px; height: 72px; }
  .nav-link { padding: 8px 6px; }
}
