/* Angelpfütze 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
   games. Jersey 10 is sharp only at 56/3 px or twice that. */
:root {
  /* tokens of the shared menu, so .phm-* parts also work outside it */
  --phm-ink: #2b1a0e; --phm-btn-hi: #ffb64a; --phm-btn-lo: #ec8c22; --phm-parch-hi: #fff5d0; --phm-parch-lo: #efd48f;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
canvas#game { cursor: default; }
img { image-rendering: pixelated; }
[hidden] { display: none !important; }

/* time-of-day wash: a 2x2 tint sprite stretched over the world */
#tint { position: fixed; inset: 0; pointer-events: none; background: none 0 0 / 100% 100%; image-rendering: pixelated; }
#tint[data-ph="morgen"] { background-image: url(sprites/tint_morgen.png); }
#tint[data-ph="abend"] { background-image: url(sprites/tint_abend.png); }
#tint[data-ph="nacht"] { background-image: url(sprites/tint_nacht.png); }

#ahud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ahud button { pointer-events: auto; }

/* status bar: wood tab hanging from the top edge, numbers in gold (Survivor #topbar) */
#atop {
  position: absolute; top: var(--sat); left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 16px; white-space: nowrap;
  background: var(--wood); border: 3px solid #2b1a0e; border-top: 0; border-radius: 0 0 22px 22px; padding: 4px 18px 6px;
  box-shadow: 0 6px 0 rgba(0,0,0,.28), inset 0 2px 0 var(--wood-light);
}
#atop .tb { display: flex; align-items: center; gap: 4px; color: var(--muted); text-shadow: var(--ink-outline); }
/* all HUD icons are 14x14 art px (28 file px): shown 1:1 so they share one pixel scale */
#atop .tb img, #atop .today img, #bottom .btn img { width: 28px; height: 28px; }
#atop b { color: var(--gold); text-shadow: var(--ink-outline); }
#atop .today { flex-basis: 100%; display: flex; justify-content: center; align-items: center; gap: 4px; color: var(--gold); text-shadow: var(--ink-outline); border-top: 2px solid var(--wood-dark); padding-top: 2px; }
/* phones: keep clear of the menu button top right */
@media (max-width: 520px) {
  #atop { left: 6px; transform: none; gap: 2px 12px; padding: 4px 12px 6px; max-width: calc(100vw - 72px); }
  #atop .today { white-space: normal; text-align: center; }
}

#hint {
  position: absolute; left: 0; right: 0; bottom: calc(84px + var(--sab)); text-align: center; padding: 0 16px;
  color: var(--text); text-shadow: var(--ink-outline);
}
#hint.warn { color: var(--gold); }
#hint.big { font-size: var(--nx2, 28px); line-height: 1; }

#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; }
#bottom .btn { margin: 0; display: flex; align-items: center; gap: 4px; padding: 4px 12px; }
#bottom .arrow { font-size: var(--nx2, 28px); line-height: 1; padding: 0 12px; }
#place {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 132px; padding: 2px 10px;
  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);
}
#place b { color: var(--gold); }
#place span { color: var(--muted); }

#reel { position: absolute; left: 0; right: 0; top: calc(100px + var(--sat)); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-row { display: flex; align-items: center; gap: 6px; width: min(360px, calc(100vw - 32px)); }
.bar-row > span { width: 82px; text-align: right; text-shadow: var(--ink-outline); }
.bar { position: relative; flex: 1; height: 22px; background: #2a1708; border: 3px solid #2b1a0e; border-radius: 8px; overflow: hidden; box-shadow: 0 3px 0 rgba(0,0,0,.28); }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: url(sprites/fill_green.png) 0 0 / 100% 100%; image-rendering: pixelated; }
.bar .fill.yellow { background-image: url(sprites/fill_yellow.png); }
.bar .fill.red { background-image: url(sprites/fill_red.png); }
.bar .fill.water { background-image: url(sprites/fill_water.png); }
.bar .mark { position: absolute; top: 0; bottom: 0; left: 85%; width: 3px; background: url(sprites/fill_red.png) 0 0 / 100% 100%; }

.parch { background: var(--parch); color: var(--ink); border: 3px solid #5a4120; border-radius: 10px; }

/* start and catch windows: css/phone.css (.hpanel); the new-entry title in green */
.hpanel h2.new { color: var(--phm-leaf); }
.hpanel .hart { min-height: 0; }
.hpanel .hcard { text-align: center; }

/* collection book */
.bpanel { width: min(460px, 100%); height: min(660px, calc(100vh - 24px)); height: min(660px, calc(100dvh - 24px)); display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.bk-head { display: flex; gap: 12px; align-items: baseline; padding: 0 4px; }
.bk-head h2 { font-family: var(--title); font-weight: 400; font-size: var(--px2); line-height: 1; margin: 0; }
.bk-head span { color: var(--muted); text-shadow: var(--ink-outline); }
.tabs { display: flex; gap: 8px; }
.tabs .tab { flex: 1; margin: 0 0 4px; padding: 2px 8px; min-height: 44px; }
.tabs .tab:not(.on) { background: linear-gradient(#fff5d0, #efd48f); }
#bk-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; align-content: start; padding: 2px; touch-action: pan-y; }
.cell {
  position: relative; aspect-ratio: 1; border: 8px solid #3a2210; border-image-source: url(../assets/herpderp/ui/slot.png);
  border-image-slice: 8 fill; border-image-width: 8px; background: transparent; padding: 0; cursor: pointer; display: grid; place-items: center;
}
/* file pixels shown 1:1 (whole device pixels); only a sprite wider than the cell is shrunk to fit */
.cell img:not(.st) { width: auto; height: auto; max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.cell.unknown img { filter: brightness(0); opacity: .45; }
.cell.sel { outline: 3px solid var(--gold); outline-offset: 1px; }
.cell .n { position: absolute; right: 0; bottom: -4px; color: var(--text); text-shadow: var(--ink-outline); }
.cell .st { position: absolute; inset: auto; left: -6px; top: -8px; width: 28px; height: 28px; }
#bk-detail { min-height: 108px; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
#bk-detail b { color: #3a1a08; }
#bk-detail .cond { color: #7a4a1a; }
#bk-detail .q { color: #5a3a1a; }
#bk-close { align-self: center; margin: 0 0 4px; min-height: 44px; }

/* HerpDerp v6 HUD zoom on large screens */
@media (min-width: 1600px) and (min-height: 900px) { #ahud, .screen > .bpanel { zoom: 1.25; } }
@media (min-width: 2400px) and (min-height: 1300px) { #ahud, .screen > .bpanel { zoom: 1.5; } }

/* 320 px phones: tighter gaps so the status tab stays on one line and the footer fits */
@media (max-width: 340px) {
  #atop { gap: 2px 8px; padding: 4px 8px 6px; }
  #atop .today { white-space: nowrap; }
  #bottom { gap: 4px; padding: 0 4px; }
  #bottom .btn { padding: 4px 8px; }
  #bottom .arrow { padding: 0 6px; }
  #place { min-width: 0; padding: 2px 6px; }
}
