@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
:root {
  --bg: #f3f4f6; --panel: #ffffff; --text: #111318; --muted: #666c78; --line: #e2e4e9;
  --accent: #2f54eb; --on-accent: #ffffff; --accent-soft: #e8edff; --danger: #c62828; --shadow: 0 10px 30px rgba(17,19,24,.14);
  --ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ed-font: var(--ui);
  --ed-size: 17px;
  --app-h: 100dvh;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1013; --panel: #16191e; --text: #eceef2; --muted: #969ca8; --line: #272b33; --accent: #7d97ff; --on-accent: #0e1013; --accent-soft: #1b2340; --danger: #ff8a80; --shadow: 0 10px 30px rgba(0,0,0,.5); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { font: 16px/1.45 var(--ui); -webkit-font-smoothing: antialiased; position: fixed; inset: 0; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
svg .t { font: 600 6px sans-serif; fill: currentColor; stroke: none; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.spacer { flex: 1; }

#app { position: fixed; left: 0; right: 0; top: 0; height: var(--app-h); overflow: hidden; }
#track { display: flex; width: 300%; height: 100%; transform: translate3d(-33.3333%,0,0); will-change: transform; }
#track.anim { transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.screen { position: relative; width: 33.3333%; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.bar { display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; min-height: calc(env(safe-area-inset-top) + 52px); flex: none; transition: opacity .4s; }
.bar h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 0 8px; }
.bar.typing { opacity: .18; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--accent); }
.text { display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px; color: var(--accent); font-size: 17px; }
.text svg { width: 20px; height: 20px; stroke-width: 2.2; }
#count { font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 4px; }

.scroller { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }

/* Search */
.searchbar { display: none; gap: 8px; padding: 0 16px 10px; align-items: center; }
.searchbar.on { display: flex; }
.searchbar input { flex: 1; height: 38px; border-radius: 11px; border: 0; padding: 0 12px; font-size: 17px; background: var(--line); color: var(--text); outline: none; -webkit-appearance: none; }
#pull { height: 0; overflow: hidden; text-align: center; color: var(--muted); font-size: 13px; line-height: 40px; }

/* List */
#list { list-style: none; margin: 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 96px); }
#list li { padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
#list li:active { background: var(--accent-soft); }
#list .t { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#list .s { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
#list .s b { font-weight: 400; color: var(--text); opacity: .7; margin-right: 8px; }
#list mark { background: var(--accent-soft); color: inherit; border-radius: 3px; }
#list .sec { list-style: none; border: 0; padding: 18px 4px 6px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: default; }
#empty { color: var(--muted); text-align: center; padding: 60px 30px; font-size: 16px; }
.fab { position: absolute; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 28px); width: 58px; height: 58px; border-radius: 29px; background: var(--accent); color: var(--bg); display: grid; place-items: center; box-shadow: var(--shadow); }
.fab svg { width: 28px; height: 28px; stroke-width: 2.4; }

/* Editor */
#ed { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; display: block; border: 0; outline: none; resize: none; background: transparent; color: var(--text); caret-color: var(--accent);
  font-family: var(--ed-font); font-size: var(--ed-size); line-height: 1.6; padding: 6px 22px calc(env(safe-area-inset-bottom) + 120px); -webkit-text-size-adjust: 100%; tab-size: 4; }
