/* Tractatus Tree look: a compositor's proof on the imposing stone.
   Slate stone, proof sheet, press ink, cut slips, gilt only where a page jumped. */
@font-face { font-family: "Bodoni Moda"; src: url("fonts/bodoni-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --slate: #3F4A47;
  --slate-deep: #323B39;
  --sheet: #EFE9DA;
  --slip: #F6F1E3;
  --ink: #191816;
  --grey: #8F8878;
  --gilt: #C49A2C;
  --gilt-hi: #E6C766;
  --num: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --pl-font: "Atkinson Hyperlegible", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --pl-topbar-bg: #323B39;
  --pl-topbar-text: #EFE9DA;
  --pl-control-text: #EFE9DA;
  --pl-control-bg: #EFE9DA;
  --pl-control-border: #191816;
  --pl-focus: #E6C766;
  --pl-overlay: rgb(25 30 29 / .66);
  --pl-card-bg: #EFE9DA;
  --pl-card-text: #191816;
  --pl-card-muted: #191816;
  --pl-card-border: #191816;
  --pl-primary: #191816;
  --pl-primary-text: #F6F1E3;
  --pl-shadow: rgb(8 10 10 / .5);
  --pl-share-bg: #EFE9DA;
  --pl-radius-control: 2px;
  --pl-radius-card: 1px;
  --pl-radius-picture: 1px;
  font-family: var(--pl-font);
  color: var(--sheet);
  background: var(--slate);
}

body {
  color: var(--sheet);
  background:
    radial-gradient(circle at 30% 20%, rgb(255 255 255 / .04), transparent 60%),
    repeating-linear-gradient(17deg, rgb(0 0 0 / .045) 0 1px, transparent 1px 5px),
    var(--slate);
}

[data-pl="topbar"] { box-shadow: 0 1px 0 rgb(0 0 0 / .4); }
[data-pl="back"] { font-weight: 700; font-size: 15px; }
.pl-topbar__actions button { font-weight: 700; font-size: 14px; color: var(--sheet); }

/* the rules card is a proof sheet */
[data-pl="howto-card"] {
  padding: 20px 18px 16px;
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -6px;
  background: var(--sheet);
}
[data-pl="howto-card"] h2 { font: 700 24px/1.1 var(--num); color: var(--ink); letter-spacing: .01em; }
[data-pl="howto-pictures"] { gap: 6px; }
[data-pl="howto-pictures"] canvas {
  width: calc((100% - 12px) / 3);
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--grey);
  background: var(--sheet);
}
[data-pl="howto-lines"] { font: 400 16px/1.38 var(--pl-font); color: var(--ink); padding-left: 22px; }
[data-pl="howto-lines"] li::marker { font-family: var(--num); font-weight: 700; color: var(--grey); }
.pl-howto-footer button, button {
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--slip);
  color: var(--ink);
  font-family: var(--pl-font);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--ink);
}
.pl-howto-footer button:active, button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.pl-howto-footer .pl-howto-start { background: var(--ink); color: var(--slip); font-size: 17px; padding: 8px 22px; }
.pl-topbar__actions button { box-shadow: none; border: 0; background: transparent; }

