:root {
  --bg: #fdf6ec;
  --bg-elevated: #ffffff;
  --text: #23201b;
  --text-muted: #6b6156;
  --accent: #ff7a45;
  --accent-2: #1e9e8a;
  --accent-3: #ffc233;
  --danger: #d84343;
  --border: #ece2d2;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191510;
    --bg-elevated: #24201a;
    --text: #f2ece1;
    --text-muted: #a89c8a;
    --accent: #ff8c5a;
    --accent-2: #35c2ab;
    --accent-3: #ffd15c;
    --border: #352f26;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 72px);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.app-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius);
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  margin-bottom: 12px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-emoji { font-size: 1.4rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-2 .btn { margin-bottom: 0; }

.stat-value {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.muted { color: var(--text-muted); font-size: 0.9rem; }

.disclaimer {
  background: rgba(255, 122, 69, 0.12);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--text);
  margin: 10px 0;
}

input, select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 10px 14px;
  font-size: 1rem;
  margin-bottom: 12px;
}

label { font-size: 0.9rem; color: var(--text-muted); display: block; margin-bottom: 4px; }

.flash {
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.92rem;
}
.flash-error { background: rgba(216, 67, 67, 0.15); border: 1px solid var(--danger); }
.flash-success { background: rgba(30, 158, 138, 0.15); border: 1px solid var(--accent-2); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  display: flex;
  z-index: 10;
}

.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.bottom-nav a .nav-emoji { display: block; font-size: 1.3rem; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--accent); }

.version-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 12px;
}

.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rank-list li:last-child { border-bottom: none; }

#splash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.4s ease;
}
#splash img { width: min(95vw, 95vh); height: min(95vw, 95vh); }
#splash.splash-hidden { opacity: 0; pointer-events: none; }
