/* Clarté partners — the one visual system. Night by default; `html.morning` turns the page ivory. */
:root {
  --ink: #110f17; --night: #090c13; --ivory: #f2ebe0; --ivory2: #e2d9cf; --mute: #c3bab2; --dim: #a99f98; --apricot: #e0a377; --glow: #f0c39c; --cream: #ffe6c8; --rust: #ad5f36; --deep: #221d1f;
  --fg: var(--ivory); --fg2: var(--ivory2); --fg3: var(--mute); --fg4: var(--dim); --em: var(--glow);
  --panel: rgba(242,235,224,0.045); --panel2: rgba(242,235,224,0.08); --line: rgba(240,210,180,0.16); --line2: rgba(240,210,180,0.32);
  --btn-bg: var(--glow); --btn-fg: #1a1411; --field: rgba(242,235,224,0.06); --field-b: rgba(240,210,180,0.22);
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif; --track: .22em;
  --ease: cubic-bezier(.2,.7,.2,1); --spring: cubic-bezier(.34,1.4,.4,1);
}
html.morning { --fg: var(--deep); --fg2: #4f4447; --fg3: #6b5f62; --fg4: #8f857f; --em: var(--rust); --panel: rgba(34,29,31,0.045); --panel2: rgba(34,29,31,0.08); --line: rgba(34,29,31,0.12); --line2: rgba(34,29,31,0.26); --btn-bg: var(--rust); --btn-fg: #fff6ea; --field: rgba(255,255,255,0.55); --field-b: rgba(34,29,31,0.18); }
html[lang=ar] { --serif: 'Amiri', serif; --sans: 'Noto Sans Arabic', system-ui, sans-serif; --track: 0; }
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { min-height: 100vh; min-height: 100dvh; color: var(--fg); font-family: var(--sans); line-height: 1.45; background: var(--ink); -webkit-font-smoothing: antialiased; transition: color .9s; overflow-x: hidden; }
html.morning body { background: var(--ivory); }
html[lang=ar] body { line-height: 1.7; }
button, input, select { font: inherit; color: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--em); outline-offset: 3px; }
em { font-style: italic; font-weight: 400; color: var(--em); } html[lang=ar] em { font-style: normal; }
[hidden] { display: none !important; }
.num { font-variant-numeric: lining-nums tabular-nums; }
.stage { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { max-width: 540px; width: 100%; margin: 0 auto; padding-inline: 22px; }

/* top bar */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: max(18px, env(safe-area-inset-top)); }
.wordmark { display: flex; gap: 5px; font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 21px; line-height: 1; color: var(--fg); text-decoration: none; direction: ltr; letter-spacing: .02em; }
.wordmark .e { position: relative; }
.wordmark .e i { position: absolute; left: 0.17em; top: 0.1em; width: 0.26em; height: 0.05em; border-radius: 0.03em; background: var(--apricot); transform: rotate(-28deg); transform-origin: 0 50%; }
.lang { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 999px; padding: 2px; gap: 2px; }
.lang button { height: 26px; padding: 0 10px; border: none; border-radius: 999px; background: transparent; color: var(--fg3); font-size: 12px; transition: background .3s, color .3s; }
.lang button[aria-pressed=true] { background: var(--btn-bg); color: var(--btn-fg); font-weight: 500; }

