/* IM FELL English (Igino Marini, SIL OFL 1.1, fonts/OFL.txt): the letterforms of period engraved maps. */
@font-face { font-family: "IM Fell"; src: url("fonts/IMFeENrm28P.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IM Fell"; font-style: italic; src: url("fonts/IMFeENit28P.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IM Fell SC"; src: url("fonts/IMFeENsc28P.ttf") format("truetype"); font-display: swap; }

/* Hewn — web. Tokens mirror App/Sources/DesignSystem/Theme.swift. Dark is the primary identity. */
:root {
  color-scheme: light;
  --bg: #EEE8DC; --surface: #E4DCCD; --surface-high: #D9D0BF;
  --ink: #1D1A1C; --ink2: #5E574F; --ink-faint: #6C645B;
  --line: #81786D; --line-strong: #6F685F;
  --burgundy: #6E2433; --plum: #CDB6C1; --crimson: #A3162E;
  --sel: rgba(205, 182, 193, .45); --nb: rgba(205, 182, 193, .25);
  --t0: #B7D4C9; --t1: #ADC9B3; --t2: #B7C5A4; --t3: #D0C49A; --t4: #D6BD89; --t5: #D8B77E; --t6: #CEAB7D;
  --t7: #BEA089; --t8: #AD978C; --t9: #A29B99; --t10: #B7B4AC; --t11: #D9D4C7; --t12: #F2EEE1;
  --tink: #211D1B; --tink-high: #211D1B;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111012; --surface: #1B191D; --surface-high: #252229;
    --ink: #E8E0D2; --ink2: #A1988A; --ink-faint: #6B655F;
    --line: #3C393F; --line-strong: #6D6872;
    --burgundy: #A5485A; --plum: #2C1D2B; --crimson: #D8435A;
    --sel: rgba(44, 29, 43, .85); --nb: rgba(44, 29, 43, .38);
    --t0: #244B48; --t1: #305147; --t2: #3D5547; --t3: #62533A; --t4: #71583B; --t5: #76583B; --t6: #705346;
    --t7: #574741; --t8: #4C4648; --t9: #4A4B50; --t10: #64625E; --t11: #B8B1A1; --t12: #E5DFD1;
    --tink: #F7F1E7; --tink-high: #211D1B;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111012; --surface: #1B191D; --surface-high: #252229;
  --ink: #E8E0D2; --ink2: #A1988A; --ink-faint: #6B655F;
  --line: #3C393F; --line-strong: #6D6872;
  --burgundy: #A5485A; --plum: #2C1D2B; --crimson: #D8435A;
  --sel: rgba(44, 29, 43, .85); --nb: rgba(44, 29, 43, .38);
  --t0: #244B48; --t1: #305147; --t2: #3D5547; --t3: #62533A; --t4: #71583B; --t5: #76583B; --t6: #705346;
  --t7: #574741; --t8: #4C4648; --t9: #4A4B50; --t10: #64625E; --t11: #B8B1A1; --t12: #E5DFD1;
  --tink: #F7F1E7; --tink-high: #211D1B;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--serif); font-size: 17px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }
h1, h2, h3 { font-weight: 400; margin: 0; }

#app { max-width: 520px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; }

.caps { font-variant: small-caps; letter-spacing: .06em; text-transform: lowercase; font-size: 15px; }
.muted { color: var(--ink2); }
.accent { color: var(--burgundy); }
.warn { color: var(--crimson); }
.digits { font-variant-numeric: tabular-nums; }

/* ornament */
.rule { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: scaleY(.5); }
.rule i { width: 5px; height: 5px; background: var(--line-strong); transform: rotate(45deg); }

/* home */
.masthead { padding-top: 18px; margin-bottom: 22px; }
.masthead h1 { font-size: 44px; line-height: 1.1; }
.masthead p { color: var(--ink2); margin: 8px 0 0; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.card { display: block; width: 100%; text-align: left; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; transition: opacity .12s; }
.card:active { opacity: .6; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card h2 { font-size: 21px; margin: 6px 0; }
.pill { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bg); background: var(--ink); padding: 8px 16px; border-radius: 3px; }
.section-title { margin-bottom: 8px; }
.list { border-top: 1px solid var(--line); }
.list button { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); min-height: 52px; text-align: left; }
.list button:active { opacity: .6; }
.list .sub { font-size: 14px; color: var(--ink2); }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; padding: 8px 0 4px; }
.footer-links button { color: var(--ink2); font-size: 15px; min-height: 44px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 6px; gap: 8px; }
.topbar .title { flex: 1; text-align: center; }
.topbar .title .caps { color: var(--burgundy); display: block; font-size: 13px; }
.back { width: 44px; height: 44px; display: grid; place-items: center; }
.icon-btn { min-width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink2); }
.timer { font-family: var(--serif); font-variant-numeric: tabular-nums; color: var(--ink2); min-width: 44px; text-align: right; }

/* board */
.board-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.board { position: relative; display: grid; border: 1px solid var(--line-strong); touch-action: none; user-select: none; -webkit-user-select: none; width: min(100%, 60dvh, 488px); aspect-ratio: var(--aspect); }
.cell { position: relative; border-right: .5px solid var(--line); border-bottom: .5px solid var(--line); display: grid; place-items: center; overflow: hidden; container-type: size; }
.cell.last-col { border-right: 0; }
.cell.last-row { border-bottom: 0; }
.cell.nb::before, .cell.sel::before { content: ""; position: absolute; inset: 0; background: var(--nb); }
.cell.sel::before { background: var(--sel); }
.cell.sel::after { content: ""; position: absolute; inset: 0; border: 1.5px solid var(--burgundy); }
.cell .v { position: relative; font-size: 42cqh; line-height: 1; font-variant-numeric: tabular-nums; color: var(--tink); }
.cell .v.given { font-weight: 600; text-decoration: underline; text-decoration-color: var(--ink-faint); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cell .v.dim { opacity: .4; }
.cell .notes { position: relative; font-size: 24cqh; color: var(--ink2); text-align: center; line-height: 1.05; padding: 8%; word-spacing: .15em; }
.cell .mk { position: absolute; left: 50%; width: 28%; max-width: 17px; transform: translateX(-50%); }
.cell .mk.up { top: 6%; }
.cell .mk.down { bottom: 6%; }
.cell .mk svg { display: block; width: 100%; height: auto; }
.cell .conflict { position: absolute; inset: 2.5px; border: 1.6px dashed var(--crimson); pointer-events: none; }
.cell .hint { position: absolute; inset: 2px; border: 2px solid var(--burgundy); pointer-events: none; }
.board.small { width: min(100%, calc(200px * var(--ar))); }
.board .overlay { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.contours path { stroke: var(--ink); stroke-opacity: .75; stroke-width: 1.1; fill: none; stroke-linecap: round; }
.contours.animate path { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: engrave 1.4s ease-in-out forwards; }
@keyframes engrave { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .contours.animate path { animation: none; stroke-dashoffset: 0; } }
.edges path { stroke: var(--ink2); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* tray */
.tray { min-height: var(--tray-h, 150px); }
.tray .caption { font-size: 15px; color: var(--ink2); min-height: 36px; display: flex; align-items: center; }
.tray .caption.warn { color: var(--crimson); }
.tray-head { display: flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 8px; }
.tray-head .text { flex: 1; font-size: 15px; color: var(--ink2); }
.tray-head .text.warn { color: var(--crimson); }
.small-btn { font-size: 14px; color: var(--ink2); border: 1px solid var(--line); border-radius: 3px; padding: 0 10px; min-height: 36px; white-space: nowrap; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.keys.few { grid-template-columns: repeat(auto-fill, 54px); }
.key { min-height: 46px; background: var(--surface-high); border: 1px solid var(--line); border-radius: 4px; font-size: 24px; font-variant-numeric: tabular-nums; }
.key:active { filter: brightness(.88); }
.key.current { background: var(--ink); color: var(--bg); }
.key.note { background: var(--plum); border-color: var(--burgundy); border-width: 1.2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ink2); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 11px; }

.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border: 1px solid var(--line); border-radius: 3px; }
.action svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.action span { font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; }
.action.active { color: var(--burgundy); background: var(--plum); border-color: var(--burgundy); }
.action:active:not(:disabled) { filter: brightness(.88); }

/* hint panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; margin-bottom: 12px; }
.panel p { margin: 6px 0 10px; }
.panel .btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* completion */
.done h2 { font-size: 26px; margin: 2px 0 4px; }
.done .stats { display: flex; gap: 18px; color: var(--ink2); margin: 8px 0 14px; }
.btn { min-height: 48px; padding: 0 18px; border-radius: 3px; border: 1px solid var(--line); font-size: 17px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* loading */
.loading { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink2); }
.loading .spin { width: 28px; height: 28px; margin: 0 auto 12px; border: 1.5px solid var(--line); border-top-color: var(--burgundy); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 12px; text-align: center; }
.stat b { display: block; font-weight: 400; font-size: 28px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink2); font-size: 13px; }
table.per { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.per th { font-weight: 400; color: var(--ink2); text-align: right; font-size: 14px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.per td { text-align: right; padding: 10px 4px; border-bottom: 1px solid var(--line); }
table.per th:first-child, table.per td:first-child { text-align: left; }

/* calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 13px; color: var(--ink2); padding-bottom: 4px; }
.cal button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; position: relative; }
.cal button.today { border-color: var(--burgundy); border-width: 1.5px; }
.cal button.solved { background: var(--ink); color: var(--bg); }
.cal button.started::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--burgundy); }
.cal button small { font-size: 10px; opacity: .7; font-family: var(--sans); }

/* settings & tutorial */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.setting .sub { display: block; font-size: 14px; color: var(--ink2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { padding: 0 12px; min-height: 36px; font-size: 14px; }
.seg button.on { background: var(--ink); color: var(--bg); }
.toggle { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-high); border: 1px solid var(--line); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink2); transition: left .15s; }
.toggle[aria-checked="true"] { background: var(--burgundy); border-color: var(--burgundy); }
.toggle[aria-checked="true"]::after { left: 23px; background: var(--bg); }
.tut-title { font-size: 28px; margin: 4px 0 8px; }
.tut-text { color: var(--ink2); margin: 0 0 12px; min-height: 4.2em; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 4px; font-size: 15px; z-index: 10; }
.spacer { flex: 1; }
.prose p { margin: 0 0 12px; }
.prose ol { padding-left: 22px; margin: 0 0 12px; }

/* support link */
.kofi { color: var(--ink2); font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.kofi.accent { color: var(--burgundy); min-height: 0; }
.kofi.small-btn { text-decoration: none; font-size: 14px; min-height: 36px; }
.support { font-size: 15px; margin: 14px 0 0; }


/* ───────── Visual identity (docs/VISUAL_IDENTITY.md): a surveyor's engraved plate ───────── */
:root { --display: "IM Fell", var(--serif); --sc: "IM Fell SC", var(--serif); }

/* display type: titles, plate names, cartouches */
h1, h2, .tut-title, .topbar .title, .done h2, .cal-head h2 { font-family: var(--display); font-weight: 400; }
.masthead h1 { font-size: 52px; letter-spacing: .01em; }
.topbar .title { font-size: 19px; }
/* engraved small caps for every label; colour is ink, burgundy is kept for marks and selection */
.caps { font-family: var(--sc); font-variant: normal; text-transform: none; letter-spacing: .05em; font-size: 15px; color: var(--ink2); }
.topbar .title .caps { color: var(--ink2); font-size: 13px; }
.action span { font-family: var(--sc); text-transform: none; font-weight: 400; font-size: 12.5px; letter-spacing: .04em; }
.pill { font-family: var(--sc); text-transform: none; font-weight: 400; font-size: 15px; letter-spacing: .05em; }
.cell .notes { font-family: var(--display); font-style: italic; }
table.per th, .cal .dow, .list .sub, .setting .sub, .stat small { font-family: var(--sc); }

/* paper: a faint, fixed fibre grain over the page (never under the board digits) */
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#app { position: relative; z-index: 1; }

/* the ornament: hairline · contour flourish · hairline */
.rule i { display: none; }
.rule svg { flex: none; }
.rule svg path { fill: none; stroke: var(--line-strong); stroke-width: .9; stroke-linecap: round; }

/* masthead: today's mapped contours engraved faintly behind the title */
.masthead { position: relative; }
.mast-contours { position: absolute; right: 0; top: 10px; width: 150px; height: 70px; pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, #000 35%, transparent); mask-image: linear-gradient(to left, #000 35%, transparent); }
.mast-contours path { fill: none; stroke: var(--ink); stroke-opacity: .16; stroke-width: .8; stroke-linecap: round; }

/* the board as a plate: plate-mark, margins with letters and numbers, double neatline with graticule ticks */
.board-wrap { margin: 2px 0 10px; }
.plate { position: relative; display: grid; grid-template-columns: 16px auto; grid-template-rows: 16px auto; padding: 4px 14px 12px 2px;
  border: .6px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: inset .6px .6px 0 color-mix(in srgb, var(--bg) 40%, white 20%); }
.plate .margin { display: grid; font-family: var(--sc); font-size: 11px; color: var(--ink2); place-items: center; }
.plate .margin.top { grid-column: 2; grid-row: 1; grid-template-columns: repeat(var(--cols), 1fr); padding-bottom: 5px; }
.plate .margin.left { font-family: var(--serif); font-size: 10px; font-variant-numeric: lining-nums tabular-nums; grid-column: 1; grid-row: 2; grid-template-rows: repeat(var(--rows), 1fr); padding-right: 5px; }
.plate .board { grid-column: 2; grid-row: 2; width: min(calc(100vw - 72px), 60dvh, 448px); outline: 1.2px solid var(--ink); outline-offset: 3.5px; }
.plate.small .board { width: min(calc(100vw - 72px), calc(200px * var(--ar))); }
.plate .board::before { content: ""; position: absolute; inset: -5px; pointer-events: none; z-index: 2;
  background:
    repeating-linear-gradient(to right, var(--ink) 0 .7px, transparent .7px calc((100% - 10px) / var(--cols))) 5px 0 / calc(100% - 10px) 3px no-repeat,
    repeating-linear-gradient(to right, var(--ink) 0 .7px, transparent .7px calc((100% - 10px) / var(--cols))) 5px 100% / calc(100% - 10px) 3px no-repeat,
    repeating-linear-gradient(to bottom, var(--ink) 0 .7px, transparent .7px calc((100% - 10px) / var(--rows))) 0 5px / 3px calc(100% - 10px) no-repeat,
    repeating-linear-gradient(to bottom, var(--ink) 0 .7px, transparent .7px calc((100% - 10px) / var(--rows))) 100% 5px / 3px calc(100% - 10px) no-repeat; }
.plate .north { position: absolute; right: 4px; top: 2px; display: flex; flex-direction: column; align-items: center; font-size: 8px; line-height: 1; color: var(--ink); }
.plate .north small { font-family: var(--sc); font-size: 9px; }

/* state by engraver's hatching, not a colour wash */
.cell.nb::before { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--ink2) 34%, transparent) 0 .7px, transparent .7px 5px); }
.cell .hint { border-width: 1.5px; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--burgundy) 30%, transparent) 0 .7px, transparent .7px 4px),
  repeating-linear-gradient(45deg, color-mix(in srgb, var(--burgundy) 30%, transparent) 0 .7px, transparent .7px 4px); }

