/* =========================================================================
   Luna — design system
   Built for iPhone first: safe-area aware, 44pt touch targets, iOS sheets.
   ========================================================================= */

:root {
  --bg: #fdfbfc;
  --surface: #ffffff;
  --surface-2: #f5f1f4;
  --surface-3: #ece6ea;
  --text: #1b1420;
  --text-2: #574d5e;
  --muted: #8b8291;
  --line: rgba(27, 20, 32, 0.08);
  --line-strong: rgba(27, 20, 32, 0.14);

  --accent: #d9557a;
  --accent-soft: rgba(217, 85, 122, 0.12);
  --accent-text: #ffffff;

  --menstrual: #e4576b;
  --follicular: #38b6a0;
  --ovulation: #f0a93b;
  --luteal: #8b7bd8;

  --danger: #d94141;
  --ok: #2f9e6e;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-sm: 0 1px 2px rgba(27, 20, 32, 0.05);
  --shadow: 0 2px 14px rgba(27, 20, 32, 0.07);
  --shadow-lg: 0 10px 40px rgba(27, 20, 32, 0.14);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 56px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* The partner app gets its own accent so the two never feel like one login. */
[data-role='partner'] {
  --accent: #4a63c9;
  --accent-soft: rgba(74, 99, 201, 0.12);
  --bg: #fbfcfe;
  --surface-2: #f0f3f8;
  --surface-3: #e4e9f2;
  --line: rgba(20, 24, 40, 0.08);
  --line-strong: rgba(20, 24, 40, 0.14);
  --text: #141828;
  --text-2: #4a5068;
  --muted: #7e849c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120f17;
    --surface: #1c1824;
    --surface-2: #241f2e;
    --surface-3: #2f2839;
    --text: #f5f1f7;
    --text-2: #c3bbcb;
    --muted: #8f8699;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #f07a9c;
    --accent-soft: rgba(240, 122, 156, 0.16);
    --accent-text: #22101a;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
  [data-role='partner'] {
    --accent: #8ba2f5;
    --accent-soft: rgba(139, 162, 245, 0.16);
    --accent-text: #0e1430;
    --bg: #0f1119;
    --surface: #191d29;
    --surface-2: #212636;
    --surface-3: #2b3143;
    --text: #f1f4fa;
    --text-2: #b9c0d4;
    --muted: #838ba4;
  }
}

/* ------------------------------------------------------------------ base */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

/* Text is selectable where it matters; chrome is not, so drags feel native. */
button,
.chip,
.tab,
.nav-btn,
.seg-btn {
  -webkit-user-select: none;
  user-select: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.2;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* iOS zooms on focus for anything under 16px. Never go smaller. */
input,
textarea {
  font-size: 16px;
}

/* --------------------------------------------------------------- layout */

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 8px) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}

.scroll.no-tabbar {
  padding-bottom: calc(var(--safe-bottom) + 28px);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

/* ------------------------------------------------------------ typography */

.title {
  font-size: 30px;
  letter-spacing: -0.035em;
}

.h2 {
  font-size: 20px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.text-2 {
  color: var(--text-2);
}

.small {
  font-size: 13.5px;
  line-height: 1.5;
}

.tiny {
  font-size: 12px;
}

.center {
  text-align: center;
}

/* ---------------------------------------------------------------- header */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 10px) 20px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.appbar.scrolled {
  border-bottom-color: var(--line);
}

.appbar h1 {
  font-size: 22px;
}

/* ------------------------------------------------------------------ card */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head h3 {
  font-size: 16.5px;
}

/* ---------------------------------------------------------- phase colors */

[data-phase='menstrual'] {
  --phase: var(--menstrual);
}
[data-phase='follicular'] {
  --phase: var(--follicular);
}
[data-phase='ovulation'] {
  --phase: var(--ovulation);
}
[data-phase='luteal'] {
  --phase: var(--luteal);
}
[data-phase] {
  --phase-soft: color-mix(in srgb, var(--phase) 14%, transparent);
}

/* ------------------------------------------------------------- hero ring */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 4px;
}

