:root {
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #1b1d2a;
  --muted: #6b6e7f;
  --line: #e3e1da;
  --accent: #4b5bd6;
  --accent-text: #ffffff;
  --accent-soft: #e6e8fb;
  --good: #2f8f5b;
  --bad: #c2453b;
  --moon: #f2d98a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14172b;
    --card: #1e2238;
    --text: #eceaf4;
    --muted: #9a9cb3;
    --line: #2d3250;
    --accent: #8b97ff;
    --accent-text: #11142a;
    --accent-soft: #2a3060;
    --good: #6fd19a;
    --bad: #ff8a7e;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }

.view {
  min-height: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 24px);
}
.view[hidden] { display: none; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

h1 { font-size: 28px; line-height: 1.2; margin: 8px 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 28px 0 2px; }
p { margin: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; }
.error { color: var(--bad); min-height: 1.4em; font-size: 15px; }
code { font-size: 15px; background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }

button {
  font: inherit; border: 0; border-radius: 14px; cursor: pointer; color: inherit; background: none;
  touch-action: manipulation;
}
button:active { transform: scale(0.97); }
.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; padding: 13px 20px; }
.ghost { background: var(--accent-soft); color: var(--text); font-weight: 600; padding: 13px 18px; }
.link { color: var(--accent); padding: 12px; margin-top: 16px; font-size: 15px; }
.wide { width: 100%; margin-top: 24px; }
.icon { width: 44px; height: 44px; font-size: 30px; line-height: 1; color: var(--muted); }

.moon {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 12px;
  box-shadow: inset -16px -6px 0 0 var(--moon); transform: rotate(-20deg);
}
.steps { text-align: left; padding-left: 22px; margin: 20px 0 0; }
.steps li { margin: 10px 0; }
.share {
  display: inline-block; width: 14px; height: 16px; vertical-align: -2px;
  border: 2px solid var(--accent); border-top: 0; border-radius: 0 0 3px 3px; position: relative;
}

#pair-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; margin-top: 24px; }
.code {
  font: 600 32px/1 ui-monospace, "SF Mono", monospace; letter-spacing: 0.3em; text-align: center;
  padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text);
}

.home-head { margin-bottom: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-top: 14px;
}
.card-title { font-weight: 600; margin: 0; }
.tonight { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 14px 14px; align-items: center; }
.tonight > button { grid-column: 1 / -1; width: 100%; }
.ring {
  --p: 0; width: 56px; height: 56px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center;
}
.ring span {
  width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
}
.ring.done { background: var(--good); }
.ring.done span { color: var(--good); font-size: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips button { background: var(--card); border: 1px solid var(--line); padding: 10px 14px; font-size: 15px; }

.notif .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.notif .row:empty, .notif .row:not(:has(button:not([hidden]))) { display: none; }
#notif-msg:empty { display: none; }

.flow { display: flex; flex-direction: column; }
.flow-top { display: flex; align-items: center; gap: 8px; margin: -8px -8px 28px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }
.step { color: var(--muted); font-size: 14px; margin-top: 8px; }
.q { font-size: 30px; margin: 6px 0 4px; }
#flow-input { margin-top: 28px; }

.opts { display: grid; gap: 10px; }
.opts.scale { grid-template-columns: repeat(5, 1fr); }
.opts.two { grid-template-columns: repeat(2, 1fr); }
.opt {
  background: var(--card); border: 1px solid var(--line); padding: 18px 8px; font-size: 20px; font-weight: 600;
  min-height: 64px;
}
.opts.two .opt { font-size: 17px; }
.opt.sel { background: var(--accent-soft); border-color: var(--accent); }
.scale-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }

.field {
  width: 100%; font: inherit; font-size: 22px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
textarea.field { font-size: 17px; min-height: 140px; resize: vertical; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions .primary { flex: 1; }

.check {
  width: 72px; height: 72px; border-radius: 50%; background: var(--good); color: var(--bg);
  display: grid; place-items: center; font-size: 38px; font-weight: 700; margin-bottom: 8px;
}
.summary { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; width: 100%; max-width: 320px; margin: 20px 0 0; text-align: left; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; text-align: right; }
.summary .note { grid-column: 1 / -1; font-weight: 400; text-align: left; color: var(--text); }
