:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --surface: #f5f5f5;
  --border: #e0e0e0;
  --primary: #0066cc;
  --danger: #cc0000;
  --tab-bg: #ffffff;
  --chip-bg: #e8e8e8;
  --chip-active-bg: #0066cc;
  --chip-active-fg: #ffffff;
  --owner-hl: #e6f0ff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #e0e0e0;
    --surface: #1e1e1e;
    --border: #333333;
    --primary: #4da6ff;
    --danger: #ff4d4d;
    --tab-bg: #1e1e1e;
    --chip-bg: #2a2a2a;
    --chip-active-bg: #4da6ff;
    --chip-active-fg: #121212;
    --owner-hl: #1a2a3a;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  min-height: 100vh;
  min-width: 360px;
}

#app {
  padding: 16px;
  padding-bottom: 72px;
  max-width: 100%;
  overflow-x: hidden;
}

#tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--tab-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  height: 56px;
}

#tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--fg);
  font-size: 11px;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 2px;
  text-align: center;
}

#tabs a.active { color: var(--primary); font-weight: 600; }

#toast {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

#toast.show { opacity: 1; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--fg);
  width: 100%;
}

button {
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 600;
}

button.secondary { background: var(--chip-bg); color: var(--fg); }
button.danger { background: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--chip-bg);
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: none;
  color: var(--fg);
  font-weight: 400;
}
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-fg); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.overdue { color: var(--danger); font-weight: 700; }
.status-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: var(--chip-bg);
}

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 4px; font-weight: 600; }

.timeline-item {
  border-left: 3px solid var(--border);
  padding: 8px 12px;
  margin-bottom: 8px;
}
.timeline-item.owner-answer { background: var(--owner-hl); border-left-color: var(--primary); }
.timeline-kind { font-size: 12px; font-weight: 600; text-transform: uppercase; }
.timeline-at { font-size: 11px; color: var(--border); margin-left: 8px; }

.locked-banner {
  background: var(--danger);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  text-align: center;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.actions button { flex: 1; min-width: 100px; }
.counters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.counter-card { flex: 1; min-width: 80px; text-align: center; }
.counter-num { font-size: 24px; font-weight: 700; }
.counter-label { font-size: 12px; }
.score-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.score-group label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