#ed::placeholder { color: var(--muted); opacity: .7; }
.fmt { display: none; align-items: center; gap: 2px; padding: 4px 8px calc(env(safe-area-inset-bottom) + 4px); border-top: 1px solid var(--line); background: var(--panel); flex: none; overflow-x: auto; }
.fmt.on { display: flex; }
.fmt button { min-width: 42px; height: 40px; border-radius: 8px; font-size: 17px; display: grid; place-items: center; color: var(--text); }
.fmt button:active { background: var(--accent-soft); }
.fmt .done { color: var(--accent); font-weight: 600; padding: 0 10px; }
body.font-system { --ed-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body.font-serif { --ed-font: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif; }
body.font-mono { --ed-font: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace; }

/* Document panel */
.doc { max-width: 640px; margin: 0 auto; padding: 0 20px calc(env(safe-area-inset-bottom) + 60px); }
.doc h2 { font-size: 26px; letter-spacing: -.01em; margin: 4px 0 14px; overflow-wrap: anywhere; }
.doc h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--panel); border-radius: 12px; padding: 12px; }
.stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 13px; }
.exports { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.exports button { background: var(--panel); border-radius: 14px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); }
.exports button:active { background: var(--accent-soft); }
.exports .ext { font-weight: 700; font-size: 18px; color: var(--accent); }
.exports .what { font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.ghost { color: var(--accent); padding: 8px 0; }
.toggle { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.preview { background: var(--panel); border-radius: 14px; padding: 18px 20px; font-family: var(--ed-font); font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); }
.preview > :first-child { margin-top: 0; } .preview p { margin: 0 0 .5em; }
.preview h1 { font-size: 1.5em; margin: .6em 0 .3em; } .preview h2 { font-size: 1.25em; margin: .6em 0 .3em; } .preview h3 { font-size: 1.05em; margin: .6em 0 .3em; }
.preview blockquote { margin: 0 0 .5em; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.preview ul, .preview ol { margin: 0 0 .5em; padding-left: 1.4em; }
.preview ul.check { list-style: none; padding-left: .2em; }
.preview .box { display: inline-grid; place-items: center; width: 1em; height: 1em; border: 1.5px solid var(--muted); border-radius: 4px; margin-right: 8px; font-size: .8em; vertical-align: -1px; }
.preview li.done { color: var(--muted); text-decoration: line-through; }
.preview .gap { height: .4em; } .preview hr { border: 0; border-top: 1px solid var(--line); width: 30%; margin: 1em auto; }
.preview .empty { color: var(--muted); }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.info dt { color: var(--muted); } .info dd { margin: 0; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; background: var(--line); border-radius: 10px; padding: 2px; margin: 0 8px 8px 0; }
.seg button { padding: 6px 14px; border-radius: 8px; font-size: 15px; }
.seg button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#size-seg button:nth-child(1) { font-size: 13px; } #size-seg button:nth-child(3) { font-size: 18px; } #size-seg button:nth-child(4) { font-size: 21px; }
.danger { display: block; margin: 36px 0 0; color: var(--danger); padding: 10px 0; }

/* Page dots */
.dots { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 8px); display: flex; gap: 6px; pointer-events: none; transition: opacity .3s; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--muted); opacity: .35; transition: all .3s; }
.dots i.on { opacity: .9; width: 16px; }
body.editing .dots { opacity: 0; }