/* type */
.h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 9.6vw, 46px); line-height: 1.02; letter-spacing: -0.012em; text-wrap: balance; }
.h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(26px, 7vw, 32px); line-height: 1.08; letter-spacing: -0.01em; text-wrap: balance; }
html[lang=ar] .h1, html[lang=ar] .h2 { letter-spacing: 0; line-height: 1.3; }
.k { font-size: 11px; font-weight: 500; letter-spacing: var(--track); text-transform: uppercase; color: var(--em); }
html[lang=ar] .k { font-size: 13px; }
.lead { font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--fg2); text-wrap: pretty; }
html[lang=ar] .lead { font-size: 20px; line-height: 1.6; }
.p { font-size: 15px; line-height: 1.55; color: var(--fg2); text-wrap: pretty; }
.note { font-size: 13px; line-height: 1.5; color: var(--fg4); }
.msg { font-size: 13.5px; line-height: 1.45; color: var(--em); text-align: center; min-height: 1.3em; transition: opacity .3s; } .msg:empty { opacity: 0; }
.msg.err { color: #f7a58a; } html.morning .msg.err { color: #b6452b; }
.money { font-family: 'Cormorant Garamond', serif; font-weight: 500; line-height: 1; direction: ltr; display: inline-block; font-variant-numeric: lining-nums; }

/* scenes: each screen is a scene that enters from the horizon */
.scene { display: flex; flex-direction: column; gap: 22px; animation: scene .7s var(--ease) both; }
@keyframes scene { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.scene > * { animation: rise .7s var(--ease) both; }
.scene > *:nth-child(2) { animation-delay: .06s; } .scene > *:nth-child(3) { animation-delay: .12s; } .scene > *:nth-child(4) { animation-delay: .18s; } .scene > *:nth-child(5) { animation-delay: .24s; } .scene > *:nth-child(n+6) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.leaving { animation: leave .35s var(--ease) both; } @keyframes leave { to { opacity: 0; transform: translateY(-8px); } }

/* controls */
.cta { position: relative; height: 58px; width: 100%; padding: 0 24px; border: none; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); font-size: 16px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; overflow: hidden; transition: transform .25s var(--spring), box-shadow .4s, opacity .3s; box-shadow: 0 18px 40px -18px rgba(242,166,114,0.7); }
.cta:active { transform: scale(.97); } .cta[disabled], .cta[aria-disabled=true] { opacity: .35; pointer-events: none; box-shadow: none; }
.cta::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); }
.cta.shine::after { animation: shine 1.6s ease .4s; } @keyframes shine { to { transform: translateX(120%); } }
.ghost { height: 52px; width: 100%; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--fg); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: background .3s, transform .25s var(--spring); }
.ghost:active { transform: scale(.97); }
.link { padding: 10px 12px; border: none; background: transparent; color: var(--fg4); font-size: 14px; align-self: center; text-decoration: none; }
.f { position: relative; display: block; }
.f input, .f select { width: 100%; height: 58px; padding: 22px 16px 6px; border-radius: 14px; border: 1px solid var(--field-b); background: var(--field); color: var(--fg); font-size: 16px; transition: border-color .3s, background .3s; appearance: none; }
.f select { padding-top: 20px; }
.f span { position: absolute; left: 16px; top: 19px; font-size: 15px; color: var(--fg4); pointer-events: none; transition: all .25s var(--ease); transform-origin: left top; }
html[dir=rtl] .f span { left: auto; right: 16px; transform-origin: right top; }
.f input:focus, .f select:focus { outline: none; border-color: var(--apricot); }
.f input:focus + span, .f input:not(:placeholder-shown) + span, .f select + span, .f.filled span { transform: translateY(-11px) scale(.78); color: var(--em); }
.f input::placeholder { color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.glass { padding: 20px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 12px; }
.glass.warm { border-color: rgba(240,195,156,0.4); background: linear-gradient(180deg, rgba(224,163,119,0.14), rgba(224,163,119,0.04)); }
html.morning .glass.warm { background: linear-gradient(180deg, rgba(173,95,54,0.10), rgba(173,95,54,0.03)); border-color: rgba(173,95,54,.3); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; letter-spacing: .04em; border: 1px solid var(--line2); color: var(--fg3); white-space: nowrap; }
.pill.on { color: var(--btn-fg); background: var(--btn-bg); border-color: var(--btn-bg); }
.pill.ok { color: #cfe7c6; border-color: rgba(160,220,140,0.45); } html.morning .pill.ok { color: #2e6b2a; border-color: rgba(46,107,42,.4); }
.pill.wait { color: var(--em); border-color: rgba(240,195,156,0.5); } .pill.bad { color: #f7a58a; border-color: rgba(247,165,138,0.45); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--em); animation: spin .9s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.dots { display: flex; gap: 8px; justify-content: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line2); transition: background .4s, transform .4s var(--spring); } .dots i.on { background: var(--em); transform: scale(1.25); }

/* choice cards: a constellation of options */
.opt { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px 18px; text-align: start; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); transition: border-color .35s, background .35s, transform .3s var(--spring); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.opt:active { transform: scale(.985); }
.opt .star { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line2); box-shadow: 0 0 0 0 rgba(255,214,170,0); transition: background .35s, box-shadow .5s, transform .5s var(--spring); }
.opt.on { border-color: rgba(240,195,156,.6); background: var(--panel2); } .opt.on .star { background: #fff1dc; box-shadow: 0 0 18px 6px rgba(255,214,170,.45); transform: scale(1.3); }
.opt .b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .opt .n { font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.1; } .opt .d { font-size: 13.5px; line-height: 1.4; color: var(--fg3); }
.opt .r { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; } .opt .pr { font-size: 26px; } .opt .du { font-size: 12px; color: var(--fg3); white-space: nowrap; }

/* the hold ring: charge the sun */
.hold { position: relative; width: 112px; height: 112px; margin: 0 auto; border-radius: 50%; border: none; background: transparent; color: var(--fg); display: flex; align-items: center; justify-content: center; }
.hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hold circle { fill: none; stroke-width: 2; } .hold .bg { stroke: var(--line2); } .hold .fg { stroke: var(--em); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; transition: stroke-dashoffset .1s linear; filter: drop-shadow(0 0 6px rgba(255,214,170,.7)); }
.hold .core { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff6ea 0%, #ffe6c8 40%, #f0c39c 100%); box-shadow: 0 0 30px 6px rgba(242,166,114,.35); transition: transform .3s var(--spring), box-shadow .3s; }
.hold.active .core { transform: scale(1.08); box-shadow: 0 0 50px 14px rgba(242,166,114,.6); }
.hold.done .core { transform: scale(1.18); box-shadow: 0 0 70px 20px rgba(255,214,170,.8); }

/* code: four points of light / four cells */
.code { display: flex; gap: 12px; justify-content: center; direction: ltr; }
.code b { position: relative; width: 60px; height: 78px; border-radius: 16px; border: 1px solid var(--line2); background: var(--panel); display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', serif; font-size: 46px; font-weight: 500; color: var(--cream); animation: cell .6s var(--spring) both; }
.code b:nth-child(2) { animation-delay: .08s; } .code b:nth-child(3) { animation-delay: .16s; } .code b:nth-child(4) { animation-delay: .24s; }
.code b::after { content: ''; position: absolute; left: 50%; bottom: 8px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--em); box-shadow: 0 0 10px 3px rgba(255,214,170,.6); }
html.morning .code b { color: var(--deep); }
@keyframes cell { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
.codein { position: relative; display: flex; gap: 12px; justify-content: center; direction: ltr; }
.codein input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; }
.codein b { width: 60px; height: 78px; border-radius: 16px; border: 1px solid var(--line2); background: var(--panel); display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', serif; font-size: 46px; font-weight: 500; color: var(--cream); transition: border-color .3s, transform .3s var(--spring); }
.codein b.cur { border-color: var(--apricot); } .codein b.full { transform: translateY(-2px); }
.codein.shake { animation: shake .5s; } @keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin { position: relative; height: 64px; }
.pin input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; }
.pin .cells { position: absolute; inset: 0; display: flex; gap: 10px; justify-content: center; align-items: center; pointer-events: none; direction: ltr; }
.pin .cells i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line2); transition: background .25s, transform .35s var(--spring), border-color .25s; } .pin .cells i.on { background: var(--em); border-color: var(--em); transform: scale(1.15); box-shadow: 0 0 12px 2px rgba(255,214,170,.5); }
.pin.focus .cells i.cur { border-color: var(--apricot); }

/* toast */
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 24px); z-index: 90; padding: 12px 18px; border-radius: 999px; background: #f6f1ea; color: #221d1f; font-size: 14px; opacity: 0; transition: opacity .35s, transform .45s var(--spring); pointer-events: none; box-shadow: 0 20px 40px -16px rgba(0,0,0,.6); max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.ft { text-align: center; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--fg4); padding: 26px 0 max(28px, env(safe-area-inset-bottom)); } html[lang=ar] .ft { font-style: normal; }
@media (prefers-reduced-motion: reduce) { .scene, .scene > *, .code b, .leaving { animation: none !important; } .cta::after { display: none; } }