/* one motion grammar: things are inked in; nothing bounces */
@keyframes ink-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.cell .v.fresh { animation: ink-in .22s ease-out; }
.card, .list button, .btn, .action, .key { transition: opacity .08s ease-out, filter .08s ease-out; }
@media (prefers-reduced-motion: reduce) { .cell .v.fresh { animation: none; } }

/* the loading mark: contour rings drawn on in turn around a summit */
.loader ellipse { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1; animation: engrave-ring 1.6s ease-in-out infinite alternate; }
.loader .summit { fill: var(--burgundy); }
@keyframes engrave-ring { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .loader ellipse { animation: none; stroke-dashoffset: 0; } }
.loading .spin { display: none; }

/* the completion title in a cartouche: ruled box, chamfered corners, inner hairline */
.cartouche { position: relative; text-align: center; padding: 12px 18px 10px; margin-bottom: 4px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) top / 100% .9px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) bottom / 100% .9px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) left / .9px 100% no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) right / .9px 100% no-repeat; }
.cartouche::after { content: ""; position: absolute; inset: 4px; border: .5px solid var(--line); pointer-events: none; }
.done h2 { font-size: 30px; margin: 2px 0 0; }
.done .stats { justify-content: center; }

/* Settings: the surveyor's instruments */
.set-head { margin: 4px 0 18px; }
.set-head h2 { font-size: 30px; }
.set-head p { margin: 4px 0 0; color: var(--ink2); font-family: var(--display); font-style: italic; font-size: 17px; }
.set-plate { margin-bottom: 20px; }
.set-plate > .caps { margin-bottom: 8px; }
.set-body { padding: 4px 16px; background: color-mix(in srgb, var(--surface) 55%, transparent); border: .5px solid var(--line);
  outline: .5px solid color-mix(in srgb, var(--line) 60%, transparent); outline-offset: -4px; }