/* Sheet, toast */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--panel); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 14px); animation: up .25s ease-out; }
.sheet-card button { display: block; width: 100%; text-align: left; padding: 15px 2px; border-bottom: 1px solid var(--line); font-size: 17px; }
.sheet-card .cancel { border: 0; text-align: center; color: var(--accent); font-weight: 600; }
@keyframes up { from { transform: translateY(100%); } }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); border-radius: 12px; padding: 11px 16px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 20; display: flex; gap: 16px; align-items: center; max-width: 90vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent); font-weight: 600; filter: brightness(1.3); }
@media (prefers-reduced-motion: reduce) { #track.anim { transition-duration: .01s; } }
body[data-screen=doc] .dots { opacity: 0; }
.sheet-card.intro { padding-top: 22px; }
.sheet-card.intro h2 { font-size: 21px; margin: 0 0 8px; }
.sheet-card.intro p { margin: 0 0 14px; line-height: 1.45; color: var(--muted, inherit); }
.sheet-card .primary { text-align: center; background: var(--accent); color: var(--panel); border: 0; border-radius: 12px; font-weight: 600; margin: 6px 0; }
.sheet-card .where { margin: 8px 0 2px; font-weight: 600; }
.sheet-card [hidden] { display: none; }

/* Sponsor placements */
.sponsor a { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
.sponsor .sp-mark { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sponsor .sp-text { font-size: 16px; line-height: 1.35; }
.sponsor img { display: block; width: 100%; height: auto; border-radius: 10px; }
#list li.sponsor { padding: 12px 4px; cursor: default; }
#list li.sponsor:active { background: none; }
#sponsor-export .sponsor { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }

/* The look: a web app. White working surfaces on a cool grey ground, one blue, its own typeface, 10px corners. */
.bar { background: var(--panel); border-bottom: 1px solid var(--line); gap: 6px; padding-left: 16px; padding-right: 12px; }
.bar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: 8px; }
.bar h1::before { content: ""; width: 10px; height: 18px; border-radius: 2px; background: var(--accent); }
.icon { width: 40px; height: 40px; border-radius: 10px; color: var(--text); }
.icon:active, .text:active { background: var(--bg); }
.text { font-size: 15px; font-weight: 600; border-radius: 10px; padding: 0 10px; height: 38px; }
.text svg { width: 16px; height: 16px; }
.new { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 10px; margin-left: 4px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; }
.new svg { width: 18px; height: 18px; stroke-width: 2.4; }
#s-edit, #s-edit .bar { background: var(--panel); } #s-edit .bar { border-bottom: 0; }
#count { font-weight: 500; margin-right: 6px; }
.searchbar { background: var(--panel); padding-top: 10px; border-bottom: 1px solid var(--line); }
.searchbar input { border-radius: 10px; background: var(--bg); font-family: inherit; font-size: 16px; }
#list { padding: 0 12px calc(env(safe-area-inset-bottom) + 40px); }
#list li { background: var(--panel); border: 1px solid var(--line); border-bottom: 0; padding: 13px 14px; }
#list .sec { background: none; border: 0; padding: 20px 4px 8px; font-size: 13px; font-weight: 600; }
#list .sec + li { border-radius: 10px 10px 0 0; }
#list li:not(.sec):has(+ .sec), #list li:last-child { border-bottom: 1px solid var(--line); border-radius: 0 0 10px 10px; }
#list .sec + li:has(+ .sec), #list .sec + li:last-child { border-radius: 10px; }
#list .t { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
#list .s { font-size: 14px; margin-top: 3px; }
#list .s b { float: right; margin-left: 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); opacity: 1; font-variant-numeric: tabular-nums; }
#list li.sponsor { padding: 12px 14px; background: var(--accent-soft); }
#empty { font-size: 15px; }
#ed { line-height: 1.65; }
.fmt button { border-radius: 8px; }
.doc { padding-top: 14px; }
.doc h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.doc h3 { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); margin-top: 26px; }
.stats { gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stats div { border-radius: 0; padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div:nth-child(3n) { border-right: 0; } .stats div:nth-last-child(-n+3) { border-bottom: 0; }
.stats b { font-size: 20px; letter-spacing: -.01em; }
.exports button { border-radius: 10px; padding: 13px 14px; }
.exports .ext { font-size: 15px; letter-spacing: .02em; }
.ghost { font-weight: 600; }
.preview, #sponsor-export .sponsor { border-radius: 10px; }
#sponsor-export .sponsor { background: var(--accent-soft); border-color: transparent; }
.seg { border-radius: 10px; } .seg button { border-radius: 8px; font-size: 14px; font-weight: 500; }
.sheet-card { border-radius: 16px 16px 0 0; }
.sheet-card.intro h2 { letter-spacing: -.02em; }
.sheet-card .primary { border-radius: 10px; color: var(--on-accent); }
.toast { border-radius: 10px; } .toast button { color: #9db1ff; filter: none; }
.sponsor .sp-mark { color: var(--accent); letter-spacing: .04em; }
.sponsor .sp-text { font-size: 15px; font-weight: 500; }
.dots i.on { background: var(--accent); }