.ring-wrap {
  position: relative;
  width: min(268px, 74vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.ring-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 9;
}

/* The faint pass is the whole cycle map; .elapsed overlays the part already
   lived through, so both the map and today's progress read at a glance. */
.ring-seg {
  fill: none;
  stroke-width: 10;
  stroke-linecap: butt;
  opacity: 0.22;
}

.ring-seg.elapsed {
  opacity: 1;
  transition: stroke-dasharray 0.9s var(--ease);
}

.ring-marker {
  fill: var(--surface);
  stroke: var(--phase, var(--accent));
  stroke-width: 3.5;
}

.ring-inner {
  position: relative;
  text-align: center;
  padding: 0 26px;
}

.ring-day {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.ring-big {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 2px 0 4px;
}

.ring-sub {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.35;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--phase-soft, var(--accent-soft));
  color: var(--phase, var(--accent));
  font-size: 13.5px;
  font-weight: 700;
}

/* ------------------------------------------------------------------ chip */

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px;
}

.chip-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 74px;
  padding: 10px 6px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: var(--text-2);
  transition: transform 0.14s var(--ease), background 0.14s, border-color 0.14s, color 0.14s;
}

.chip .emoji {
  font-size: 21px;
  line-height: 1;
}

.chip:active {
  transform: scale(0.94);
}

.chip[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chip.row-style {
  flex-direction: row;
  justify-content: flex-start;
  min-height: 56px;
  gap: 11px;
  padding: 10px 14px;
  text-align: left;
  font-size: 14.5px;
}

.chip.row-style .chip-body {
  flex: 1;
  min-width: 0;
}

.chip.row-style .chip-desc {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.chip[aria-pressed='true'] .chip-desc {
  color: color-mix(in srgb, var(--accent) 72%, var(--text-2));
}

/* --------------------------------------------------------------- segment */

.segment {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 13px;
}

.seg-btn {
  flex: 1;
  padding: 9px 8px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.16s, color 0.16s;
}

.seg-btn[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 15px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 650;
  transition: transform 0.14s var(--ease), opacity 0.14s;
}

.btn:active {
  transform: scale(0.975);
  opacity: 0.9;
}

.btn.block {
  width: 100%;
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
}

.btn.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 11px;
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  z-index: 30;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-size: 27px;
  font-weight: 300;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 42%, transparent);
  transition: transform 0.16s var(--ease);
}

.fab:active {
  transform: scale(0.9);
}

/* --------------------------------------------------------------- tab bar */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.16s;
}

.tab svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.8;
}

.tab[aria-current='page'] {
  color: var(--accent);
}

.tab:active {
  opacity: 0.6;
}

/* ---------------------------------------------------------------- fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  outline: none;
  transition: border-color 0.16s, background 0.16s;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

textarea.input {
  min-height: 96px;
  resize: none;
  line-height: 1.5;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:active {
  background: var(--surface-2);
}

.list-row .label {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 550;
}

.list-row .value {
  color: var(--muted);
  font-size: 14.5px;
}

.chevron {
  color: var(--muted);
  opacity: 0.55;
  flex-shrink: 0;
}

/* --------------------------------------------------------------- toggle */

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--surface-3);
  flex-shrink: 0;
  transition: background 0.24s var(--ease);
}

/* 51×31 matches the real iOS switch, which is under the 44pt touch minimum.
   Expand the hit area without changing how it looks. */
.toggle::before {
  content: '';
  position: absolute;
  inset: -9px -8px;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.24s var(--ease);
}

.toggle[aria-checked='true'] {
  background: var(--ok);
}

.toggle[aria-checked='true']::after {
  transform: translateX(20px);
}

/* --------------------------------------------------------------- stepper */

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
}

.stepper button {
  width: 36px;
  height: 34px;
  border-radius: 9px;
  font-size: 19px;
  font-weight: 500;
  color: var(--accent);
  display: grid;
  place-items: center;
}

.stepper button:active {
  background: var(--surface-3);
}