/* the stone and the sheet */
.shell { padding-left: 8px; padding-right: 8px; }
#play-screen { padding-top: 6px; }
.level-row { padding: 0 4px 6px; align-items: baseline; }
.level-name { font: 700 19px/1.2 var(--num); color: var(--sheet); }
html[lang="zh-Hant"] .level-name { font-family: "Noto Serif TC", "Songti TC", serif; }
.move-count { font: 700 14px/1 var(--pl-font); color: #CFC8B6; font-variant-numeric: tabular-nums; }
.instruction:empty { display: none; }
.instruction { margin: 0 2px 8px; color: var(--gilt-hi); font-weight: 700; text-align: center; }
.board-shell { border: 0; border-radius: 0; background: var(--slate); box-shadow: none; }
.message { color: #E5DECC; font-size: 15px; min-height: 1.5em; text-align: center; }
.message.refused { color: #F0C9A0; }
.controls button { min-width: 110px; }
button:disabled { opacity: .45; box-shadow: none; }
html[data-screen="result"] .controls { display: none; }

.hand-demo, .hand-demo.running { display: none !important; }
.success-effect { display: none !important; }

/* the result: a slip set under the finished sheet, after the platen lifts */
.result-card {
  margin-top: 2px;
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -5px;
  border-radius: 1px;
  background: var(--slip);
  color: var(--ink);
  animation: slip-in .35s ease-out .55s both;
}
@keyframes slip-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-title { color: var(--ink); font: 700 23px/1.2 var(--num); }
html[lang="zh-Hant"] .result-title { font-family: var(--pl-font); }
.result-marks { font: 700 16px/1.3 var(--pl-font); font-variant-numeric: tabular-nums; color: var(--ink); }
.share-line { color: #5E584C; }
.result-actions .primary-button { background: var(--ink); color: var(--slip); border-color: var(--ink); box-shadow: 0 2px 0 var(--gilt); }

/* the level list: proof slips on the stone */
#map-screen { color: var(--sheet); }
.map-heading h1 { font: 700 34px/1.1 var(--num); letter-spacing: 0; color: var(--sheet); }
html[lang="zh-Hant"] .map-heading h1 { font-family: var(--pl-font); }
.eyebrow { color: #CFC8B6; letter-spacing: .08em; }
#map-copy { color: #E5DECC; }
.level-map { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.level-map .plc-cabinet { --plc-ink: var(--ink); --plc-paper: var(--slip); --plc-line: var(--grey); --plc-moss: var(--ink); --plc-warm: var(--gilt); gap: 11px; }
.level-map .plc-cabinet__group { border-radius: 2px; box-shadow: 1px 2px 0 rgb(0 0 0 / .35); }
.level-map .plc-cabinet__head { padding: 9px 11px; background: #D8D0BF; font-family: var(--pl-font); }
.level-map .plc-cabinet__grid { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
.level-map .plc-level { min-height: 52px; border-radius: 1px; font-family: var(--pl-font); font-size: 12px; line-height: 1.15; }
.level-map .plc-level[data-solved='true'] { border-color: var(--gilt); box-shadow: inset 0 0 0 1px var(--gilt-hi); }
.level-map .plc-level[data-solved='true']::after { color: var(--ink); }
.level-tile {
  position: relative;
  min-height: 84px;
  padding: 12px 12px 12px 46px;
  border: 1px solid var(--grey);
  box-shadow: 1px 2px 0 rgb(0 0 0 / .35);
  background: var(--slip);
}
.level-tile::before {
  content: attr(data-n);
  position: absolute; left: 10px; top: 12px;
  font: 700 18px/1 var(--num); color: var(--grey);
}
.level-tile.complete::before { color: var(--ink); }
.level-tile.at-par { border-color: var(--gilt); box-shadow: inset 0 0 0 1px var(--gilt-hi), 1px 2px 0 rgb(0 0 0 / .35); }
.level-tile strong { font: 700 15px/1.2 var(--pl-font); color: var(--ink); }
.level-tile small { font: 700 12px/1.2 var(--pl-font); color: #5E584C; font-variant-numeric: tabular-nums; }
.level-tile:disabled { opacity: .5; }

@media (min-width: 700px) {
  .shell { background: rgb(0 0 0 / .1); border-color: rgb(239 233 218 / .14); }
}

/* the way back sits on the stone, not on a slip */
[data-pl="back"] { background: transparent; color: var(--sheet); border-color: transparent; box-shadow: none; }
.map-heading .quiet-button { background: var(--slip); color: var(--ink); border: 1px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.level-tile.complete { background: var(--slip); border-color: var(--ink); }
/* the HUD keeps its place as the numbers grow */
.move-count { flex: 0 0 auto; width: 23ch; display: flex; gap: 12px; justify-content: space-between; white-space: nowrap; }
#left-line { min-width: 6ch; text-align: right; }
.level-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-pl="topbar"] :focus-visible { outline: 2px solid rgb(230 199 102 / .55); outline-offset: -4px; }

/* Three loose proof sheets before the numbered rounds. */
html.first-minute-active .shell { padding-top: calc(60px + env(safe-area-inset-top)); }
html.first-minute-active #play-screen { display: none; }
.first-minute[hidden] { display: none; }
.first-minute { max-width: 390px; margin: 0 auto; color: var(--sheet); }
.first-minute-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.first-minute-step { margin: 0 4px; color: #DAD1BD; font: 700 14px/1.2 var(--pl-font); }
.first-minute-skip { min-height: 44px; border: 0; box-shadow: none; background: transparent; color: #DAD1BD; font-size: 14px; }
.first-minute-premise { margin: 5px 4px 9px; font: 700 19px/1.25 var(--num); color: var(--sheet); }
html[lang="zh-Hant"] .first-minute-premise { font-family: var(--pl-font); }
.first-minute-board { position: relative; width: 100%; background: var(--slate); }
.first-minute-board canvas { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.first-minute-finger { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none; border: 2px solid var(--gilt-hi); border-radius: 50%; background: rgb(230 199 102 / .17); box-shadow: 0 0 0 5px rgb(230 199 102 / .13); animation: first-minute-pulse 1.5s ease-in-out infinite; }
.first-minute-finger[hidden] { display: none; }
@keyframes first-minute-pulse { 0%, 100% { transform: scale(.83); opacity: .65; } 50% { transform: scale(1.15); opacity: 1; } }
.first-minute-line { min-height: 1.4em; margin: 6px 4px 0; color: var(--gilt-hi); font: 700 16px/1.35 var(--pl-font); text-align: center; }
.first-minute-result { min-height: 1.3em; margin: 4px 4px 0; color: var(--sheet); font: 400 15px/1.3 var(--pl-font); text-align: center; }
.first-minute-actions { display: flex; justify-content: center; gap: 10px; margin: 8px 0 14px; }
.first-minute-actions button { min-width: 110px; }
.first-minute-replay { display: block; width: 100%; margin: 5px 0 10px; background: transparent; box-shadow: none; font-size: 14px; }
.first-minute-replay[hidden] { display: none; }
.first-minute-sources { margin: 4px 0 9px; color: var(--ink); font: 400 14px/1.35 var(--pl-font); }
.first-minute-sources[hidden] { display: none; }
.first-minute-sources summary { min-height: 28px; cursor: pointer; text-decoration: underline; }
.first-minute-sources [data-pl="howto-credit"] { margin: 4px 0 10px; }
@media (max-height: 610px) { .first-minute-board { width: min(100%, 260px); margin: auto; } .first-minute-premise { margin-top: 0; margin-bottom: 1px; font-size: 17px; } .first-minute-line { margin-top: 0; } .first-minute-result { margin-top: 0; } }

/* reading line: the book's own sentence for the page in play */
.reading { margin: 6px 6px 0; min-height: 2.6em; color: #EFE9DA; font: 400 15px/1.3 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reading-num { font-family: var(--num); font-weight: 700; color: #A9A18C; margin-right: 2px; }
.reading[data-tag="preview"] { opacity: .8; }
.pl-brand-logo { display: block; border-radius: 4px; }
[data-pl="back"][data-brand] { color: #EFE9DA; }
.pl-brand-title { font-family: var(--num); font-weight: 700; font-size: 15px; letter-spacing: 0; white-space: nowrap; }
[data-pl="back"][data-brand] { gap: 6px; white-space: nowrap; }
@media (max-width: 360px) { .pl-brand-title { font-size: 13.5px; } .pl-brand-logo { width: 22px; height: 22px; } }
@media (max-height: 640px) { .message:empty { display: none; } .reading { font-size: 14px; min-height: 2.6em; } }

.silence-line { height: 3px; margin: 4px 3px 0; background: transparent; position: relative; }
.silence-line::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0; background: #C49A2C; }
.silence-line.run::after { width: 100%; transition: width 5s linear; }
.result-discovery { margin: 8px 4px 0; color: #EFE9DA; font: 400 15px/1.35 var(--pl-font); }
.result-line { margin: 6px 4px 0; color: #E6C766; font: 400 17px/1.3 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.result-discovery:empty, .result-line:empty { display: none; }

/* reader: the full page, large; collection: every grown remark in the book's order */
.tap-hint { margin: 2px 6px 0; color: #C9C2AE; font-size: 14px; line-height: 1.3; }
.tap-hint[hidden] { display: none; }
.book-link { display: block; width: 100%; margin: 8px 0 4px; min-height: 48px; font-weight: 700; }
.reader { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 12px; }
.reader[hidden] { display: none; }
.reader-backdrop { position: absolute; inset: 0; background: rgb(25 30 29 / .72); }
.reader-card { position: relative; width: min(100%, 440px); max-height: calc(100dvh - 24px); overflow: auto; padding: 22px 20px 18px; border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -6px; background: var(--sheet); color: var(--ink); box-shadow: 0 10px 40px rgb(8 10 10 / .5); }
.reader-num { margin: 0 0 8px; font: 700 34px/1 var(--num); letter-spacing: .01em; }
.reader-text { margin: 0 0 12px; font: 400 19px/1.45 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif TC", serif; overflow-wrap: anywhere; }
.reader-note { margin: 0 0 12px; color: #4A463C; font-size: 14px; line-height: 1.35; }
.reader-note:empty { display: none; }
.reader-nav { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px; margin-bottom: 12px; }
.reader-nav button { min-height: 48px; font-size: 24px; font-weight: 700; color: var(--ink); background: var(--slip); border: 1px solid var(--ink); }
.reader-nav button:disabled { opacity: .35; }
.reader-pos { text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
#reader-close { width: 100%; min-height: 48px; }
.book-progress { margin: 6px 4px 8px; color: var(--sheet); font: 700 18px/1.2 var(--pl-font); font-variant-numeric: tabular-nums; }
.book-search { display: grid; gap: 4px; margin: 0 2px 10px; color: var(--sheet); font-size: 14px; }
.book-search input { min-height: 48px; padding: 8px 12px; border: 1px solid var(--ink); border-radius: 2px; background: var(--sheet); color: var(--ink); font: 700 18px var(--pl-font); font-variant-numeric: tabular-nums; }
.book-empty { margin: 14px 4px; color: var(--sheet); font-size: 16px; line-height: 1.4; }
.book-empty[hidden] { display: none; }
.book-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.book-item { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: start; width: 100%; min-height: 56px; padding: 10px 12px; text-align: left; color: var(--ink); background: var(--sheet); border: 1px solid var(--ink); }
.book-num { font: 700 18px/1.2 var(--num); font-variant-numeric: tabular-nums; }
.book-text { font: 400 16px/1.4 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 359px) { .reader-card { padding: 18px 14px 14px; } .reader-num { font-size: 30px; } .reader-text { font-size: 18px; } .book-item { grid-template-columns: 54px 1fr; gap: 8px; padding: 9px 10px; } }

@media (max-height: 700px) { .controls { padding: 4px 0 4px; } .book-link { margin: 4px 0 2px; min-height: 44px; } .tap-hint { display: none; } .message { margin: 6px 5px 2px; } }

.page-lines { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); list-style: none; }

/* Your copy: the whole book in reading order, inked where printed */
.book-marks { display: flex; gap: 6px; margin: 4px 3px 8px; }
.book-mark { width: 32px; height: 32px; display: grid; place-items: center; font: 700 15px/1 var(--num); background: #E2DBC8; color: #A0977F; border: 1px solid #CDC4AE; }
.book-mark.on { background: #F6F1E3; color: #191816; border-color: #191816; }
.book-item.blank, .book-item.bar { background: transparent; color: #A9A18C; box-shadow: none; border: 0; border-bottom: 1px solid rgb(239 233 218 / .18); min-height: 36px; }
.book-item.bar .book-text { display: block; height: 12px; margin-top: 6px; background: #191816; width: 60%; }
.book-item:disabled { opacity: 1; }
.book-footer { margin: 14px 4px 24px; color: #C9C2AE; font-size: 13px; line-height: 1.4; }
#result-screen #result-discovery { font-size: 15px; }
#result-screen #result-discovery { color: #3A3832; }
@media (max-width: 359px) { .move-count { width: 20ch; gap: 8px; font-size: 13px; } .level-name { font-size: 22px; } }
@media (max-height: 700px) { html[data-screen="play"] #book-button { display: none; } }
.shell { box-sizing: border-box; }
@media (max-height: 700px) { .first-minute-board canvas { width: 88%; margin: 0 auto; } .first-minute-actions { margin: 4px 0 6px; } }
