:root {
  --ink: #1c2430;
  --muted: #4a5568;
  --accent: #14532d;
  --accent-ink: #ffffff;
  --card-bg: #ffffff;
  --page-bg: #f4f6f3;
  --line: #c9d2c7;
  --warn-bg: #fdf3e0;
  --warn-ink: #6b4e00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  line-height: 1.55;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--card-bg);
}

.site-nav {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  gap: 1.25rem;
}

.site-nav a { color: var(--accent); }

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

h1 { font-size: 1.7rem; margin: 0.6rem 0 0.4rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }

.intro { margin: 0.2rem 0 0.6rem; }
.note { color: var(--muted); font-size: 0.92rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}

.display {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0.4rem 0 0.2rem;
}

.current-lap {
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0 0.8rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

button {
  font: inherit;
  padding: 0.55rem 1.2rem;
  border-radius: 0.45rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  min-height: 2.75rem;
}

button#btn-lap, button#btn-reset, button#btn-export {
  background: var(--card-bg);
  color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus-visible, a:focus-visible {
  outline: 3px solid #b45309;
  outline-offset: 2px;
}

.warning {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 0.4rem;
  padding: 0.55rem 0.8rem;
  margin: 0.8rem 0 0;
}

.stats-list, .shortcuts { margin: 0; padding-left: 1.3rem; }
.stats-list span { font-variant-numeric: tabular-nums; }

table.laps {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.laps th, table.laps td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.5rem;
  text-align: right;
}

table.laps th:first-child, table.laps td:first-child { text-align: left; }
table.laps th:last-child, table.laps td:last-child { text-align: left; }

kbd {
  background: #eceff1;
  border: 1px solid #b0bec5;
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  padding: 0 0.35rem;
  font-family: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .display { font-size: 2.3rem; }
  button { flex: 1 1 40%; }
}
