@font-face { font-family: 'Bricolage'; src: url('/bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Schibsted'; src: url('/schibsted.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Commit Mono'; src: url('/commit-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --accent: #ffb454;
  --accent-rgb: 255, 180, 84;
  --accent-ink: #1c1305;
  --ink-0: #0c0b0a;
  --glass: rgba(22, 20, 18, 0.72);
  --glass-strong: rgba(19, 17, 16, 0.95);
  --glass-soft: rgba(255, 244, 228, 0.045);
  --glass-hover: rgba(255, 244, 228, 0.085);
  --line: rgba(255, 244, 228, 0.085);
  --line-strong: rgba(255, 244, 228, 0.16);
  --text: #f4efe7;
  --text-2: #bdb5a8;
  --text-3: #8f877b;
  --ok: #62d6a0;
  --err: #ff7466;
  --display: 'Bricolage', 'Schibsted', sans-serif;
  --sans: 'Schibsted', -apple-system, system-ui, sans-serif;
  --mono: 'Commit Mono', ui-monospace, monospace;
  --r-card: 22px;
  --r-inner: 13px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 62px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--ink-0); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; color: var(--text); font: 400 16px/1.45 var(--sans); overscroll-behavior-y: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* Målningen ligger still bakom allt, färdigsuddad (ingen levande oskärpa). */
#bg { position: fixed; inset: 0; z-index: -1; background: linear-gradient(rgba(12, 11, 10, 0.55), rgba(12, 11, 10, 0.86)), url('/bakgrund.jpg') center / cover no-repeat var(--ink-0); }

#app { padding: calc(var(--safe-t) + 14px) 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
#app.enter > * { animation: rise 320ms var(--ease-out) both; }
#app.enter > :nth-child(2) { animation-delay: 40ms; }
#app.enter > :nth-child(3) { animation-delay: 80ms; }
#app.enter > :nth-child(4) { animation-delay: 120ms; }
#app.enter > :nth-child(n + 5) { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 6px 4px 2px; }
.top h1 { font: 600 30px/1.05 var(--display); letter-spacing: -0.02em; }
.top .sub { font: 400 12px/1.3 var(--mono); color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px rgba(98, 214, 160, 0.6); }
.round { width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2); flex: none; transition: transform 140ms var(--ease-out), background-color 140ms; }
.round:active, .btn:active, .chip:active, .tile:active { transform: scale(0.96); }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; box-shadow: 0 1px 0 rgba(255, 244, 228, 0.06) inset, 0 24px 48px -28px rgba(0, 0, 0, 0.75); }
.card > h2 { font: 500 11px/1 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.card > h2 span { color: var(--text-3); letter-spacing: 0; text-transform: none; }
.lead { font: 500 19px/1.35 var(--display); letter-spacing: -0.01em; text-wrap: pretty; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.err { color: var(--err); }

.list { display: flex; flex-direction: column; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); min-height: 44px; }
.row:first-child { border-top: 0; padding-top: 2px; }
.row:last-child { padding-bottom: 2px; }
.row .grow { flex: 1; min-width: 0; }
.row .t { overflow-wrap: anywhere; }
.row .s { color: var(--text-3); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.row .r { font: 400 13px var(--mono); color: var(--text-2); white-space: nowrap; text-align: right; padding-top: 2px; }
.row .r.up { color: var(--ok); }
.row .r.down { color: var(--err); }
.row.done .t { color: var(--text-3); text-decoration: line-through; }
.row.tap { width: 100%; text-align: left; }
.check { width: 26px; height: 26px; margin: -1px 0 0 -1px; border-radius: 50%; border: 1.6px solid var(--line-strong); flex: none; display: grid; place-items: center; color: transparent; transition: background-color 160ms, border-color 160ms, transform 140ms var(--ease-out); position: relative; }
.check::after { content: ''; position: absolute; inset: -10px; }
.check:active { transform: scale(0.9); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check svg { width: 15px; height: 15px; stroke-width: 2.4; }
.tag { font: 400 11px/1 var(--mono); color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; white-space: nowrap; }
.tag.hot { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.4); }
.empty { color: var(--text-3); font-size: 14px; padding: 4px 0; }

.composer { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--glass-soft); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; transition: transform 140ms var(--ease-out), background-color 140ms, color 140ms; }
.chip.on { background: rgba(var(--accent-rgb), 0.16); border-color: rgba(var(--accent-rgb), 0.45); color: var(--accent); }
.field { display: flex; gap: 8px; align-items: flex-end; }
textarea, input[type='text'], input[type='search'] { width: 100%; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: var(--r-inner); padding: 12px 14px; outline: none; font-size: 16px; resize: none; min-height: 46px; }
textarea:focus, input:focus { border-color: rgba(var(--accent-rgb), 0.55); }
::placeholder { color: var(--text-3); }
.btn { min-height: 46px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; transition: transform 140ms var(--ease-out), opacity 140ms; flex: none; }
.btn.quiet { background: var(--glass-soft); border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.btn[disabled] { opacity: 0.45; }
.btn.send { width: 46px; padding: 0; display: grid; place-items: center; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { text-align: left; background: var(--glass-soft); border: 1px solid var(--line); border-radius: var(--r-inner); padding: 13px 14px; min-height: 64px; display: flex; flex-direction: column; gap: 3px; transition: transform 140ms var(--ease-out), background-color 140ms; }
.tile b { font: 600 16px var(--display); }
.tile span { color: var(--text-3); font-size: 12.5px; }
.tile.wide { grid-column: 1 / -1; }
.answer { border-color: rgba(var(--accent-rgb), 0.3); }
.answer .lead { margin-bottom: 4px; }
.wait { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); }
.wait i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.7); } }

