:root {
  --bg: #ffffff;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, 0.16);
  --tint: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --fill: #f2f2f7;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.35;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
a { text-decoration: none; color: var(--tint); }
button { background: none; border: 0; padding: 0; cursor: pointer; }

.app { min-height: 100vh; min-height: 100dvh; }
.screen {
  max-width: 480px; margin: 0 auto;
  padding: calc(var(--safe-top) + 28px) 24px calc(var(--safe-bottom) + 40px);
}

.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 36px; }
.wordmark { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
.iconbtn {
  width: 40px; height: 40px; margin: -6px -8px 0 0; border-radius: 20px;
  display: grid; place-items: center; color: var(--muted);
}
.iconbtn:active { background: var(--fill); }
.iconbtn svg { width: 24px; height: 24px; }

.label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 20px; line-height: 1.15; }
.title.free { font-size: 32px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

.days { margin: 0 0 32px; padding: 0; list-style: none; }
.day { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
.day:last-child { border-bottom: 0; }
.day .wd { font-weight: 600; letter-spacing: 0.04em; width: 56px; color: var(--text); }
.day .date { color: var(--muted); font-size: 15px; flex: 1; }
.day .state { font-weight: 500; }
.day.off .wd, .day.off .state { color: var(--muted); }

.section { padding: 24px 0; border-top: 1px solid var(--line); }
.section .label { margin-bottom: 10px; }
.question { font-size: 20px; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.01em; }

.segment { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; }
.segment button {
  flex: 1; padding: 10px 0; border-radius: 9px; font-weight: 600; font-size: 16px; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.segment button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04); }

.status { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 6px; background: var(--green); flex: none; }
.dot.off { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.dot.warn { background: var(--red); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.btn {
  display: block; width: 100%; padding: 15px; border-radius: var(--radius); text-align: center;
  background: var(--tint); color: #fff; font-weight: 600; font-size: 17px; margin-top: 16px;
}
.btn:active { opacity: 0.8; }
.btn.secondary { background: var(--fill); color: var(--tint); }
.btn.danger { background: var(--fill); color: var(--red); }
.btn[disabled] { opacity: 0.5; }
.link { color: var(--tint); font-weight: 500; }

.field {
  width: 100%; padding: 14px 16px; border-radius: var(--radius); border: 0; background: var(--fill);
  font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
}
.field:focus { box-shadow: 0 0 0 2px var(--tint); }
.error { color: var(--red); margin: 12px 0 0; font-size: 15px; }

.login { padding-top: calc(var(--safe-top) + 96px); }
.login .wordmark { margin-bottom: 8px; }
.login .tagline { color: var(--muted); margin: 0 0 40px; }

.rows { margin: 0; padding: 0; list-style: none; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); font-size: 15px; }
.row .v { font-variant-numeric: tabular-nums; text-align: right; font-size: 15px; }
.row .del { color: var(--red); font-weight: 500; font-size: 15px; }
.addrow { display: flex; gap: 10px; margin-top: 14px; }
.addrow .field { flex: 1; min-width: 0; }
.addrow .btn { width: auto; margin: 0; padding: 0 18px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--tint); font-weight: 500; margin-bottom: 24px; }
.back svg { width: 18px; height: 18px; }
.version { margin-top: 40px; text-align: center; color: var(--muted); font-size: 13px; }

.offline {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(var(--safe-bottom) + 10px);
  background: #1c1c1e; color: #fff; font-size: 14px; text-align: center;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 24px);
  background: #1c1c1e; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.code { background: var(--fill); border-radius: 10px; padding: 12px 14px; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; margin: 10px 0 0; }

/* taste test */
.test .testbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; min-height: 28px; }
.test .testbar .back { margin: 0; }
.progress { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.question.big { font-size: 26px; margin: 0 0 22px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--fill); border-radius: 24px; padding: 28px 12px; min-height: 210px;
  transition: transform 0.12s, background 0.12s;
}
.card:active, .card.picked { transform: scale(0.96); background: #e5e5ea; }
.card .emoji { font-size: 76px; line-height: 1; }
.card .name { font-size: 20px; font-weight: 600; text-align: center; }
.both { display: block; margin: 22px auto 0; padding: 12px 26px; border-radius: 24px; background: var(--fill); font-weight: 600; font-size: 17px; color: var(--text); }
.both:active { background: #e5e5ea; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 20px; }
.chip { padding: 12px 16px; border-radius: 22px; background: var(--fill); font-size: 17px; font-weight: 500; color: var(--text); }
.chip.on { background: var(--text); color: #fff; }
.center { text-align: center; padding-top: calc(var(--safe-top) + 90px); }
.bigemoji { font-size: 84px; margin-bottom: 8px; }
.center .question { margin-bottom: 10px; }
.center .muted { margin: 0 0 32px; }
.row.food .bar { width: 96px; height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; flex: none; }
.row.food .bar span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.row.food.off .bar span { background: var(--muted); }
