@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&family=DM+Sans:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  --bg:          #faf6ef;
  --surface:     #ffffff;
  --surface2:    #f3ede4;
  --map-fill:    #c8d4e0;
  --found:       #d4614a;
  --accent:      #d4614a;
  --accent-dim:  #a84b38;
  --accent-light:#fae8e5;
  --border:      #e0d8cc;
  --text:        #2a2016;
  --text-muted:  #9e9080;
  --red:         #c0392b;
  --green:       #2e7d52;
  --radius:      8px;
  --shadow:      0 2px 12px rgba(42,32,22,0.08);
  --font-head:   'Nunito', system-ui, sans-serif;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Grain overlay (very subtle on light bg) ───────────────────── */
#grain-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.025;
  z-index: 9999;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 800;
  color: var(--text);
}

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

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.btn:active { transform: translateY(1px); }

.btn-muted {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-muted:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── Home Screen ───────────────────────────────────────────────── */
.home-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px 40px;
}

.home-header {
  text-align: center;
  margin-bottom: 52px;
}

.home-title {
  font-size: clamp(3.5rem, 9vw, 7rem);
  font-family: var(--font-head);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 14px;
}

.home-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── Map Cards ─────────────────────────────────────────────────── */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
  gap: 24px;
  width: 100%;
  max-width: 820px;
  justify-content: center;
}

.map-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
}

.map-card-preview {
  width: 100%;
  height: 130px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-card-preview svg {
  width: 100%;
  height: 100%;
}

.map-card-info h2 {
  font-size: 22px;
  margin-bottom: 4px;
  font-family: var(--font-head);
}

.map-card-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.map-card-modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.mode-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
  color: var(--text);
}

.mode-btn-name {
  font-weight: 600;
}

.mode-btn-desc {
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Leaderboard (home) ────────────────────────────────────────── */
.leaderboard-section {
  width: 100%;
  max-width: 820px;
  margin-top: 48px;
}

.leaderboard-section h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
  font-family: var(--font-body);
  font-weight: 500;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lb-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 1.5px solid var(--border);
  font-family: var(--font-body);
  font-weight: 500;
}

.lb-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.lb-table tr:last-child td { border-bottom: none; }

.lb-rank { color: var(--accent); font-weight: 700; width: 36px; }
.lb-time { font-family: var(--font-mono); font-size: 13px; }
.lb-date { color: var(--text-muted); font-size: 12px; }
.lb-gaveup { color: var(--red); font-size: 10px; margin-left: 4px; opacity: 0.7; }

.lb-unavailable {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 4px;
  font-style: italic;
}

/* ── Footer ────────────────────────────────────────────────────── */
.home-footer {
  margin-top: auto;
  padding-top: 48px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Utility ───────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
