/* Town UI. Laid out at the game's native 384x216 and scaled up by the same
   integer k as the canvas (index.html sets --k), so it lines up with the art. */
#ui { position: absolute; left: 0; top: 0; width: 384px; height: 216px; transform: scale(var(--k, 1)); transform-origin: 0 0;
  font-family: 'Pixelify Sans', ui-monospace, monospace; font-size: 6px; line-height: 1.35; word-spacing: 1px;   /* the pixel font's own space collapses at 6-8px */
  --ink: #1b1712; --paper: #d8c8a8; --paper2: #c4b08a; --gold: #e0a44a; --red: #8a2e22; --wood: #5a3e26; --wood2: #3f2b1a; --mute: #7a6a52; }
#ui .num { font-family: 'Silkscreen', monospace; font-size: .85em; }
#ui button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
#ui .screen { position: absolute; inset: 0; overflow: hidden; }
#ui .hint { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font: 5px 'Silkscreen', monospace; opacity: .75; }

#ui .hud-town { position: absolute; left: 3px; bottom: 3px; display: flex; gap: 3px; font: 5px 'Silkscreen', monospace; color: var(--paper); }
#ui .hud-town > * { background: #1b1712cc; padding: 1px 3px; }
#ui .hud-town .on { color: var(--gold); }
#ui[data-view="board"] .hud-town, #ui[data-view="journal"] .hud-town, #ui[data-view="road"] .hud-town { display: none; }

/* cork notice board */
#ui .cork { background: repeating-linear-gradient(45deg, #8a6a42 0 2px, #7e603a 2px 4px); border: 7px solid var(--wood); box-shadow: inset 0 0 0 2px var(--wood2); color: var(--ink); }
#ui .cork .title { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: var(--wood2); color: var(--paper); font: 5px 'Silkscreen', monospace; padding: 1px 5px; }
#ui .notes { position: absolute; inset: 9px 8px 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; align-items: start; }
#ui .note { background: var(--paper); padding: 8px 5px 5px; position: relative; box-shadow: 2px 2px 0 #0006; }
#ui .note:nth-child(4n+1) { transform: rotate(-2deg); } #ui .note:nth-child(4n+2) { transform: rotate(1.5deg); margin-top: 6px; }
#ui .note:nth-child(4n+3) { transform: rotate(-1deg); margin-top: 2px; } #ui .note:nth-child(4n) { transform: rotate(2deg); margin-top: 8px; }
#ui .note::before { content: ''; position: absolute; top: 2px; left: 50%; width: 4px; height: 4px; background: var(--red); box-shadow: 1px 1px 0 #0005; }
#ui .note .hl { font-weight: 600; font-size: 8px; line-height: 1.1; margin-bottom: 4px; }
#ui .note .meta { color: #4a3e2e; }
#ui .note .age { display: inline-block; background: var(--ink); color: var(--paper); padding: 0 2px; margin-bottom: 3px; }
#ui .note .age.old { background: var(--red); }
#ui .note .write { margin-top: 4px; display: block; width: 100%; text-align: center; background: var(--ink); color: var(--paper); padding: 1px 0; }
#ui .note .write:hover:not(:disabled) { background: var(--wood); }
#ui .note .write:disabled { background: none; color: var(--mute); border: 1px solid var(--mute); cursor: default; }
#ui .note .rec { color: var(--red); }
#ui .note.noted { outline: 2px solid var(--gold); outline-offset: 1px; }
#ui .empty { grid-column: 1 / -1; text-align: center; color: var(--paper); font-size: 8px; margin-top: 60px; }

/* journal: an open book */
#ui .book { background: var(--paper); color: var(--ink); border: 4px solid var(--wood2); }
#ui .book::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--paper2); }
#ui .book .page { position: absolute; top: 8px; bottom: 14px; width: 50%; padding: 0 12px; box-sizing: border-box; overflow: hidden; }
#ui .book .left { left: 0; } #ui .book .right { right: 0; }
#ui .book h3 { font-weight: 600; font-size: 8px; line-height: 1.1; margin: 0 0 4px; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
#ui .book .row { display: grid; grid-template-columns: 1fr auto; gap: 3px; width: 100%; padding: 2px 3px; margin: 0 -3px; border-bottom: 1px dotted var(--paper2); }
#ui .book .row.sel { background: #e8d6a8; }
#ui .book .row .d { color: var(--mute); }
#ui .book .line { font-size: 7px; margin: 3px 0; }
#ui .book .line.small { font-size: 6px; color: var(--mute); }
#ui .book b { color: var(--red); font-weight: 600; }
#ui .book .cross { margin-top: 6px; color: var(--red); text-decoration: line-through; }
#ui .book .tabs { display: flex; gap: 6px; margin-bottom: 3px; font: 5px 'Silkscreen', monospace; }
#ui .book .tabs button { color: var(--mute); }
#ui .book .tabs .on { color: var(--ink); text-decoration: underline; }
#ui .book .marks { display: flex; align-items: center; gap: 4px; margin: 5px 0 2px; font-size: 7px; }
#ui .book .mark { border: 1px solid var(--ink); padding: 0 4px; }
#ui .book .mark.true.on { background: #3d6a34; border-color: #3d6a34; color: var(--paper); }
#ui .book .mark.lie.on { background: var(--red); border-color: var(--red); color: var(--paper); }
#ui .book .pips { display: flex; gap: 1px; align-items: center; }
#ui .book .pips i { width: 3px; height: 3px; }
#ui .book .pips .yes { background: #3d6a34; } #ui .book .pips .no { background: var(--red); }

/* close box: phones have no Esc key */
#ui .close { position: absolute; top: 2px; right: 3px; z-index: 2; width: 12px; height: 12px; text-align: center; line-height: 11px;
  background: var(--wood2); color: var(--paper); font: 7px 'Silkscreen', monospace; }
/* the road */
#ui .book .bar { height: 5px; margin: 6px 0; border: 1px solid var(--ink); background: var(--paper2); }
#ui .book .bar i { display: block; height: 100%; background: var(--wood); }
#ui .book .eta { font-size: 9px; }
#ui .book .go { margin-top: 8px; display: block; width: 100%; text-align: center; background: var(--ink); color: var(--paper); padding: 3px 0; font-size: 8px; }
#ui .toast { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); z-index: 3; background: var(--red); color: var(--paper); padding: 2px 6px; }
/* touch: no keys to hint at, and bigger things to hit */
@media (pointer: coarse) {
  #ui .hint { display: none; }
  #ui .close { width: 16px; height: 16px; line-height: 15px; font-size: 9px; }
  #ui .hud-town { font-size: 7px; gap: 4px; }
  #ui .hud-town > * { padding: 3px 5px; }
}
