:root {
  --bg: #fbf7f4;
  --card: #ffffff;
  --ink: #2a2326;
  --muted: #7a6d72;
  --accent: #c8587a;
  --accent-ink: #ffffff;
  --line: #eadfe0;
  --tab-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1517;
    --card: #261e21;
    --ink: #f4ecee;
    --muted: #b3a4a9;
    --accent: #e0789a;
    --accent-ink: #1a1517;
    --line: #3a2e32;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 -apple-system, "SF Pro Text", "SF Arabic", system-ui, sans-serif;
  overflow-x: hidden;
}

.page {
  max-width: 560px;
  margin-inline: auto;
  padding: 20px 16px calc(var(--tab-height) + env(safe-area-inset-bottom) + 24px);
}

h1 { font-size: 1.6rem; margin: 0 0 16px; }

a { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-block-end: 12px;
}

button, .button {
  min-height: 44px;
  padding-inline: 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: start;
}

label { display: block; margin-block: 12px 4px; font-weight: 600; }

.error { color: var(--accent); margin: 4px 0 0; }

form button { margin-block-start: 16px; }

.tabs {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  flex: 1;
  min-height: var(--tab-height);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
}

.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.retry-note { color: var(--muted); font-size: 0.9rem; margin-block-start: 8px; }

.center { text-align: center; padding-block-start: 12vh; }

.muted { color: var(--muted); }

.small { font-size: 0.9rem; }

.passkey-button {
  width: 100%;
  min-height: 56px;
  font-size: 1.1rem;
  margin-block: 16px;
}

.passkey-button:disabled { opacity: 0.6; cursor: default; }

.lang-toggle { display: flex; justify-content: center; gap: 24px; margin-block-start: 32px; }

.lang-toggle a { color: var(--muted); text-decoration: none; padding: 10px 4px; }

.lang-toggle a[aria-current] { color: var(--accent); font-weight: 600; }

.steps { padding-inline-start: 36px; }

.steps li { margin-block: 8px; }

.backup-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.25rem; letter-spacing: 0.06em; text-align: center; user-select: all; margin: 8px 0; }

button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

button[hidden] { display: none; }

.push-box h2 { font-size: 1.1rem; margin: 0 0 12px; }

.push-box form button { margin-block-start: 8px; }

.question-text { font-size: 1.2rem; font-weight: 600; margin-block: 4px 12px; }

.who { font-weight: 600; margin-block: 12px 2px; }

.answer-text { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

textarea { resize: vertical; }

.pager { display: flex; justify-content: space-between; gap: 16px; }

.together-count { font-size: 1.2rem; font-weight: 600; margin: 0; text-align: center; }

.count-line { font-weight: 600; margin: 0 0 8px; }

.milestone-card {
  text-align: center;
  padding-block: 32px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.milestone-number { font-size: 3.5rem; font-weight: 700; line-height: 1.1; margin: 0; }

.milestone-text { font-size: 1.3rem; font-weight: 600; margin: 4px 0 12px; }

.milestone-card .muted { color: inherit; opacity: 0.85; }

.soon-row { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; }

.photos-heading { font-size: 1.1rem; margin: 20px 0 4px; }

.photo-list, .photo-grid { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }

.photo-list li { display: flex; flex-direction: column; gap: 4px; }

.photo-list img, .photo-grid img, .otd-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; background: var(--line); }

.photo-list button { min-height: 44px; font-size: 0.9rem; margin-block-start: 0; }

.photo-list li[data-state="rejected"] .photo-status, .photo-list li[data-state="failed"] .photo-status { color: var(--accent); }

.photo-input { margin-block-start: 8px; }

.photo-note { color: var(--accent); margin-block: 8px; }

.otd-row { display: flex; gap: 12px; align-items: flex-start; margin-block: 8px; }

.otd-row img { width: 72px; flex: none; }

.question-set { border: 1px solid var(--line); margin-inline: 0; min-width: 0; }
.question-set legend { padding-inline: 4px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-block: 4px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 400; cursor: pointer; }
.choice input[type="radio"] { width: 22px; min-height: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.cancel-form { margin-block-start: 24px; }
.games-sub { font-size: 1rem; margin: 16px 0 4px; }
.score-row { display: flex; justify-content: space-between; gap: 12px; margin: 4px 0; }
.result-score { font-size: 1.3rem; font-weight: 700; margin: 0; }
.match-mark { font-weight: 600; margin: 4px 0 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.pair legend { padding: 0; margin-block-end: 6px; }
.pair-choice { position: relative; display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 14px; text-align: center; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.pair-choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pair-choice:has(input:checked) { border-color: var(--accent); background: var(--accent); color: #fff; }
.pair-choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
