/* RemRoam — minimal dark style. Colours and type follow the design doc's Brand section. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("../fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url("../fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #0B0D12;
  --bg-deep: #07080C;
  --surface: #151922;
  --surface-2: #11141B;
  --line: #2A303C;
  --line-soft: #1C212B;
  --text: #E8EAF0;
  --text-2: #C9CFDA;
  --muted: #9AA3B2;
  --fog: #B8C4D0;
  --icon-bg: #C4D5E3;
  --coin: #D9A54A;
  --moss: #7FB685; --midnight: #8EA6E6; --ochre: #D9A54A; --copper: #C98450; --violet: #A08BE0; --crimson: #D96C6C;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-family: "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
.screen-body { padding: 8px 24px 32px; display: flex; flex-direction: column; gap: 14px; }

/* Splash */
.screen-splash { align-items: center; justify-content: space-between; padding: calc(96px + var(--safe-top)) 32px calc(40px + var(--safe-bottom)); }
.splash-centre { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; }
.splash-logo { width: 150px; height: 150px; opacity: .92; }
.splash-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 36px; letter-spacing: .5px; }
.splash-tag { color: var(--muted); font-size: 15px; }
.build-label { margin-top: 14px; font-size: 11px; color: #6E7684; }

/* Buttons */
.btn { min-height: 52px; border-radius: 26px; border: none; padding: 0 24px; font-weight: 600; font-size: 15px; }
.btn-primary { background: var(--icon-bg); color: var(--bg); }
.btn-wide { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.ghost { background: none; width: 52px; height: 52px; }
.icon-btn.ghost svg { width: 26px; height: 26px; stroke: var(--text-2); stroke-width: 1.6; }
.icon-spacer { width: 44px; }

/* Top bar and titles */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 32px; height: 32px; border-radius: 8px; }
.brand-name { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-2); }
.chip.small { font-size: 12px; font-weight: 400; padding: 6px 10px; }
.coin { width: 12px; height: 12px; border-radius: 6px; border: 2px solid var(--coin); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.eyebrow.fog { color: var(--fog); }
.screen-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 30px; letter-spacing: -.5px; margin-bottom: 6px; }
.section-label { margin-top: 12px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #8A93A3; }

/* Roam list */
.roam-list { display: flex; flex-direction: column; gap: 10px; }
.roam-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid transparent; text-align: left; width: 100%; }
.roam-card.active { border-color: var(--fog); }
.roam-dot { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.roam-dot i { width: 12px; height: 12px; border-radius: 6px; display: block; }
.roam-text { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; }
.roam-name { font-weight: 600; font-size: 16px; }
.roam-sub { font-size: 13px; color: var(--muted); }
.roam-go { width: 36px; height: 36px; border-radius: 18px; background: var(--fog); display: flex; align-items: center; justify-content: center; }
.roam-go svg { width: 14px; height: 14px; fill: var(--bg); }
.roam-locked { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; border: 1px dashed var(--line); }
.roam-locked .roam-name { font-weight: 400; font-size: 15px; color: var(--text-2); flex-grow: 1; }
.roam-locked .roam-sub { font-size: 13px; }

/* Roam detail */
.roam-hero { position: relative; height: 290px; padding: 20px 24px 20px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.ripples { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--fog); }
.ripples circle:nth-child(1) { stroke-opacity: .7; } .ripples circle:nth-child(2) { stroke-opacity: .4; } .ripples circle:nth-child(3) { stroke-opacity: .22; } .ripples circle:nth-child(4) { stroke-opacity: .12; } .ripples circle:nth-child(5) { stroke-opacity: .06; }
.hero-text { position: relative; display: flex; flex-direction: column; gap: 6px; }
.roam-hero .icon-btn { position: relative; }
.hero-rule { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.story-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.story { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--surface-2); width: 100%; border: 1px solid transparent; text-align: left; }
.story.open { background: var(--surface); border-color: var(--fog); }
.story-num { width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.story.open .story-num { background: var(--fog); border-color: var(--fog); }
.story.open .story-num svg { width: 12px; height: 12px; fill: var(--bg); }
.story-name { flex-grow: 1; font-size: 15px; color: var(--text-2); }
.story.open .story-name { color: var(--text); font-weight: 600; }
.story-meta { font-size: 12px; color: var(--muted); }

/* Player */
.screen-player { background: var(--bg-deep); padding-left: 24px; padding-right: 24px; gap: 20px; }
.player-top { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; }
.player-art { flex-grow: 1; display: flex; align-items: center; justify-content: center; min-height: 220px; }
.pulse { width: min(72vw, 280px); height: auto; fill: none; stroke: var(--fog); }
.pulse circle { transform-origin: 150px 150px; }
.pulse circle:nth-child(1) { stroke-opacity: .8; } .pulse circle:nth-child(2) { stroke-opacity: .45; } .pulse circle:nth-child(3) { stroke-opacity: .25; } .pulse circle:nth-child(4) { stroke-opacity: .13; } .pulse circle:nth-child(5) { stroke-opacity: .06; }
.pulse.playing circle { animation: breathe 8s ease-in-out infinite; }
.pulse.playing circle:nth-child(2) { animation-delay: .4s; } .pulse.playing circle:nth-child(3) { animation-delay: .8s; } .pulse.playing circle:nth-child(4) { animation-delay: 1.2s; } .pulse.playing circle:nth-child(5) { animation-delay: 1.6s; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .pulse.playing circle { animation: none; } }
.player-title { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.player-title h2 { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 24px; }
.player-title p { font-size: 14px; color: var(--muted); }
.progress .bar { height: 4px; border-radius: 2px; background: var(--line-soft); }
.progress .fill { height: 4px; border-radius: 2px; background: var(--fog); width: 0; }
.progress .times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.transport { display: flex; justify-content: center; align-items: center; gap: 36px; }
.play-btn { width: 80px; height: 80px; border-radius: 40px; border: none; background: var(--fog); display: flex; align-items: center; justify-content: center; }
.play-btn svg { width: 26px; height: 26px; fill: var(--bg-deep); }
.play-btn .i-pause { display: none; }
.play-btn.playing .i-play { display: none; }
.play-btn.playing .i-pause { display: block; }
.until { display: flex; flex-direction: column; gap: 10px; }
.until .label { font-size: 12px; color: var(--muted); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1 1 0; min-height: 44px; border-radius: 22px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13px; }
.seg button[aria-pressed="true"] { border-color: var(--fog); background: rgba(184,196,208,.12); color: var(--text); }
.test-card { padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.test-head { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--fog); }
.test-body { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.test-body.ok { color: var(--moss); }
.test-body.bad { color: var(--crimson); }
.test-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

/* Bottom navigation */
.screen.has-nav { padding-bottom: calc(84px + var(--safe-bottom)); }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; justify-content: space-around; padding: 8px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line-soft); background: var(--bg); z-index: 5; }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 72px; min-height: 52px; padding: 6px; border: none; background: none; font-size: 11px; color: var(--muted); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--text); }

