/* ---------- THEME TOKENS ---------- */
:root,
[data-theme="stone"] {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --border: #E8E4DD;
  --accent: #F43D02;
  --accent-text: #FFFFFF;
  --success: #2E7D5B;
  --danger: #B5394C;
}

[data-theme="dark"] {
  --bg: #111111;
  --surface: #2a2a2a;
  --text: #e8e6e3;
  --text-muted: #b0aeab;
  --border: #3a3a3a;
  --accent: #80f94f;
  --accent-text: #1A1A1A;
  --success: #4FB07F;
  --danger: #E0667A;
}

/* ---------- FONTS ---------- */
@font-face {
  font-family: 'Satoshi';
  src: url('/fonts/Satoshi-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Teko';
  src: url('/fonts/Teko-Variable.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}

.ex-name {
  font-family: 'Teko', sans-serif;
  font-weight: 500;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--accent);
}

/* ---------- RESET + BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
  font-family: 'Teko', sans-serif;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1;
}
h1 { font-size: 40px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }

/* ---------- LAYOUT ---------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 24px;
}
.topbar h1 { font-size: 28px; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 10;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; }

/* ---------- COMPONENTS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 20px;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.12s ease;
}
.btn:active { opacity: 0.7; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  width: 100%;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.numeric {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.text-muted { color: var(--text-muted); font-size: 14px; }

/* number wheel */
.wheel {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wheel-display {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  text-align: center;
}
.wheel-display .value {
  font-size: 36px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: block;
}
.wheel-display .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.wheel-btn {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 24px;
  font-weight: 500;
}
.wheel-btn:active { background: var(--accent); color: var(--accent-text); }

/* timer */
.timer {
  position: sticky;
  bottom: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}
.timer .time {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.timer.active .time { color: var(--accent); }
