/* Hofgeschichte on top of Survivor's HerpDerp skin (../css/style.css): wood tab at the top like
   Survivor's #topbar, panel frame, orange buttons and parchment cards like the other Puddlehold
   phone games. Jersey 10 is sharp only at 56/3 px or twice that. */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --ic: 32px; --oic: 32px; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3a2210; }
canvas#game { display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; cursor: default; }
img { image-rendering: pixelated; }

/* status bar: no XP bar in this game, so the tab sits at the very top */
#topbar { top: var(--sat); gap: 16px; }
#topbar .tb { display: flex; align-items: center; gap: 4px; color: var(--muted); text-shadow: var(--ink-outline); }
/* HUD icons are 14x14 art px (28 file px), shown 1:1 */
#topbar img { width: 28px; height: 28px; }
#stPowerT { color: var(--muted); margin-left: -4px; }
@media (max-width: 520px) {
  #topbar { left: 6px; transform: none; gap: 12px; padding: 4px 12px 6px; max-width: calc(100vw - 72px); }
}
/* field view: the banner floats above the info row, whose height grows with the English text
   (up to about 110 px at 360 px wide), so it never sits on the row */
#hud .banner { top: auto; bottom: calc(var(--sab) + 128px); white-space: normal; width: max-content; max-width: min(92vw, 420px); z-index: 2; }
#hud .banner.top { top: calc(var(--sat) + 52px); bottom: auto; }

/* orders: one card per customer under the status bar */
#orders {
  position: absolute; left: 0; right: 0; top: calc(var(--sat) + 52px);
  display: flex; justify-content: center; gap: 6px; padding: 0 6px;
}
.order {
  pointer-events: auto; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; flex: 0 1 128px; padding: 4px 4px 3px; cursor: pointer; font-family: var(--font); color: var(--ink);
  background: linear-gradient(var(--phm-parch-hi, #fff5d0), var(--phm-parch-lo, #efd48f));
  border: 3px solid #2b1a0e; border-radius: 10px; box-shadow: 0 4px 0 #2b1a0e;
}
.order .row { display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.order .who { flex: none; width: 32px; height: 32px; border: 2px solid #2b1a0e; border-radius: 8px; image-rendering: auto; background: #6e3f1c; }
.order .w { position: relative; flex: none; width: var(--oic, var(--ic)); height: var(--oic, var(--ic)); background: rgba(110, 63, 28, .25); border-radius: 6px; }
.order .w img { width: 100%; height: 100%; display: block; }
.order .w .tick { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; }
.order .rew { display: flex; align-items: center; gap: 2px; line-height: 1; white-space: nowrap; }
.order .rew img { width: 14px; height: 14px; }
.order .go { display: none; color: var(--gold); text-shadow: var(--ink-outline); line-height: 1; }
.order.ready { background: linear-gradient(#ffb64a, #ec8c22); animation: hof-ready .8s ease-in-out infinite alternate; }
.order.ready .rew { display: none; }
.order.ready .go { display: block; }
.order.fresh { animation: hof-in .35s ease-out; }
@keyframes hof-ready { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes hof-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* bottom row: what is selected and what it can do, plus the switch between field and farm */
#bottom {
  position: absolute; left: 0; right: 0; bottom: calc(10px + var(--sab));
  display: flex; justify-content: center; align-items: stretch; gap: 6px; padding: 0 8px;
}
#info {
  pointer-events: auto; flex: 0 1 300px; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 2px 6px;
  background: var(--wood); border: 3px solid #2b1a0e; border-radius: 12px; box-shadow: 0 4px 0 #2b1a0e, inset 0 2px 0 var(--wood-light);
  text-shadow: var(--ink-outline); min-height: 52px;
}
#info .ic { flex: none; width: var(--ic); height: var(--ic); }
#info .ic img { width: 100%; height: 100%; display: block; }
#info .ic:has(img:not([src])) { display: none; }
#info .txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
#info .txt b { color: var(--gold); font-family: var(--title); font-size: var(--tpx); font-weight: 400; line-height: 1; -webkit-font-smoothing: none; }
#info .txt span { color: var(--muted); white-space: normal; }
#info .btn { margin: 0; padding: 4px 10px; flex: none; min-height: 44px; }
#bottom > .btn { margin: 0; display: flex; align-items: center; gap: 4px; padding: 4px 12px; }
#bottom > .btn img { width: 28px; height: 28px; }
#bottom.farm #info { display: none; }

/* farm view: the chapter's tasks on a wood panel above the bottom row */
#farm {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 74px);
  width: min(420px, calc(100vw - 16px)); pointer-events: auto;
  background: var(--wood); border: 3px solid #2b1a0e; border-radius: 12px; box-shadow: 0 4px 0 #2b1a0e, inset 0 2px 0 var(--wood-light);
  padding: 4px 8px 6px; text-shadow: var(--ink-outline);
}
#farm .fhead { display: flex; justify-content: space-between; gap: 8px; }
#farm .fhead b { color: var(--gold); }
#farm .fhead span { color: var(--muted); }
#tasks { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#tasks li { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 4px; border-radius: 8px; }
#tasks li img { width: 28px; height: 28px; flex: none; }
#tasks li .n { flex: 1; min-width: 0; }
#tasks li.done { color: var(--muted); }
#tasks li.next { background: rgba(43, 26, 14, .45); }
#tasks li.later { opacity: .55; }
#tasks li .cost { display: flex; align-items: center; gap: 2px; color: var(--gold); }
#tasks li .btn { margin: 2px 0; padding: 2px 10px; display: flex; align-items: center; gap: 2px; min-height: 44px; }
#tasks li .btn img, #tasks li .cost img { width: 14px; height: 14px; }
#tasks li .btn img { margin-left: 4px; }

/* welcome, new producer and farm fair use the shared window (../css/phone.css) */
#modal { z-index: 30; }
#modal .hart img { height: auto; }
