/* My Space — design system. Calm, warm, adult. */
:root {
  --bg: #FBF8F3;
  --surface: #FFFFFF;
  --ink: #24313A;
  --muted: #5B6770;
  --line: #E7E1D8;
  --teal: #2F8A83;          /* AA on white for text/buttons */
  --teal-soft: #DCEFEC;
  --lav: #7C6FC0;
  --lav-soft: #ECE8F8;
  --warm: #E8914A;          /* celebration only */
  --warm-soft: #FCEBDD;
  --danger: #B5483C;
  --radius: 22px;
  --radius-sm: 14px;
  --tap: 56px;
  --shadow: 0 1px 2px rgba(36,49,58,.05), 0 6px 20px rgba(36,49,58,.06);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-deva: "Noto Sans Devanagari", "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: light;
}
[data-script="deva"] { --font: var(--font-deva); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 18px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.app {
  max-width: 520px; margin: 0 auto; min-height: 100dvh;
  padding: env(safe-area-inset-top) 20px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column;
}
main { flex: 1; display: flex; flex-direction: column; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1.05rem; margin: 0 0 12px; font-weight: 700; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 3px; border-radius: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 14px 24px; border-radius: 999px; border: 0;
  font: 700 1.05rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-soft { background: var(--teal-soft); color: #1F5F5A; }
.btn-danger { background: #F6E1DE; color: var(--danger); }
.btn-xl { width: 100%; min-height: 62px; font-size: 1.15rem; }
.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); color: var(--ink); text-decoration: none; font-size: 1.3rem;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.hint { color: var(--muted); font-size: .95rem; margin: 14px 0 0; }
.fine { color: var(--muted); font-size: .9rem; text-align: center; margin: 14px 0 0; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; min-height: 64px; }
.topbar-title { font-weight: 700; }

/* ---------- Opening ---------- */
.opening { justify-content: space-between; text-align: center; padding: 6vh 0 2vh; min-height: calc(100dvh - 24px); }
.opening-orb { position: relative; width: 190px; height: 190px; margin: 2vh auto 0; }
.opening-orb span {
  position: absolute; inset: 0; border-radius: 50%;
  animation: breathe-soft 8s ease-in-out infinite;
}
.opening-orb span:nth-child(1) { background: radial-gradient(circle at 35% 35%, #E7F5F2, var(--teal-soft)); }
.opening-orb span:nth-child(2) { inset: 26px; background: radial-gradient(circle at 60% 30%, #F4F1FC, var(--lav-soft)); animation-delay: -2.6s; }
.opening-orb span:nth-child(3) { inset: 58px; background: radial-gradient(circle at 40% 35%, #58AFA7, var(--teal)); animation-delay: -5.2s; box-shadow: 0 10px 30px rgba(47,138,131,.25); }
@keyframes breathe-soft { 0%,100% { transform: scale(.94); } 50% { transform: scale(1.04); } }
.brand { margin: 0; color: var(--lav); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .82rem; }
.appname { font-size: 2.6rem; margin: 4px 0 18px; color: var(--ink); }
.welcome { font-size: 1.2rem; font-weight: 700; margin: 0 0 6px; }
.tagline { color: var(--muted); margin: 0; font-size: 1.1rem; }
.opening-actions { display: flex; flex-direction: column; gap: 18px; }
.opening-copy { animation: rise .9s ease both .15s; }
.opening-actions { animation: rise .9s ease both .45s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.lang-switch { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lang-pill {
  min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); font: 700 1rem var(--font); cursor: pointer;
}
.lang-pill[lang="hi"] { font-family: var(--font-deva); }
.lang-pill.is-on { border-color: var(--teal); background: var(--teal-soft); color: #1F5F5A; }

/* ---------- Onboarding ---------- */
.ob { padding-top: 10px; }
.ob-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.dots { display: flex; gap: 6px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .3s, width .3s; }
.dots span.on { background: var(--teal); width: 20px; border-radius: 4px; }
.skip { color: var(--muted); font-weight: 700; text-decoration: none; padding: 12px 6px; min-height: 48px; display: grid; place-items: center; }
.ob-q { margin: 18px 0 22px; font-size: 1.55rem; }
.ob-body { flex: 1; }
.ob-foot { position: sticky; bottom: 0; padding: 16px 0 calc(env(safe-area-inset-bottom) + 8px); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.pref + .pref { margin-top: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips-stack { flex-direction: column; }
.chips-stack .chip { width: 100%; justify-content: flex-start; min-height: 64px; font-size: 1.1rem; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  font: 400 1rem/1.2 var(--font); cursor: pointer; text-align: left;
  transition: background-color .2s, border-color .2s, transform .15s;
}
.chip:active { transform: scale(.97); }
.chip-emoji { font-size: 1.25rem; }
.chip-tick { display: none; margin-left: 2px; font-weight: 700; color: #1F5F5A; }
.chip.is-on { background: var(--teal-soft); border-color: var(--teal); font-weight: 700; }
.chip.is-on .chip-tick { display: inline; }   /* state shown by tick + weight, not colour alone */

.text-in {
  width: 100%; min-height: 62px; padding: 14px 20px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--surface); font: 400 1.2rem var(--font); color: var(--ink);
}
.text-in:focus { border-color: var(--teal); outline: none; }

.ready, .soon { align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 8vh 0; }
.ready-mark, .soon-mark { font-size: 3.4rem; width: 110px; height: 110px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-soft); animation: pop .6s ease both; }
.ready-name { font-size: 1.3rem; font-weight: 700; color: var(--lav); margin: 0; }
.ready .btn, .soon .btn { margin-top: 12px; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Home ---------- */
.home { gap: 18px; padding-bottom: 96px; }
.greet-time { margin: 0; color: var(--muted); font-weight: 700; }
.greet h1 { font-size: 1.9rem; margin-top: 2px; }
.next-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.next-card small { color: var(--muted); font-weight: 700; }
.next-card.empty { align-items: flex-start; }
.next-card.empty p { margin: 0; color: var(--muted); }
.next-row { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; }
.next-emoji { font-size: 1.6rem; }
.next-time { margin-left: auto; color: var(--muted); font-size: 1rem; }
.progress { height: 10px; background: var(--teal-soft); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .6s ease; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.big-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 150px; padding: 18px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .15s ease;
}
.big-card:active { transform: scale(.98); }
.big-card-emoji { font-size: 2rem; }
.big-card-text { display: flex; flex-direction: column; gap: 2px; }
.big-card strong { font-size: 1.12rem; line-height: 1.25; }
.big-card small { color: var(--muted); font-size: .92rem; }
.tone-teal { background: var(--teal-soft); }
.tone-lav { background: var(--lav-soft); }
.tone-calm { background: linear-gradient(145deg, var(--lav-soft), var(--teal-soft)); }

.fab {
  position: fixed; right: max(20px, calc(50% - 240px)); bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 12px 22px;
  border-radius: 999px; background: var(--lav); color: #fff; font-weight: 700; text-decoration: none;
  box-shadow: 0 8px 24px rgba(124,111,192,.35);
}

/* ---------- Breathe ---------- */
.breathe { align-items: center; text-align: center; gap: 22px; padding: 2vh 0 4vh; }
.breathe-title { font-size: 1.5rem; max-width: 22ch; }
.orb-wrap { position: relative; width: 260px; height: 260px; display: grid; place-items: center; margin: 2vh 0; }
.breath-orb {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #BFE3DE, var(--teal-soft) 55%, var(--lav-soft));
  transform: scale(.55); transition-property: transform, background-color; transition-timing-function: ease-in-out;
}
.breath-orb[data-phase="in"], .breath-orb[data-phase="hold"] { transform: scale(1); }
.breath-orb[data-phase="out"] { transform: scale(.55); }
.breath-orb.still { transform: none !important; }
.breath-orb.still[data-phase="hold"] { background: var(--lav-soft); }
.breath-word { position: relative; font-size: 1.6rem; font-weight: 700; margin: 0; color: #1F5F5A; }
.breath-round { color: var(--muted); margin: 0; }
.breathe .chips-stack, .breathe .stack { width: 100%; }

/* ---------- Settings ---------- */
.settings { gap: 16px; }
.set-block { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.set-block p { margin: 0; }
.set-block .lang-switch { justify-content: flex-start; }
.confirm { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* Motion safety */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0ms !important; }
}