.set-body .setting:last-child { border-bottom: 0; }
.set-note { font-size: 14px; color: var(--ink2); margin: 10px 0 12px; }
.keys-help { font-family: var(--sc); letter-spacing: .03em; }
.eng-toggle { position: relative; flex: none; width: 50px; height: 26px; border: .9px solid var(--line-strong); border-radius: 2px; background: var(--bg); transition: border-color .22s ease-out; }
.eng-toggle .lancet { position: absolute; top: 6px; left: 6px; width: 13px; transition: left .22s ease-out; }
.eng-toggle .lancet path { fill: none; stroke: var(--ink2); stroke-width: 1.4; }
.eng-toggle.on { border-color: var(--burgundy);
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--burgundy) 45%, transparent) 0 .6px, transparent .6px 3.5px), var(--bg); }
.eng-toggle.on .lancet { left: 29px; }
.eng-toggle.on .lancet path { fill: var(--burgundy); stroke: var(--burgundy); }
.eng-tabs { display: inline-flex; gap: 14px; }
.eng-tabs button { font-family: var(--sc); font-size: 15px; letter-spacing: .05em; color: var(--ink-faint); min-height: 40px; padding: 0 0 4px;
  border-bottom: 3px double transparent; }
.eng-tabs button.on { color: var(--ink); border-bottom-color: var(--burgundy); }
.colophon { text-align: center; margin: 28px 0 8px; }
.colophon h2 { font-size: 22px; margin-top: 10px; }
.colophon p { font-family: var(--display); font-style: italic; color: var(--ink-faint); font-size: 14px; margin: 6px 0 0; }