/* Shared pieces for journal and rewards */
.screen-body.top { padding-top: calc(40px + var(--safe-top)); gap: 16px; }
.card { padding: 16px; border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.card.dashed { background: none; border: 1px dashed var(--line); gap: 4px; }
.muted-sm { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }
.hint:empty { display: none; }
.btn-light { background: var(--text); color: var(--bg); }
.btn:disabled { opacity: .45; cursor: default; }
.text-btn { align-self: center; min-height: 44px; padding: 0 12px; border: none; background: none; color: #6E7684; font-size: 12px; text-decoration: underline; margin-top: 8px; }

/* Journal */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 10px; }
.field .field-label { margin-bottom: 0; }
textarea { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; resize: vertical; }
textarea:focus { outline: none; border-color: var(--fog); }
textarea::placeholder { color: #6E7684; }
.tags { margin: 0; padding: 0; border: none; min-width: 0; }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.entry { width: 100%; text-align: left; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; display: flex; flex-direction: column; gap: 6px; }
.entry-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.entry-text { font-size: 14px; line-height: 1.5; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.entry[aria-expanded="true"] .entry-text { display: block; }
.entry-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-tags span { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--fog); }

/* Rewards */
.level-card { padding: 20px; border-radius: 18px; gap: 14px; }
.level-row { display: flex; justify-content: space-between; align-items: baseline; }
.level-name { font-family: "Space Grotesk", sans-serif; font-size: 22px; font-weight: 600; }
.xp-bar { height: 6px; border-radius: 3px; background: var(--bg); }
.xp-fill { height: 6px; border-radius: 3px; background: var(--text); width: 0; transition: width .6s ease; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-num { font-family: "Space Grotesk", sans-serif; font-size: 26px; font-weight: 600; }
.coin-text { color: var(--coin); }
.goals { display: flex; flex-direction: column; gap: 10px; }
.goal { display: flex; gap: 14px; align-items: center; padding: 12px 16px; min-height: 56px; border-radius: 14px; background: var(--surface); width: 100%; border: none; text-align: left; }
.goal-mark { width: 26px; height: 26px; border-radius: 13px; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--fog); flex-shrink: 0; }
.goal-mark.part { border-color: var(--fog); }
.goal-mark.done { background: var(--moss); border-color: var(--moss); }
.goal-mark svg { width: 14px; height: 14px; fill: none; stroke: var(--bg); stroke-width: 2.5; }
.goal-text { flex-grow: 1; display: flex; flex-direction: column; gap: 3px; font-size: 15px; }
.goal-text small { font-size: 12px; color: var(--muted); }
.goal-xp { font-size: 13px; color: var(--muted); white-space: nowrap; }
.unlock-name { font-size: 15px; }

/* Quiet reward notice */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 8px); padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .5s ease, transform .5s ease; z-index: 10; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast, .xp-fill { transition: none; } }

/* Settings */
.topbar-right { display: flex; gap: 8px; align-items: center; }
.settings-top { padding: 20px 24px 0; }
.setting { gap: 10px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.setting-name { font-size: 15px; font-weight: 500; }
.setting.is-off .setting-name { color: var(--muted); }
.text-btn.left { align-self: flex-start; margin: 0; padding: 0; color: var(--muted); }
input[type="range"] { width: 100%; height: 44px; accent-color: var(--fog); background: none; }
input[type="range"]:disabled { opacity: .4; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -6px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; border: none; background: var(--line); flex-shrink: 0; padding: 0; }
.switch::before { content: ""; position: absolute; inset: -6px; }   /* 44 px touch target */
.switch span { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 12px; background: var(--muted); transition: transform .25s ease, background .25s ease; }
.switch[aria-checked="true"] { background: rgba(184,196,208,.35); }
.switch[aria-checked="true"] span { transform: translateX(20px); background: var(--text); }
@media (prefers-reduced-motion: reduce) { .switch span { transition: none; } }
body.no-lucid [data-lucid-only] { display: none !important; }
