* { box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --danger: #dc2626;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 72px;
}

.app-header {
  padding: 16px;
  text-align: center;
}
.app-header h1 { margin: 0; font-size: 1.25rem; }

main { padding: 0 12px; flex: 1; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.card h2 { margin-top: 0; font-size: 1rem; color: var(--text-muted); }

.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.inline-form input { flex: 1; }

input[type="text"], select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}

.topic-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.topic-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.topic-list li.is-selected {
  border-color: var(--primary);
  background: #eff6ff;
}
.topic-list li .topic-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 4px 8px;
}

.timer-card { text-align: center; }
.selected-topic-label { color: var(--text-muted); }
.elapsed-display {
  font-size: 2.75rem;
  font-variant-numeric: tabular-nums;
  margin: 12px 0 20px;
  font-weight: 600;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  background: #e5e7eb;
  color: var(--text);
  cursor: pointer;
}
.btn-large { width: 100%; padding: 16px; font-size: 1.15rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }

.message { min-height: 1.2em; color: var(--text-muted); font-size: 0.9rem; }
.message.is-error { color: var(--danger); }
.message.is-success { color: #059669; }

.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-between select { width: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; }

#settings-form label { display: block; margin: 10px 0 4px; font-size: 0.9rem; color: var(--text-muted); }
.settings-actions { display: flex; gap: 8px; margin-top: 12px; }
.settings-actions .btn { flex: 1; }
.hint { font-size: 0.8rem; color: var(--text-muted); }

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 14px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.tab-btn.is-active { color: var(--primary); font-weight: 600; }