/* Home: the daily plate (Figma: Redesign → Home) */
.masthead { padding-top: 10px; margin-bottom: 18px; }
.masthead .tagline { font-family: var(--display); font-style: italic; font-size: 16px; color: var(--ink2); margin: 2px 0 0; }
.dateline { display: flex; justify-content: space-between; margin-top: 10px; padding: 7px 0; border-top: .8px solid var(--line-strong); border-bottom: .8px solid var(--line-strong); }
.stack.home { gap: 18px; padding-bottom: 76px; }
.daily-plate { background: var(--surface); border: 1px solid var(--line-strong); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.plate-body { display: flex; gap: 16px; align-items: center; }
.marks-preview { width: 112px; height: 112px; flex: none; }
.marks-preview .bg { fill: var(--bg); }
.marks-preview .grat { fill: none; stroke: var(--line); stroke-width: .03; }
.marks-preview .frame { fill: none; stroke: var(--ink); stroke-width: .07; }
.marks-preview .marks path { fill: var(--burgundy); }
.plate-text h2 { font-size: 21px; margin: 4px 0 2px; }
.plate-text .small { font-size: 14px; }
.plate-btn { width: 100%; min-height: 46px; background: var(--ink); color: var(--bg); font-family: var(--sc); font-size: 15px; letter-spacing: .05em; }
.plate-btn.done { background: none; color: var(--ink); border: .8px solid var(--line-strong); }
.continue-line { display: flex; align-items: center; gap: 8px; min-height: 32px; text-align: left; font-size: 14px; }
.continue-line .ink { color: var(--ink); }
.chev { margin-left: auto; font-family: var(--display); font-size: 21px; color: var(--ink-faint); }
.ledger-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 0; border-bottom: .5px solid var(--line); text-align: left; }
.ledger-row .lvl { font-family: var(--display); font-size: 21px; }
.ledger-row .rank { display: inline-flex; gap: 3px; }
.ledger-row .rank svg { width: 9px; height: 8px; }
.ledger-row .rank path { fill: var(--burgundy); }
.ledger-row .spacer { flex: 1; }
.ledger-row .caps { font-size: 13px; }
.ledger-row .chev { margin-left: 0; }
.small-links { text-align: center; font-family: var(--display); font-style: italic; color: var(--ink2); font-size: 15px; }
.small-links button, .small-links .kofi { font: inherit; color: inherit; min-height: 44px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: space-between; max-width: 520px; margin: 0 auto;
  padding: 12px 28px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: .8px solid var(--line-strong); }
