:root {
  --ink: #2b2833;
  --ink-soft: rgba(43, 40, 51, .6);
  --glass: rgba(255, 255, 255, .55);
  --glass-strong: rgba(255, 255, 255, .86);
  --line: rgba(255, 255, 255, .75);
  --accent: #6a5a8a;
  --chip-on: #fff;
  --shadow: 0 6px 24px rgba(40, 30, 60, .12);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
body.night {
  --ink: #eef0fb;
  --ink-soft: rgba(238, 240, 251, .62);
  --glass: rgba(20, 26, 50, .45);
  --glass-strong: rgba(24, 30, 58, .9);
  --line: rgba(255, 255, 255, .12);
  --accent: #b8c2ff;
  --chip-on: rgba(255, 255, 255, .18);
  --shadow: 0 6px 24px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f7dce8; color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Hiragino Sans", "Yu Gothic UI", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  transition: color .8s; user-select: none; -webkit-user-select: none; }
#app, canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.ui { position: fixed; inset: 0; pointer-events: none; transition: opacity .8s; }
.ui > * { pointer-events: auto; }
.ui.faded { opacity: 0; }
.ui.faded > * { pointer-events: none; }

.top { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 18px); padding: 0 22px; pointer-events: none; }
.lang-btn { position: absolute; right: 16px; top: -4px; pointer-events: auto; padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lang-btn b { font-weight: 600; }
.lang-btn { display: inline-flex; align-items: center; gap: 5px; }
.lang-btn img.ico { width: 18px; height: 18px; }
.title h1 { margin: 0; font-size: 22px; letter-spacing: .14em; font-weight: 600; }
.title p { margin: 4px 0 0; font-size: 13px; letter-spacing: .2em; color: var(--ink-soft); }

/* ---------- intro: Japanese-app look - airy pastel gradient, soft bokeh, rounded type,
   one white card with the icon and a row of scene stickers, a pill start button */
.intro {
  --pink: #f6b9cc; --peach: #ffd9c7; --lav: #d9d2f5; --sky: #cfe8f6; --ink: #4a4058; --ink-soft: #8a7f99;
  --round: "Zen Maru Gothic", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  position: fixed; inset: 0; z-index: 40; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 24px; color: var(--ink); font-family: var(--round);
  background: linear-gradient(160deg, #fff1f4 0%, #fde7ef 30%, #ece6fb 65%, #e3f1fb 100%);
  transition: opacity .7s ease, visibility .7s; }
.intro.out { opacity: 0; visibility: hidden; }
.bokeh { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; animation: drift 14s ease-in-out infinite alternate; }
.b1 { width: 220px; height: 220px; left: -60px; top: 8%; background: radial-gradient(circle, var(--pink), transparent 70%); }
.b2 { width: 260px; height: 260px; right: -90px; top: 40%; background: radial-gradient(circle, var(--sky), transparent 70%); animation-delay: -5s; }
.b3 { width: 180px; height: 180px; left: 20%; bottom: -50px; background: radial-gradient(circle, var(--peach), transparent 70%); animation-delay: -9s; }
.intro-card { position: relative; width: min(340px, 100%); padding: 30px 24px 22px; border-radius: 32px; text-align: center;
  background: rgba(255, 255, 255, .78); box-shadow: 0 18px 50px rgba(150, 110, 170, .18); border: 2px solid #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: popIn .9s cubic-bezier(.2, 1.3, .4, 1) both; }
.intro-icon { width: 96px; height: 96px; border-radius: 28px; border: 4px solid #fff; box-shadow: 0 10px 24px rgba(200, 120, 160, .3);
  margin-top: -78px; animation: float 4s ease-in-out infinite; }
.intro h1 { margin: 14px 0 2px; font-size: 30px; font-weight: 700; letter-spacing: .14em; text-indent: .14em; }
.intro-en { margin: 0 0 10px; font-size: 13px; font-weight: 500; letter-spacing: .18em; color: #e58aa8; }
:lang(en) .intro-en { display: none; }
.intro-tag { margin: 0 0 16px; font-size: 14px; letter-spacing: .1em; color: var(--ink-soft); }
.intro-scenes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 10px; border-radius: 20px; background: #fff7fa; }
.intro-scenes img { width: 100%; aspect-ratio: 1; object-fit: contain; animation: bob 3s ease-in-out infinite; }
.intro-scenes img:nth-child(2n) { animation-delay: -1.5s; }
.intro-feat { margin: 14px 0 0; font-size: 12px; color: var(--ink-soft); }
.intro-start { position: relative; min-width: 220px; padding: 15px 40px; border-radius: 999px; font-family: var(--round);
  font-size: 18px; font-weight: 700; letter-spacing: .3em; text-indent: .3em; color: #fff;
  background: linear-gradient(135deg, #f59ab7, #c8a8f0); box-shadow: 0 10px 26px rgba(220, 120, 170, .4), inset 0 -3px 0 rgba(0, 0, 0, .08);
  animation: popIn .9s .25s cubic-bezier(.2, 1.3, .4, 1) both; transition: transform .15s; }
:lang(en) .intro-start, :lang(ko) .intro-start { letter-spacing: .08em; text-indent: .08em; }
.intro-start:active { transform: scale(.95); }
.intro-start:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.94); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes drift { to { transform: translate(30px, -24px) scale(1.1); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .bokeh, .intro-icon, .intro-scenes img { animation: none; } }

/* ---------- home */
.home { position: absolute; left: 50%; bottom: calc(var(--sab) + 22px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(440px, calc(100% - 28px));
  transition: opacity .5s, transform .5s; }
.home.hide { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.durations { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.durations button { padding: 7px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; transition: background .25s; }
.durations button.on { background: var(--chip-on); box-shadow: 0 2px 8px rgba(40, 30, 60, .12); }
.start { width: 100%; padding: 16px; border-radius: 20px; font-size: 18px; letter-spacing: .3em; font-weight: 600;
  background: var(--glass-strong); box-shadow: var(--shadow); border: 1px solid var(--line); transition: transform .15s; }
.start:active { transform: scale(.97); }
:lang(en) .start, :lang(ko) .start, :lang(en) .ghost, :lang(ko) .ghost { letter-spacing: .08em; text-indent: .08em; }
.start.small { padding: 12px; font-size: 15px; letter-spacing: .2em; }
.tools { display: flex; justify-content: space-between; width: 100%; padding: 6px; border-radius: 18px; background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tools button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 12px; font-size: 12px; }
.tools button span { font-size: 19px; line-height: 1; }
/* Gemini-drawn icons */
img.ico { display: block; width: 28px; height: 28px; object-fit: contain; }
.list.scenes img.ico { width: 34px; height: 34px; grid-row: span 2; justify-self: center; }
.sleep img.big-ico { width: 64px; height: 64px; margin: 0 auto; }
.ico-emoji { font-size: 22px; line-height: 1; }
.tools button em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tools button:active { background: var(--chip-on); }

/* ---------- session */
.session { position: absolute; inset: 0; display: none; pointer-events: none; }
.session.on { display: block; }
.session > * { pointer-events: auto; }
.timer { position: absolute; left: 50%; top: calc(var(--sat) + 22px); transform: translateX(-50%);
  font-size: 15px; letter-spacing: .25em; font-variant-numeric: tabular-nums; color: var(--ink-soft); transition: opacity .8s; }
.breath { position: absolute; left: 0; right: 0; padding: 0 16px; bottom: calc(var(--sab) + max(84px, 11vh)); text-align: center; pointer-events: none; }
/* breath guide: the orb fills the ring on the inhale, the arc shows how far into the phase you are */
.ring { position: relative; width: 168px; height: 168px; margin: 0 auto 14px; display: grid; place-items: center; transition: opacity .8s; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring .track { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 2; }
.ring .arc { fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .9)); }
body:not(.night) .ring .track { stroke: rgba(90, 70, 120, .22); }
body:not(.night) .ring .arc { stroke: var(--accent); filter: none; }
.ring .orb { position: absolute; inset: 6px; border-radius: 50%; transform: scale(.3); will-change: transform;
  background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, .98), rgba(255, 255, 255, .78) 55%, rgba(255, 255, 255, .45));
  box-shadow: 0 0 36px 10px rgba(255, 255, 255, .55), 0 8px 26px rgba(70, 40, 100, .22); }
.ring.hold .orb { box-shadow: 0 0 46px 16px rgba(255, 255, 255, .75), 0 8px 26px rgba(70, 40, 100, .22); }
#count { position: relative; font-size: 30px; font-weight: 600; color: #4a3f62; font-variant-numeric: tabular-nums; }
:lang(en) #breathText, :lang(ko) #breathText { letter-spacing: .12em; text-indent: .12em; }
#breathText { margin: 0; font-size: 26px; letter-spacing: .5em; text-indent: .5em; font-weight: 600; transition: opacity .4s;
  text-shadow: 0 1px 12px rgba(255, 255, 255, .6); }
body.night #breathText { text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.hint2 { margin: 8px 0 0; font-size: 13px; letter-spacing: .12em; line-height: 1.5; color: var(--ink-soft); transition: opacity 1.5s; }
.ghost { position: absolute; left: 50%; bottom: calc(var(--sab) + 26px); transform: translateX(-50%);
  padding: 9px 26px; border-radius: 999px; font-size: 14px; letter-spacing: .3em; text-indent: .3em;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .8s; }
.session.quiet .timer, .session.quiet .ghost { opacity: .0; }
.session.quiet .hint2 { opacity: 0; }

/* ---------- done */
.done { position: absolute; inset: 0; display: none; place-items: center; padding: 20px; }
.done.on { display: grid; animation: fadeIn 1.2s ease both; }
.card { width: min(340px, 100%); padding: 26px 22px 20px; border-radius: 24px; text-align: center;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.card .big { margin: 0 0 8px; font-size: 20px; letter-spacing: .12em; font-weight: 600; }
.card p { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- sleep */
.sleep { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 40%, #121a36, #04060f 70%); color: #d9def5; }
.sleep.on { display: grid; animation: fadeIn 1.5s ease both; }
.sleep-box { text-align: center; max-width: 320px; }
.sleep .moon { font-size: 44px; margin: 0 0 10px; }
.sleep .big-ico { width: 64px; height: 64px; }
.sleep .big { font-size: 22px; letter-spacing: .3em; text-indent: .3em; margin: 0 0 12px; }
.sleep p { margin: 0 0 10px; font-size: 15px; color: rgba(217, 222, 245, .75); font-variant-numeric: tabular-nums; }
.sleep .note { font-size: 13px; color: rgba(217, 222, 245, .5); }
.ghost-btn { margin-top: 26px; padding: 10px 28px; border-radius: 999px; font-size: 14px; letter-spacing: .25em; text-indent: .25em;
  border: 1px solid rgba(217, 222, 245, .3); color: #d9def5; }
.note.big { font-size: 13px; line-height: 1.7; margin: 0 0 4px; }
.wide-start { margin-top: 18px; }

.week { display: flex; justify-content: center; gap: 10px; margin: 6px 0 18px; }
.week div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-soft); }
.week b { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .5; }
.week b.on { background: var(--accent); border-color: var(--accent); opacity: 1; }
.week b.today { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- sheets */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 25, .2); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; bottom: 0; width: min(480px, 100%); max-height: 78vh; overflow-y: auto;
  transform: translate(-50%, 105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
  padding: 8px 20px calc(var(--sab) + 22px); border-radius: 24px 24px 0 0;
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -8px 30px rgba(20, 20, 40, .15); }
.sheet.on { transform: translate(-50%, 0); }
.sheet header { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; padding: 12px 0 8px; }
.sheet h2 { margin: 0; font-size: 18px; letter-spacing: .15em; }
.sheet h3 { margin: 16px 0 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); letter-spacing: .15em; }
.close { width: 34px; height: 34px; border-radius: 50%; background: rgba(127, 127, 140, .12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { padding: 8px 14px; border-radius: 999px; font-size: 13px; background: rgba(127, 127, 140, .1); transition: background .2s; }
.chips button.on { background: var(--accent); color: #fff; }
body.night .chips button.on { color: #1b2040; }
.mixer { margin: 14px 0 6px; display: grid; gap: 4px; }
.track { display: grid; grid-template-columns: 30px 72px 1fr; align-items: center; gap: 6px; padding: 6px 0; }
.track span { font-size: 18px; text-align: center; }
.track img.ico { width: 26px; height: 26px; justify-self: center; }
.track b { font-size: 14px; font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 14px; border-top: 1px solid rgba(127, 127, 140, .15); }
.row input[type=range] { flex: 1; max-width: 260px; }
input[type=range] { accent-color: var(--accent); }
input[type=time] { font: inherit; color: inherit; background: rgba(127, 127, 140, .1); border: 0; border-radius: 10px; padding: 6px 10px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.list { display: grid; gap: 8px; margin: 6px 0 12px; }
.list button { text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(127, 127, 140, .08); border: 1.5px solid transparent; }
.list button.on { border-color: var(--accent); }
.list b { display: block; font-size: 15px; font-weight: 600; }
.list.scenes { grid-template-columns: 1fr 1fr; }
.list.scenes button { display: grid; grid-template-columns: 36px 1fr; column-gap: 8px; align-items: center; padding: 10px 12px; }
.list.scenes span { grid-row: span 2; font-size: 24px; text-align: center; }
.list.scenes small { line-height: 1.35; }
[hidden] { display: none !important; }
.list small { color: var(--ink-soft); font-size: 12px; }
.wide { width: 100%; margin-top: 10px; padding: 12px; border-radius: 14px; background: rgba(127, 127, 140, .12); font-size: 14px; }
.note { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 16px; }
.stats div { padding: 14px; border-radius: 16px; background: rgba(127, 127, 140, .08); }
.stats b { display: block; font-size: 24px; font-weight: 600; }
.stats small { font-size: 12px; color: var(--ink-soft); }


/* links to the pricing / terms / privacy / refund / contact pages */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 12px 0 0; font-size: 12px; }
.legal-links a { color: inherit; opacity: .75; text-decoration: none; }
.legal-links a:hover { opacity: 1; text-decoration: underline; }
.intro-legal { position: relative; margin-top: 18px; color: var(--ink-soft); }
.sheet .sub { margin: 18px 0 2px; font-size: 13px; font-weight: 600; opacity: .7; }
.legal-by { margin: 10px 0 0; text-align: center; font-size: 11.5px; opacity: .6; }
.legal-by a { color: inherit; }
