/* Ascension Arc onboarding: phone-first layout on top of the shared
   neumorphic tokens (base.css) and components (components.css). */

html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}

/* ---- texture: film grain over everything, finer grain inside cards ---- */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .32 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.tex { position: relative; overflow: hidden; }
.tex::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.tex::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,0) 38%, rgba(0,0,0,0) 70%, rgba(0,0,0,.05));
}
.card.ink.tex::before { opacity: .35; mix-blend-mode: screen; }
.card.ink.tex::after { background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,0) 40%, rgba(0,0,0,.18)); }
.tex > * { position: relative; z-index: 1; }

/* ---- frame ---- */
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.ob-top {
  position: sticky; top: 0; z-index: 5;
  background: var(--ink); color: var(--on-ink);
  padding: calc(env(safe-area-inset-top) + 16px) 22px 18px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  box-shadow: 0 14px 30px rgba(20, 22, 26, .22);
}
.ob-sys { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-ink-2); }
.ob-sys.light { color: rgba(240, 244, 243, .72); }
.ob-top-t { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.ob-progress { display: flex; gap: 5px; margin-top: 14px; }
.ob-progress i { flex: 1; height: 4px; border-radius: 999px; background: rgba(255,255,255,.14); transition: background var(--fast) var(--ease); }
.ob-progress i.on { background: var(--on-ink); }

.ob-body {
  width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: 20px 16px calc(112px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.ob-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 10px; max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, rgba(232, 233, 237, 0));
}
.ob-foot .btn { flex: 1; padding: 15px 20px; font-size: 16px; }
.ob-foot .btn.ghost { flex: 0 0 auto; min-width: 84px; }

/* ---- content bits ---- */
.ob-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 8px; }
.card.ink .ob-title { color: var(--on-ink); }
.card p.t-body { margin: 0; }
.card .sys { margin-top: 12px; }
.card > .t-label + .field, .card .field + .field { margin-top: 2px; }
.card { display: flex; flex-direction: column; gap: 14px; }
.ob-hint { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.ob-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ob-unit { display: flex; gap: 8px; align-items: center; }
.ob-unit .input { flex: 1; min-width: 0; }
.ob-unit-l { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.ob-unit .seg { flex: none; }
.input[type="time"], .input[type="date"] { -webkit-appearance: none; appearance: none; min-height: 46px; }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.4; }

.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-chips .chip { cursor: pointer; font: inherit; font-size: 13.5px; }
.ob-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 0; }
.ob-row-l { font-weight: 600; font-size: 15px; }
.ob-row .toggle { flex: none; }

.ob-equip { display: flex; flex-direction: column; gap: 10px; }
.ob-equip-item { display: flex; flex-direction: column; gap: 8px; }
.ob-equip-item .input { margin-left: 4px; }

.ob-test { display: grid; grid-template-columns: 1fr 112px; gap: 10px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ob-test:last-child { border-bottom: 0; padding-bottom: 0; }
.ob-test .name { font-weight: 600; font-size: 15px; }
.ob-test .meta { font-size: 12px; color: var(--text-3); line-height: 1.35; margin-top: 2px; }
.ob-test-r { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ob-test-r .input { text-align: center; padding-left: 8px; padding-right: 8px; }
.ob-test-r .chip { justify-content: center; font-size: 12px; }
.ob-test-r .input[disabled] { opacity: .4; }

.ob-review { display: flex; flex-direction: column; }
.ob-review-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ob-review-row:last-child { border-bottom: 0; }
.ob-review-row .t { flex: 1; min-width: 0; }
.ob-review-row .k { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.ob-review-row .v { font-size: 14px; color: var(--text); margin-top: 2px; line-height: 1.35; overflow-wrap: anywhere; }

/* ---- loading gate ---- */
.ob-loading {
  position: fixed; inset: 0; z-index: 20; color: #eef2f1;
  background: #1a2624 url(../img/cover.jpg) center / cover no-repeat;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 26px calc(34px + env(safe-area-inset-bottom)); box-sizing: border-box;
}
.ob-loading::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(16, 26, 25, .1) 0%, rgba(14, 22, 21, .55) 50%, rgba(10, 16, 15, .94) 82%, #0b1211 100%);
}
.ob-loading::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.ob-loading > * { position: relative; z-index: 1; }
.ob-loading .word { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 8px 0 14px; }
.ob-load-msg { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.ob-load-p { font-size: 14px; line-height: 1.5; color: rgba(238, 242, 241, .78); margin: 8px 0 0; }
.ob-loadbar { height: 3px; border-radius: 999px; background: rgba(255,255,255,.16); overflow: hidden; margin: 22px 0 16px; }
.ob-loadbar i { display: block; height: 100%; width: 36%; background: #f4f6f5; border-radius: 999px; animation: ob-slide 2.4s var(--ease) infinite; }
@keyframes ob-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.ob-load-foot { display: flex; align-items: center; justify-content: space-between; }
.ob-link { background: none; border: 0; color: rgba(238, 242, 241, .8); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; cursor: pointer; }
.ob-enter { margin-top: 14px; }
.ob-enter .btn { width: 100%; background: #f4f6f5; color: #0e1615; box-shadow: none; padding: 15px; font-size: 16px; }

/* ---- sheet + toasts ---- */
.ob-sheet-root { position: fixed; inset: 0; z-index: 30; display: none; align-items: flex-end; background: rgba(20, 22, 26, .38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ob-sheet-root.open { display: flex; }
.ob-sheet { width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box; background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(20, 22, 26, .25); display: flex; flex-direction: column; gap: 14px; animation: ob-up .28s var(--ease); }
.ob-sheet-actions { display: flex; flex-direction: column; gap: 10px; }
.ob-sheet-actions .btn { width: 100%; }
@keyframes ob-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.ob-toasts { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 0; right: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.ob-toast { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; background: var(--ink); color: var(--on-ink); padding: 9px 16px; border-radius: 999px; box-shadow: 0 8px 20px rgba(20, 22, 26, .3); animation: ob-up .25s var(--ease); max-width: 86vw; text-align: center; }

@media (prefers-reduced-motion: reduce) { .ob-loadbar i { animation: none; width: 100%; opacity: .5; } }