.tabbar button { font-family: var(--sc); font-size: 15px; letter-spacing: .05em; color: var(--ink2); min-height: 36px; }

/* Game (Figma: Redesign → Game · picking a height) */
.topbar .title { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.topbar .title .place { font-family: var(--display); font-size: 21px; color: var(--ink); }
.topbar .title .caps { display: block; font-size: 13px; color: var(--ink2); }
.tray-head .text { font-family: var(--display); font-style: italic; font-size: 16px; }
.tray .caption { font-family: var(--display); font-style: italic; font-size: 16px; }
.small-btn { border-radius: 0; font-family: var(--sc); letter-spacing: .04em; }
.keys.ruler { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.key { border-radius: 0; border: .8px solid var(--line-strong); }
.key.faint { opacity: .32; }
.key.faint:disabled { opacity: .32; }
.actions.ruled { display: flex; gap: 0; border-top: .8px solid var(--line-strong); border-bottom: .8px solid var(--line-strong); }
.actions.ruled .action { flex: 1; border: 0; border-radius: 0; min-height: 48px; position: relative; background: none; }
.actions.ruled .action + .action::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: .5px; background: var(--line); }
.actions.ruled .action span { font-family: var(--sc); font-size: 15px; letter-spacing: .05em; text-transform: none; font-weight: 400; }
.actions.ruled .action.active { background: none; color: var(--burgundy); }
.actions.ruled .action.active span { border-bottom: 3px double var(--burgundy); padding-bottom: 1px; }
.tray-head .sq { font-family: var(--serif); font-style: normal; font-size: 15px; font-variant-numeric: lining-nums; }

/* Engraved everywhere: square corners; every card is a plate (ruled frame + inner hairline) */
.card, .panel, .stat, .btn, .pill, .small-btn, .seg, .key, .action, .cal button, .toast, .plate-btn { border-radius: 0 !important; }
.card, .panel { border: .8px solid var(--line-strong); outline: .5px solid color-mix(in srgb, var(--line) 60%, transparent); outline-offset: -4px; }
.page-head { margin: 4px 0 18px; }
.page-head h2 { font-size: 30px; }
.page-head p { margin: 4px 0 0; color: var(--ink2); font-family: var(--display); font-style: italic; font-size: 17px; }
.set-head { display: none; }
.ruled-figures { display: flex; border-top: .8px solid var(--line-strong); border-bottom: .8px solid var(--line-strong); padding: 10px 0; margin: 6px 0 18px; }
.ruled-figures > div { flex: 1; text-align: center; position: relative; }
.ruled-figures > div + div::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: .5px; background: var(--line); }
.ruled-figures b { display: block; font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums lining-nums; font-family: var(--serif); }
.ruled-figures small { font-family: var(--sc); font-size: 13px; color: var(--ink2); letter-spacing: .04em; }
.done .ruled-figures b { font-size: 22px; }
.cal-head { border-bottom: .8px solid var(--line-strong); }
.cal-head .icon-btn { font-family: var(--display); font-size: 26px; color: var(--ink); }
.cal-head h2 { font-family: var(--display); }
.cal .dow { font-family: var(--sc); color: var(--ink2); }
.cal button { border: .5px solid var(--line); background: var(--surface); }
.cal button.today { border: 1.5px solid var(--burgundy); box-shadow: inset 0 0 0 2.5px var(--surface), inset 0 0 0 3px color-mix(in srgb, var(--burgundy) 60%, transparent); }
.cal button.solved { background: var(--ink); color: var(--bg); }
.cal button small { font-family: var(--sc); font-size: 10px; }
.cal button small svg { width: 7px; height: 6px; display: block; margin-top: 2px; }
.cal button small svg path { fill: var(--bg); }
.cal-head button.icon-btn { font-size: 30px; line-height: 1; }

