:root {
  --ink: #12333d;
  --muted: #687d82;
  --deep: #082b38;
  --ocean: #0d6975;
  --aqua: #39a5a7;
  --foam: #eff9f6;
  --sand: #fbfaf4;
  --paper: rgba(255,255,255,.91);
  --line: rgba(15,74,82,.14);
  --coral: #c65748;
  --gold: #ad7a2d;
  --shadow: 0 18px 50px rgba(12,51,58,.11);
  font-family: Inter, ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--sand);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--sand); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(24,145,151,.42); outline-offset: 3px; }
h1,h2,h3,p { margin-top: 0; }
h1 { letter-spacing: -.04em; }
.eyebrow { margin: 0 0 .55rem; color: var(--ocean); font-size: .73rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.button { min-height: 44px; border: 1px solid transparent; border-radius: 14px; padding: .75rem 1rem; font-weight: 750; background: white; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--ocean); box-shadow: 0 8px 20px rgba(13,105,117,.2); }
.button.secondary { color: var(--ocean); background: #e9f5f2; border-color: rgba(13,105,117,.15); }
.button.quiet { color: var(--muted); background: transparent; border-color: var(--line); }
.button.stop { color: #fff; background: #9c4137; }
.button.record { color: #fff; background: var(--coral); }
.button.confirm-button, .button.speak-button { color: white; background: #1f7a68; }
.button.wide { width: 100%; }
.button.small { min-height: 38px; padding: .5rem .75rem; border-radius: 11px; font-size: .86rem; }
.text-button { min-height: 42px; border: 0; padding: .4rem .55rem; background: transparent; color: var(--ocean); font-weight: 700; }
.form-error { min-height: 1.2em; color: #9a332d; font-size: .88rem; font-weight: 650; }
label { display: grid; gap: .42rem; color: var(--ink); font-weight: 720; }
label span { color: var(--muted); font-size: .8rem; font-weight: 500; }
input, textarea, select { width: 100%; border: 1px solid rgba(13,105,117,.19); border-radius: 12px; background: rgba(255,255,255,.92); padding: .78rem .85rem; font-size: 1rem; }
textarea { resize: vertical; line-height: 1.45; }

/* Threshold */
.threshold-page { background: radial-gradient(circle at 20% 10%, rgba(106,199,190,.23), transparent 35%), radial-gradient(circle at 85% 75%, rgba(45,129,143,.13), transparent 32%), #edf6f1; }
.threshold-shell { min-height: 100vh; display: grid; place-items: center; padding: max(1.5rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom)); }
.threshold-card { width: min(680px, 100%); padding: clamp(1.5rem, 5vw, 3.6rem); text-align: center; background: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.8); border-radius: 36px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 1.4rem; border-radius: 50% 48% 54% 47%; background: var(--deep); color: #bde9df; font: 700 2rem Georgia, serif; box-shadow: 0 10px 28px rgba(8,43,56,.25); }
.threshold-card h1 { margin-bottom: .65rem; font: 500 clamp(3rem, 9vw, 5.6rem)/.9 Georgia, serif; color: var(--deep); }
.threshold-intro { max-width: 500px; margin: 0 auto 2rem; color: var(--muted); line-height: 1.6; }
.login-form { width: min(390px,100%); margin: 1.7rem auto 0; display: grid; gap: 1rem; text-align: left; }
.destination-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0 1rem; text-align: left; }
.destination { min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; gap: .55rem; border: 1px solid var(--line); border-radius: 24px; padding: 1.4rem; text-decoration: none; background: linear-gradient(145deg,#fff,#eef8f4); transition: transform .2s ease, box-shadow .2s ease; }
.destination:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(15,70,75,.12); }
.destination-icon { color: var(--aqua); font-size: 2.5rem; margin-bottom: auto; }
.destination strong { color: var(--deep); font-size: 1.25rem; }
.destination span:last-child { color: var(--muted); line-height: 1.45; }
.mobile-destination { background: linear-gradient(145deg,#0c3c49,#0c6670); color: white; }
.mobile-destination strong, .mobile-destination span:last-child { color: white; }
.welcome, .soft-status { color: var(--muted); }

/* Cave */
.app-page { background: radial-gradient(circle at 10% 0%, rgba(110,205,194,.15), transparent 31%), #f5f6f0; }
.app-header { height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 0 clamp(1rem,3vw,2.5rem); border-bottom: 1px solid var(--line); background: rgba(251,250,244,.82); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.wordmark { font: 650 1.25rem Georgia, serif; text-decoration: none; color: var(--deep); }.wordmark span { color: var(--ocean); }
.app-header nav { justify-self: end; display: flex; align-items: center; gap: 1rem; font-size: .88rem; }.app-header nav a { color: var(--ocean); font-weight: 700; text-decoration: none; }
.header-state { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .45rem; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #a0aaa9; }.connection-dot.live { background: #39a676; box-shadow: 0 0 0 4px rgba(57,166,118,.12); }.connection-dot.reconnecting { background: var(--gold); }
.cave-layout { display: grid; grid-template-columns: minmax(310px,390px) minmax(0,1fr); min-height: calc(100vh - 68px); }
.control-column { padding: clamp(1rem,3vw,2.2rem); border-right: 1px solid var(--line); background: rgba(238,245,239,.58); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 1.35rem; box-shadow: 0 8px 30px rgba(20,60,65,.06); }
.session-panel h1 { margin-bottom: .55rem; font-size: 1.8rem; }.session-panel > div > p { color: var(--muted); line-height: 1.5; }
.session-heading { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.stack-form { display: grid; gap: .75rem; padding-top: 1.3rem; margin-top: 1.3rem; border-top: 1px solid var(--line); }
.current-prompt { margin-top: 1.3rem; padding: 1rem; border-radius: 16px; background: var(--deep); color: white; }.current-prompt .eyebrow { color: #86d3c7; }.current-prompt p:last-child { margin: 0; font-size: 1.06rem; line-height: 1.45; }
.principle-card { margin-top: 1rem; padding: 1rem 1.1rem; color: var(--muted); font-size: .85rem; line-height: 1.5; }.principle-card strong { color: var(--ocean); }.principle-card p { margin: .35rem 0 0; }
.timeline-column { padding: clamp(1rem,4vw,3rem); max-width: 1100px; width: 100%; margin: 0 auto; }
.timeline-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }.timeline-header h2 { margin: 0; font: 500 2rem Georgia,serif; }
.timeline-actions { display: flex; align-items: end; gap: .6rem; }.compact-label { gap: .2rem; color: var(--muted); font-size: .7rem; }.compact-label select { min-width: 160px; padding: .5rem; font-size: .78rem; }.history-picker { margin-top: 1rem; }.superseded-record { opacity: .76; border-left: 3px solid var(--coral); }.superseded-record::before { content: "Superseded — retained for history"; display: block; margin-bottom: .4rem; color: var(--coral); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.empty-state { text-align: center; color: var(--muted); padding: 11vh 1rem; }.empty-state h3 { color: var(--ink); }.empty-ripple { width: 64px; height: 64px; margin: 0 auto 1.4rem; border: 1px solid var(--aqua); border-radius: 50%; box-shadow: 0 0 0 14px rgba(57,165,167,.08),0 0 0 28px rgba(57,165,167,.035); }
.timeline { display: grid; gap: 1.3rem; }
.moment-card { background: var(--paper); border: 1px solid var(--line); border-radius: 26px; padding: clamp(1rem,3vw,1.6rem); box-shadow: 0 12px 36px rgba(15,55,62,.07); }
.moment-header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }.moment-header h3 { margin: 0; }.moment-time { color: var(--muted); font-size: .8rem; }
.moment-media { margin: 1rem 0; overflow: hidden; border-radius: 18px; background: #071f28; }.moment-media img,.moment-media video { width: 100%; max-height: 460px; object-fit: contain; display: block; }
.capture-note { color: var(--muted); font-size: .85rem; }
.provenance { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 18px; }
.provenance-title { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .5rem; }.provenance-title span:last-child { justify-self: end; color: var(--muted); font-size: .76rem; }.provenance-mark { width: 9px; height: 9px; border-radius: 50%; }.provenance-mark.literal { background: #3f8297; }.provenance-mark.interpretation { background: var(--gold); }.provenance-mark.confirmed { background: #278267; box-shadow: 0 0 0 4px rgba(39,130,103,.1); }
.observation-section { background: rgba(227,242,244,.42); }.annotation-section { background: rgba(250,243,222,.46); }.confirmation-section { border-width: 2px; border-color: rgba(39,130,103,.26); background: rgba(230,246,238,.64); }
.record-list { display: grid; gap: .55rem; margin: .8rem 0; }.record-block { padding: .7rem .8rem; border-radius: 12px; background: rgba(255,255,255,.72); }.record-text { margin: 0; white-space: pre-wrap; line-height: 1.45; }.record-meta { margin: .28rem 0 0; color: var(--muted); font-size: .72rem; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: .55rem; align-items: end; }.annotation-form { grid-template-columns: 1fr 110px auto; }.inline-form textarea { grid-row: span 2; }
.confirmation-form-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: .75rem; align-items: end; }.confirm-check { display: flex; align-items: center; grid-column: 1/-1; font-size: .82rem; }.confirm-check input { width: 20px; height: 20px; }
.repair-details { margin-top: .45rem; color: var(--muted); font-size: .76rem; }.repair-details summary { cursor: pointer; color: var(--ocean); font-weight: 700; }.repair-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; padding-top: .5rem; }.repair-form input { padding: .55rem; font-size: .8rem; }.correction-row { margin-top: .5rem; border-left: 3px solid var(--coral); padding: .45rem .6rem; color: #7b443e; background: #fff4ef; }.correction-row p { margin: .25rem 0 0; }

/* Mobile */
.mobile-page { background: #eaf3ef; padding-bottom: env(safe-area-inset-bottom); }
.mobile-header { min-height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; background: var(--deep); color: white; position: sticky; top: 0; z-index: 20; }
.mobile-wordmark { font: 650 1.25rem Georgia,serif; text-decoration: none; }.icon-button { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: white; font-weight: 800; }
.privacy-pill { min-height: 34px; display: flex; align-items: center; gap: 7px; border-radius: 99px; padding: 5px 10px; font-size: .72rem; background: rgba(255,255,255,.1); }.privacy-pill span { width: 9px; height: 9px; border-radius: 50%; background: #96a7aa; }.privacy-pill.live span { background: #63d095; box-shadow: 0 0 0 4px rgba(99,208,149,.12); }.privacy-pill.recording { background: #8e352f; }.privacy-pill.recording span { background: #ffcec5; animation: pulse 1s infinite; }.privacy-pill.paused span { background: #e0b864; }
@keyframes pulse { 50% { opacity: .35; } }
.mobile-menu-panel { position: absolute; right: 10px; top: calc(54px + env(safe-area-inset-top)); display: grid; min-width: 170px; background: white; color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: .5rem; }.mobile-menu-panel a { padding: .75rem; text-decoration: none; font-weight: 700; }
.mobile-main { width: min(540px,100%); margin: 0 auto; padding: 12px 12px 32px; display: grid; gap: 12px; }
.mobile-main > section { border-radius: 20px; border: 1px solid var(--line); background: white; padding: 15px; box-shadow: 0 8px 22px rgba(8,43,56,.05); }
.mobile-session-card { color: white; background: linear-gradient(145deg,#0b4652,#0b6c72) !important; border: 0 !important; }.mobile-session-card h1 { margin: .8rem 0 .55rem; font-size: clamp(1.45rem,7vw,2.1rem); line-height: 1.08; }.mobile-session-card p { margin-bottom: 0; color: #d2ece7; line-height: 1.45; }.mobile-session-meta { display: flex; justify-content: space-between; color: #9ed6cc; font-size: .72rem; font-weight: 750; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }.section-heading h2,.capture-card h2,.speech-card h2 { margin: 0; font-size: 1.15rem; }.record-timer { padding: .4rem .6rem; color: white; background: var(--coral); border-radius: 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.preview-shell { aspect-ratio: 4/3; margin: 12px 0 9px; border-radius: 16px; overflow: hidden; background: #082833; position: relative; }.preview-shell video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }.preview-placeholder { height: 100%; display: grid; place-items: center; align-content: center; color: #b9d3d1; padding: 1rem; text-align: center; }.preview-placeholder p { margin: .8rem 0 0; font-size: .82rem; }.preview-orbit { width: 44px; height: 44px; border: 1px solid #4a8589; border-radius: 50%; box-shadow: 0 0 0 10px rgba(93,180,174,.08),0 0 0 20px rgba(93,180,174,.035); }
.capture-status { min-height: 2.4em; color: var(--muted); font-size: .8rem; line-height: 1.4; }.capture-controls { display: grid; gap: 8px; }.mobile-action { width: 100%; min-height: 50px; }.live-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.live-controls .stop { grid-column: 1/-1; }
.fallback-capture { margin-top: .8rem; color: var(--muted); font-size: .8rem; }.fallback-capture summary { min-height: 40px; display: flex; align-items: center; color: var(--ocean); font-weight: 750; }.fallback-capture p { line-height: 1.4; }.file-button { display: inline-flex; margin: 0 .4rem .4rem 0; padding: .65rem; border-radius: 10px; background: #eef5f2; color: var(--ocean); }.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.speech-explainer { color: var(--muted); font-size: .82rem; line-height: 1.45; }.confirmed-phrases { display: grid; gap: .7rem; }.phrase-card { padding: .9rem; border-radius: 15px; background: #e7f5ed; border: 1px solid rgba(39,130,103,.2); }.confirmed-label { color: #26715e; font-size: .7rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }.phrase-text { margin: .45rem 0 .75rem; font: 500 1.25rem Georgia,serif; line-height: 1.25; }.speak-button { width: 100%; }
.recent-moments { display: grid; }.recent-row { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line); font-size: .8rem; }.recent-row:first-child { border-top: 0; }.recent-row time { color: var(--muted); text-align: right; }

@media (max-width: 850px) {
  .cave-layout { grid-template-columns: 1fr; }.control-column { border-right: 0; border-bottom: 1px solid var(--line); }.app-header { grid-template-columns: 1fr auto; }.header-state { display: none; }.app-header nav a { display: none; }
}
@media (max-width: 620px) {
  .destination-grid { grid-template-columns: 1fr; }.destination { min-height: 150px; }.threshold-card { border-radius: 24px; }
  .annotation-form,.inline-form,.confirmation-form-grid,.repair-form { grid-template-columns: 1fr; }.inline-form textarea,.confirm-check { grid-column: 1; }.provenance-title { grid-template-columns: auto 1fr; }.provenance-title span:last-child { grid-column: 2; justify-self: start; }.moment-header { display: block; }.moment-time { display: block; margin-top: .35rem; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