.stepper .val {
  min-width: 46px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

/* ----------------------------------------------------------------- scale */

.scale {
  display: flex;
  gap: 8px;
}

.scale button {
  flex: 1;
  height: 54px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: transform 0.14s var(--ease);
}

.scale button span {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.scale button:active {
  transform: scale(0.94);
}

.scale button[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.scale button[aria-pressed='true'] span {
  color: var(--accent);
}

/* ---------------------------------------------------------------- sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 8, 16, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.sheet-backdrop.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.36s var(--ease);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-grip {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  margin: 9px auto 2px;
  flex-shrink: 0;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sheet-head h2 {
  font-size: 18px;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px calc(var(--safe-bottom) + 20px);
}

.sheet-foot {
  flex-shrink: 0;
  padding: 12px 18px calc(var(--safe-bottom) + 14px);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* -------------------------------------------------------------- calendar */

.cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.cal-head div {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  transition: transform 0.12s var(--ease);
}

.cal-day:active {
  transform: scale(0.9);
}

.cal-day.blank {
  pointer-events: none;
}

.cal-day.other-month {
  opacity: 0.25;
}

.cal-day.period {
  background: var(--menstrual);
  color: #fff;
}

.cal-day.period-predicted {
  background: transparent;
  color: var(--menstrual);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--menstrual) 55%, transparent);
}

.cal-day.fertile {
  background: color-mix(in srgb, var(--follicular) 17%, transparent);
  color: color-mix(in srgb, var(--follicular) 88%, var(--text));
}

.cal-day.ovulation {
  background: var(--ovulation);
  color: #3a2400;
}

.cal-day.pms {
  background: color-mix(in srgb, var(--luteal) 16%, transparent);
  color: color-mix(in srgb, var(--luteal) 88%, var(--text));
}

.cal-day.today {
  outline: 2.5px solid var(--text);
  outline-offset: -2.5px;
}

.cal-dots {
  position: absolute;
  bottom: 5px;
  display: flex;
  gap: 2.5px;
}

.cal-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.legend i {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------- insight */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.stat .n {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.stat .k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.bar-row .name {
  width: 108px;
  flex-shrink: 0;
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}

.bar-row .n {
  width: 34px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 96px;
  padding-top: 8px;
}

.spark .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.spark .col i {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: color-mix(in srgb, var(--accent) 68%, transparent);
  transition: height 0.6s var(--ease);
}

.spark .col b {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------------------------------------------------------- partner bits */

.advice {
  display: flex;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.advice:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.advice .mark {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  margin-top: 1px;
}

.advice.do .mark {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
}

.advice.avoid .mark {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.advice p {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-2);
}

.quote {
  padding: 12px 15px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
}

.quote:last-child {
  margin-bottom: 0;
}

.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--phase, var(--accent)), color-mix(in srgb, var(--phase, var(--accent)) 55%, #fff));
  transition: width 0.8s var(--ease);
}

.alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--phase-soft, var(--accent-soft));
  border: 1px solid color-mix(in srgb, var(--phase, var(--accent)) 22%, transparent);
}

.alert .icon {
  font-size: 18px;
  line-height: 1.2;
}

.alert p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}

.alert strong {
  color: var(--text);
}

/* ------------------------------------------------------------------ auth */

.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 32px) 26px calc(var(--safe-bottom) + 28px);
}

.auth-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding-bottom: 20px;
}

.auth-logo {
  width: 78px;
  height: 78px;
  border-radius: 25px;
  display: grid;
  place-items: center;
  font-size: 38px;
  background: linear-gradient(150deg, #f3a3bd, #b98ce0 55%, #7fc7d9);
  box-shadow: 0 10px 30px rgba(185, 140, 224, 0.35);
  margin-bottom: 6px;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 17px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1.5px solid var(--line);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease), border-color 0.15s;
}

.role-card:active {
  transform: scale(0.98);
}

.role-card .ico {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 25px;
  flex-shrink: 0;
}

.role-card .ico.her {
  background: linear-gradient(150deg, rgba(243, 163, 189, 0.32), rgba(185, 140, 224, 0.32));
}

.role-card .ico.him {
  background: linear-gradient(150deg, rgba(122, 152, 240, 0.3), rgba(110, 205, 208, 0.3));
}

.role-card h3 {
  font-size: 16.5px;
}

.role-card p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.error-msg {
  padding: 11px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}

.code-display {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
}

/* ----------------------------------------------------------------- misc */

.empty {
  text-align: center;
  padding: 44px 24px;
  color: var(--muted);
}

.empty .big {
  font-size: 42px;
  margin-bottom: 12px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 22px);
  z-index: 200;
  transform: translate(-50%, 16px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(24, 18, 30, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s var(--ease);
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-soft);
  color: var(--accent);
}

.fade-in {
  animation: fade-in 0.34s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Wider screens: keep the phone column centred rather than stretching. */
@media (min-width: 620px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--line);
  }
  .fab,
  .toast {
    position: absolute;
  }
}