/* ───────── New clues (experimental): uncharted ground, passes, echoes (lab/clues.js) ───────── */
.cell .fog { position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--ink2) 28%, transparent) 0 .7px, transparent .7px 5px); }
.cell .fog.inked { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--tink) 18%, transparent) 0 .6px, transparent .6px 6px); }
.cell .fog.et { border-top: 2px dashed var(--ink); }
.cell .fog.er { border-right: 2px dashed var(--ink); }
.cell .fog.eb { border-bottom: 2px dashed var(--ink); }
.cell .fog.el { border-left: 2px dashed var(--ink); }
.cell .ctag { position: absolute; left: 6%; top: 4%; font-size: 24cqh; line-height: 1; color: var(--burgundy); font-family: var(--serif);
  font-variant-numeric: lining-nums; white-space: nowrap; z-index: 1; pointer-events: none; }
.cell .ctag.clue { background: var(--bg); color: var(--ink); padding: 1px 3px; border: .5px solid var(--ink); left: 5%; top: 5%; }
.cell .ctag.sight { left: auto; right: 6%; }
.cell .pass { position: absolute; left: 50%; top: 6%; width: 46%; transform: translateX(-50%); pointer-events: none; }
.cell .pass svg, .clue-rules .ck svg { display: block; width: 100%; height: auto; fill: none; stroke: var(--burgundy); stroke-width: 1.8; stroke-linecap: round; }
.clue-rules { list-style: none; padding: 8px 12px; margin: 0 0 10px; border: .5px solid var(--line); background: color-mix(in srgb, var(--surface) 55%, transparent); font-size: 14.5px; }
.clue-rules li { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.clue-rules .ck { flex: none; width: 26px; height: 18px; display: grid; place-items: center; margin-top: 2px; }
.clue-rules .ck svg { width: 22px; }
.clue-rules .ck.txt { font-size: 14px; color: var(--burgundy); white-space: nowrap; }
.clue-rules .ck.fogs { border: 1.2px dashed var(--ink); background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--ink2) 30%, transparent) 0 .7px, transparent .7px 4px); }
.clue-list { display: flex; flex-direction: column; }
.clue-row { padding: 12px 0; border-bottom: .6px solid var(--line); }
.clue-head { display: flex; align-items: center; justify-content: space-between; }
.clue-row h3 { font-family: var(--display); font-weight: 400; font-size: 22px; }
.clue-row p { margin: 2px 0 8px; color: var(--ink2); font-size: 15px; }
.clue-levels { display: flex; flex-wrap: wrap; gap: 6px; }
.clue-levels .pill { background: transparent; color: var(--ink); border: .9px solid var(--line-strong); padding: 4px 12px; min-height: 36px; font-size: 14px; }
.clue-levels .pill:active { background: var(--ink); color: var(--bg); }
.muted a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