.big { font: 600 34px/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.kv div span { display: block; color: var(--text-3); font-size: 12.5px; margin-bottom: 4px; }
.kv div b { font: 600 20px var(--display); font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 84px; margin-top: 6px; }
.bars div { flex: 1; background: rgba(var(--accent-rgb), 0.55); border-radius: 4px 4px 1px 1px; min-height: 2px; }
.bars div:last-child { background: var(--accent); }
.axis { display: flex; justify-content: space-between; font: 400 11px var(--mono); color: var(--text-3); margin-top: 6px; }

.day { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 62px 1fr; gap: 10px; }
.day:first-of-type { border-top: 0; }
.day .d { font: 400 12px/1.4 var(--mono); color: var(--text-3); text-transform: uppercase; }
.day.today .d { color: var(--accent); }
.ev { padding: 2px 0 6px; }
.ev .when { font: 400 12.5px var(--mono); color: var(--text-2); }

.note h1, .note h2, .note h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 18px 0 6px; line-height: 1.2; }
.note h1 { font-size: 24px; margin-top: 4px; }
.note h2 { font-size: 19px; }
.note h3 { font-size: 16px; }
.note p { margin: 8px 0; overflow-wrap: anywhere; }
.note li { margin: 4px 0 4px 20px; overflow-wrap: anywhere; }
.note code, .note pre { font: 400 13px var(--mono); background: rgba(0, 0, 0, 0.3); border-radius: 6px; padding: 1px 5px; }
.note pre { padding: 10px 12px; overflow-x: auto; white-space: pre; }
.note .meta { color: var(--text-3); font: 400 12px var(--mono); white-space: pre-wrap; }
.note a, .link { color: var(--accent); text-decoration: none; }
.note hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.editor { min-height: 52dvh; font: 400 15px/1.5 var(--mono); }
.folder { font: 500 12px var(--mono); color: var(--text-3); padding: 14px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.path { font: 400 12px var(--mono); color: var(--text-3); overflow-wrap: anywhere; }

#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 8px 4px calc(var(--safe-b) + 8px); background: #121110; border-top: 1px solid var(--line); display: flex; justify-content: space-around; }
#nav button { flex: 1; max-width: 96px; min-height: 46px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-3); font-size: 10.5px; border-radius: 14px; padding: 5px 0 3px; transition: color 140ms, background-color 140ms; }
#nav button[aria-current='page'] { color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 26px); transform: translate(-50%, 12px); background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 999px; padding: 10px 16px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 180ms, transform 220ms var(--ease-out); max-width: calc(100vw - 32px); z-index: 9; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.login { min-height: 82dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 0 6px; }
.login h1 { font: 600 40px/1 var(--display); letter-spacing: -0.03em; }
.login .code { font: 400 26px var(--mono); letter-spacing: 0.28em; text-align: center; text-transform: uppercase; padding: 16px 10px 16px 18px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.switch:first-of-type { border-top: 0; }
.toggle { width: 52px; height: 32px; border-radius: 999px; background: var(--glass-hover); border: 1px solid var(--line-strong); position: relative; flex: none; transition: background-color 180ms; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text-2); transition: transform 200ms var(--ease-out), background-color 180ms; }
.toggle[aria-checked='true'] { background: rgba(var(--accent-rgb), 0.35); border-color: rgba(var(--accent-rgb), 0.6); }
.toggle[aria-checked='true']::after { transform: translateX(20px); background: var(--accent); }
.toggle[disabled] { opacity: 0.4; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
