@font-face {
  font-family: 'Pixelify Sans';
  src: url('assets/pixelify-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --plum: #3b2a3f;
  --shadow: #5a4e7a;
  --wood-d: #6b3e26;
  --wood: #a8643a;
  --wood-l: #d9a05b;
  --parch: #f4dfaf;
  --cream: #fff6de;
  --grass-d: #3e8a3a;
  --grass: #6cc04a;
  --grass-l: #b5e05a;
  --water: #3fa3d6;
  --sky: #9fe2f5;
  --red: #d9523b;
  --blue: #3e7fc4;
  --gold: #ffc93c;
  --pink: #f27ba8;
  --teal: #3fe0c5;
  --orange: #f08a2e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1f3324;
  color: var(--cream);
  font-family: 'Pixelify Sans', ui-rounded, system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1b2e1f;
  background-image:
    url('assets/proc2/pine.png'),
    url('assets/proc2/tree.png'),
    url('assets/proc2/pine.png'),
    url('assets/proc2/tree.png'),
    radial-gradient(circle at 50% 0%, #33543a 0%, #1b2e1f 62%);
  background-repeat: repeat-y, repeat-y, repeat-y, repeat-y, no-repeat;
  background-size: 150px auto, 190px auto, 150px auto, 190px auto, cover;
  background-position: left top, left 48px top, right top, right 48px top, center;
}

#app {
  position: relative;
  width: min(100vw, 1024px);
  height: 100dvh;
  max-height: 1024px;
  overflow: hidden;
  background: #3e8a3a;
  box-shadow: 0 0 0 4px var(--plum), 0 0 0 8px #26311f, 0 24px 60px rgba(0,0,0,.6);
}

#stage { position: absolute; inset: 0; overflow: hidden; }
#game, #game canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
#game canvas { image-rendering: pixelated; touch-action: none; }

#floaters { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.floater {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'Pixelify Sans', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--plum), -1px -1px 0 var(--plum), 1px -1px 0 var(--plum), -1px 1px 0 var(--plum);
  animation: floatUp 1.15s ease-out forwards;
  white-space: nowrap;
}
.floater.cream { color: var(--cream); }
.floater.green { color: var(--grass-l); }
.floater.teal { color: var(--teal); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.8); }
  16% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

/* ---------------------------------------------------------------- top bar */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 0;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }

.wood {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #b57647, #a8643a 55%, #8d4f2e);
  border: 3px solid var(--plum);
  border-radius: 9px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), inset 0 -4px 0 rgba(0,0,0,.22), 0 4px 0 rgba(59,42,63,.45);
}

#coinPlaque {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 6px 7px;
  min-width: 128px;
}
#coinPlaque.counterPulse { animation: coinPulse .3s ease; }
@keyframes coinPulse { 0%,100% { transform: scale(1); } 45% { transform: scale(1.06); } }
#coinIcon { width: 34px; height: 34px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }
.coinText { display: flex; flex-direction: column; line-height: 1; }
#gold {
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--plum);
  letter-spacing: .5px;
}
#rate { font-size: 11px; color: var(--grass-l); margin-top: 4px; text-shadow: 1px 1px 0 #2b3e22; white-space: nowrap; }
.rivet { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--wood-l); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 1px rgba(0,0,0,.5); }
.rivet.tl { left: 4px; top: 4px; }
.rivet.br { right: 4px; bottom: 4px; }

#houseRow {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 2px;
  min-width: 0;
  overflow: hidden;
}
.hslot {
  width: 32px;
  height: 32px;
  flex: 0 1 auto;
  background: #5a3a28;
  border: 2px solid var(--plum);
  border-radius: 5px;
  box-shadow: inset 0 2px 0 rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background .2s, box-shadow .2s;
}
.hslot img { width: 92%; height: 92%; object-fit: contain; image-rendering: pixelated; }
.hslot.empty img { filter: grayscale(.85) brightness(.62) opacity(.7); }
.hslot.lit {
  background: #7a5230;
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 7px rgba(255,201,60,.55);
}

#topRight { display: flex; align-items: flex-start; gap: 5px; margin-left: auto; }
#clock { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clockFace {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid var(--wood-d);
  background: linear-gradient(180deg, #9fe2f5 0%, #9fe2f5 45%, #3fa3d6 46%, #2f7fae 100%);
  box-shadow: 0 0 0 2px var(--plum), inset 0 2px 0 rgba(255,255,255,.4);
  overflow: hidden;
}
.clockFace img { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); image-rendering: pixelated; }
#clockHand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 3px;
  height: 19px;
  margin-left: -1px;
  background: var(--plum);
  border-radius: 2px 2px 0 0;
  transform-origin: bottom center;
  box-shadow: 0 0 0 1px rgba(255,246,222,.35);
}
#clockText {
  font-size: 10px;
  color: var(--cream);
  background: var(--wood-d);
  border: 2px solid var(--plum);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 rgba(0,0,0,.4);
}
.roundWood {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 3px solid var(--plum);
  background: linear-gradient(180deg, #b57647, #8d4f2e);
  color: var(--cream);
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.28), 0 3px 0 rgba(59,42,63,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.roundWood:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.28), 0 1px 0 rgba(59,42,63,.5); }
.roundWood.off { color: #c9b8a7; filter: brightness(.85); }

/* ---------------------------------------------------------------- hotbar */
#hotbar {
  position: absolute;
  left: 8px; right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 21;
  display: flex;
  gap: 4px;
  padding: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, #b57647, #a8643a 55%, #8d4f2e);
  border: 3px solid var(--plum);
  border-radius: 10px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), inset 0 -4px 0 rgba(0,0,0,.2), 0 5px 0 rgba(59,42,63,.45);
}
.slot {
  flex: 1 1 0;
  min-width: 0;
  height: 66px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 2px 3px;
  background: linear-gradient(180deg, #6b3e26, #5a3320);
  border: 2px solid var(--plum);
  border-radius: 6px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.1), inset 0 -3px 0 rgba(0,0,0,.25);
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.slot img.slotIcon { width: 100%; height: 40px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); pointer-events: none; }
.slot .slotCost {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #3b2a3f;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--cream);
  line-height: 1;
  margin-top: 1px;
  white-space: nowrap;
}
.slot .slotCost img { width: 11px; height: 11px; image-rendering: pixelated; }
.slot.afford { box-shadow: inset 0 0 0 2px var(--gold), 0 0 9px rgba(255,201,60,.45); }
.slot.selected { outline: 2px solid var(--cream); outline-offset: -3px; }
.slot.empty .slotIcon { filter: grayscale(.75) brightness(.7) opacity(.8); }
.slot:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- dialogue */
#dialogue {
  position: absolute;
  left: 10px; right: 10px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 23;
  display: flex;
  justify-content: center;
  animation: dlgIn .24s cubic-bezier(.2,1.4,.5,1) both;
}
#dialogue.hidden { display: none; }
@keyframes dlgIn { from { transform: translateY(26px); opacity: 0; } }
.dlgFrame {
  width: min(680px, 100%);
  display: flex;
  gap: 7px;
  padding: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #b57647, #a8643a 55%, #8d4f2e);
  border: 3px solid var(--plum);
  border-radius: 10px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.22), 0 6px 0 rgba(59,42,63,.35);
  cursor: pointer;
}
.dlgPortrait {
  position: relative;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  background: #6b3e26;
  border: 3px solid var(--plum);
  border-radius: 6px;
  overflow: hidden;
}
.dlgPortrait img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.dlgPortrait span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: #6b3e26;
  border-top: 2px solid var(--plum);
  color: var(--cream);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 1px 0 2px;
}
.dlgSpeech {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  background: var(--parch);
  border: 3px solid var(--wood-d);
  border-radius: 6px;
  padding: 9px 12px 18px;
  color: var(--plum);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5);
}
.dlgSpeech p { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 600; }
.dlgNext {
  position: absolute;
  right: 9px; bottom: 3px;
  color: var(--wood-d);
  font-size: 12px;
  animation: bobY .9s ease-in-out infinite;
}
@keyframes bobY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ---------------------------------------------------------------- panel */
#panel {
  position: absolute;
  z-index: 24;
  right: 12px;
  top: 92px;
  width: 304px;
  padding: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, #b57647, #a8643a 55%, #8d4f2e);
  border: 4px solid var(--plum);
  border-radius: 12px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.24), 0 8px 0 rgba(59,42,63,.4), 0 16px 32px rgba(0,0,0,.35);
  animation: panelIn .2s cubic-bezier(.2,1.4,.5,1) both;
}
#panel.hidden { display: none; }
@keyframes panelIn { from { transform: translateY(18px) scale(.96); opacity: 0; } }
#panel::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 7px;
  background: var(--parch);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), inset 0 -2px 0 rgba(107,62,38,.25);
  z-index: -1;
}
#panelClose {
  position: absolute;
  top: -10px; right: -10px;
  width: 32px; height: 32px;
  border-radius: 7px;
  border: 3px solid var(--plum);
  background: linear-gradient(180deg, #d9a05b, #a8643a);
  color: var(--plum);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(59,42,63,.45);
  z-index: 2;
}
#panelClose:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(59,42,63,.45); }
.panelHead { display: flex; gap: 10px; align-items: center; margin: 2px 4px 6px; }
.panelArt {
  flex: 0 0 auto;
  width: 76px; height: 76px;
  background: #cde8b0;
  border: 3px solid var(--wood-d);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.panelArt img { max-width: 94%; max-height: 94%; object-fit: contain; image-rendering: pixelated; }
.panelTitle h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1;
  color: var(--plum);
  font-weight: 700;
}
#panelLevel {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 7px;
  background: var(--wood-d);
  color: var(--cream);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
}
#panelProd {
  margin: 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: #2f6b2f;
}
#panelFlavour {
  margin: 5px 4px 10px;
  font-size: 13px;
  line-height: 1.3;
  color: #5b4230;
  min-height: 34px;
}
.panelFoot { display: flex; gap: 8px; align-items: stretch; margin: 0 4px 2px; }
#panelCost {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: var(--parch);
  border: 2px solid var(--wood-d);
  border-radius: 6px;
  color: var(--plum);
  font-size: 16px;
  font-weight: 700;
}
#panelCost img { width: 18px; height: 18px; image-rendering: pixelated; }
#panelAction {
  flex: 1 1 auto;
  min-height: 44px;
  border: 3px solid var(--plum);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffe16a, var(--gold) 55%, #e5a12a);
  color: var(--plum);
  font-family: 'Pixelify Sans', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.6), inset 0 -3px 0 rgba(133,79,12,.4), 0 4px 0 rgba(59,42,63,.45);
  cursor: pointer;
}
#panelAction:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 2px 0 rgba(59,42,63,.45); }
#panelAction:disabled { filter: grayscale(.6) brightness(.9); color: #7a6b58; cursor: default; }
#panelAction.maxed { background: linear-gradient(180deg, #c9d8b4, #a9bd90); }

/* ---------------------------------------------------------------- banner */
#banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(560px, 92%);
  animation: bannerDrop .6s cubic-bezier(.2,1.3,.5,1) both;
}
#banner.hidden { display: none; }
.bannerCloth {
  background: linear-gradient(180deg, #4f93d8, #3e7fc4 60%, #2f5f9a);
  border-top: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 6px 0 rgba(59,42,63,.4), inset 0 2px 0 rgba(255,255,255,.3);
  padding: 14px 20px;
  text-align: center;
  position: relative;
}
.bannerCloth::before, .bannerCloth::after {
  content: '';
  position: absolute;
  top: 100%;
  width: 0; height: 0;
  border-top: 18px solid #2f5f9a;
}
.bannerCloth::before { left: 0; border-right: 22px solid transparent; }
.bannerCloth::after { right: 0; border-left: 22px solid transparent; }
.bannerCloth span {
  font-size: clamp(22px, 5vw, 38px);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--plum), -1px -1px 0 var(--plum);
  letter-spacing: 1px;
}
@keyframes bannerDrop { from { transform: translate(-50%, -40px) scaleY(.2); opacity: 0; } }

/* ---------------------------------------------------------------- modal */
#modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(24, 20, 28, .82);
}
#modal.hidden { display: none; }
.parchmentModal {
  position: relative;
  width: min(460px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 22px 20px 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.35), transparent 45%),
    linear-gradient(180deg, #f8e7bf, #f4dfaf 60%, #e8cd94);
  border: 6px solid var(--wood-d);
  border-radius: 8px;
  box-shadow: 0 0 0 3px var(--plum), inset 0 3px 0 rgba(255,255,255,.6), 0 12px 0 rgba(0,0,0,.35), 0 24px 50px rgba(0,0,0,.5);
  color: var(--plum);
  text-align: center;
  animation: popIn .24s cubic-bezier(.2,1.4,.5,1) both;
}
@keyframes popIn { from { transform: scale(.92); opacity: 0; } }
.parchmentModal h2 {
  margin: 2px 0 12px;
  font-size: 27px;
  line-height: 1.1;
  color: var(--plum);
  text-shadow: 0 2px 0 rgba(255,255,255,.45);
}
.parchmentModal p { margin: 8px 0; font-size: 14px; line-height: 1.35; color: #5b4230; }
.parchmentModal p.dim { color: #80684f; font-size: 12px; }
.parchmentModal .big {
  font-size: 34px;
  font-weight: 700;
  color: var(--wood-d);
  margin: 10px 0 4px;
  text-shadow: 0 2px 0 rgba(255,255,255,.5);
}
.parchmentModal .row { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.parchmentModal .legend { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; text-align: left; margin: 12px 0; font-size: 13px; align-items: center; }
.parchmentModal .legend b {
  font-size: 11px;
  background: var(--wood-d);
  color: var(--cream);
  border: 2px solid var(--plum);
  border-radius: 4px;
  padding: 4px 6px;
  text-align: center;
  white-space: nowrap;
}
.leader { margin: 8px 0; text-align: left; }
.leader div { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; font-size: 13px; border-bottom: 2px dashed rgba(107,62,38,.25); }
.leader div.me { background: rgba(255,201,60,.22); border-radius: 4px; }
.leader span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader span:last-child { font-weight: 700; color: var(--wood-d); white-space: nowrap; }

.clothBtn {
  min-height: 44px;
  padding: 9px 16px;
  border: 3px solid var(--plum);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffe16a, var(--gold) 55%, #e5a12a);
  color: var(--plum);
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 4px 0 rgba(59,42,63,.4);
}
.clothBtn:active { transform: translateY(2px); box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 2px 0 rgba(59,42,63,.4); }
.clothBtn.ghost {
  background: linear-gradient(180deg, #e7d1a2, #d9bd85);
  color: var(--wood-d);
}

.seal {
  width: 54px; height: 54px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e86a5c, #c53b30 60%, #a02a22);
  border: 3px solid #7e1f19;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 3px 0 rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  color: #f7c8a0;
  font-size: 22px;
  font-weight: 700;
}

.portraitRow { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.portraitRow img {
  width: 54px; height: 54px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 3px solid var(--wood-d);
  border-radius: 6px;
  background: #cde8b0;
}

/* ---------------------------------------------------------------- banner / splash */
#splash {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, #4c7a45, #2c4a2e 65%, #1f3324),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 16px);
  transition: opacity .4s ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splashInner { text-align: center; }
.splashInner .crest { font-size: 54px; color: var(--gold); line-height: 1; text-shadow: 0 4px 0 var(--plum); }
.splashInner h2 { margin: 14px 0 8px; font-size: 30px; color: var(--cream); text-shadow: 0 3px 0 var(--plum); letter-spacing: 2px; }
.splashInner p { margin: 0; font-size: 14px; color: var(--grass-l); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  #app { box-shadow: none; }
  #topbar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  #coinPlaque { min-width: 104px; padding: 4px 8px 5px 5px; gap: 5px; }
  #coinIcon { width: 27px; height: 27px; }
  #gold { font-size: 18px; }
  #rate { font-size: 9px; margin-top: 3px; }
  #houseRow { gap: 2px; }
  .hslot { width: 22px; height: 24px; border-width: 2px; }
  #topRight { gap: 3px; }
  .clockFace { width: 42px; height: 42px; border-width: 3px; }
  .clockFace img { width: 24px; height: 24px; }
  #clockHand { height: 15px; width: 2px; }
  #clockText { font-size: 8px; padding: 0 3px; border-width: 1px; }
  .roundWood { width: 30px; height: 30px; font-size: 14px; border-width: 2px; }
  #hotbar { left: 4px; right: 4px; bottom: calc(4px + env(safe-area-inset-bottom)); padding: 4px; gap: 3px; border-width: 3px; }
  .slot { height: 55px; padding: 1px 1px 2px; border-radius: 5px; }
  .slot img.slotIcon { height: 31px; }
  .slot .slotCost { font-size: 8px; padding: 1px 2px; }
  .slot .slotCost img { width: 9px; height: 9px; }
  #dialogue { bottom: calc(70px + env(safe-area-inset-bottom)); left: 6px; right: 6px; }
  .dlgPortrait { width: 64px; height: 64px; }
  .dlgPortrait span { font-size: 8px; }
  .dlgSpeech { padding: 7px 9px 16px; }
  .dlgSpeech p { font-size: 12.5px; }
  #panel {
    left: 6px; right: 6px; top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: auto;
    padding: 8px;
    border-width: 3px;
  }
  .panelArt { width: 60px; height: 60px; }
  .panelTitle h2 { font-size: 21px; }
  #panelProd { font-size: 14px; }
  #panelFlavour { font-size: 12px; min-height: 0; margin-bottom: 7px; }
  #panelCost { font-size: 14px; padding: 0 7px; }
  #panelAction { font-size: 15px; min-height: 42px; }
  #banner { top: 20%; }
}
@media (max-height: 620px) {
  .hslot { width: 24px; height: 24px; }
  #hotbar { height: auto; }
  .slot { height: 50px; }
  .slot img.slotIcon { height: 27px; }
  #panel { top: 70px; }
  .panelArt { width: 54px; height: 54px; }
  #panelFlavour { display: none; }
}
@media (min-width: 820px) {
  .hslot { width: 40px; height: 40px; }
  #hotbar { padding: 8px; gap: 6px; bottom: 10px; left: 12px; right: 12px; }
  .slot { height: 80px; }
  .slot img.slotIcon { height: 50px; }
  .slot .slotCost { font-size: 12px; }
  #dialogue { bottom: 104px; }
  #panel { width: 330px; top: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.coinFly {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: 0;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 36;
  filter: drop-shadow(0 2px 0 rgba(59,42,63,.4));
}

@media (max-width: 380px) {
  #coinPlaque { min-width: 86px; padding: 3px 6px 4px 4px; gap: 4px; }
  #coinIcon { width: 21px; height: 21px; }
  #gold { font-size: 15px; }
  #rate { font-size: 7.5px; margin-top: 2px; }
  #houseRow { gap: 1px; }
  .hslot { width: 15px; height: 18px; border-width: 2px; }
  #topRight { gap: 2px; }
  .clockFace { width: 34px; height: 34px; border-width: 2px; }
  .clockFace img { width: 19px; height: 19px; }
  #clockHand { height: 11px; width: 2px; }
  #clockText { font-size: 7px; padding: 0 2px; border-width: 1px; }
  .roundWood { width: 24px; height: 24px; font-size: 12px; border-width: 2px; }
}

/* larger touch targets without changing the cosy artwork */
.roundWood {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  font-size: 17px;
  z-index: 1;
}
.roundWood::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 8px;
  border: 3px solid var(--plum);
  background: linear-gradient(180deg, #b57647, #8d4f2e);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.28), 0 3px 0 rgba(59,42,63,.5);
}
.roundWood:active { transform: none; box-shadow: none; }
.roundWood:active::before { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.28), 0 1px 0 rgba(59,42,63,.5); }
.roundWood.off { color: #c9b8a7; }
.roundWood.off::before { filter: brightness(.85); }
#panelClose { width: 44px; height: 44px; top: -14px; right: -14px; font-size: 17px; }
@media (max-width: 560px) {
  .roundWood { width: 40px; height: 40px; font-size: 15px; }
  .roundWood::before { inset: 4px; border-width: 2px; }
  #panelClose { width: 44px; height: 44px; top: -14px; right: -14px; }
  #topRight { gap: 1px; }
}

.roundWood > span { position: relative; z-index: 2; display: block; }


.panelRivet {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe2a8, #d9a05b 55%, #8a5426);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 0 rgba(0,0,0,.4);
  z-index: 3;
  pointer-events: none;
}
.panelRivet.tl { left: 5px; top: 5px; }
.panelRivet.tr { right: 5px; top: 5px; }
.panelRivet.bl { left: 5px; bottom: 5px; }
.panelRivet.br { right: 5px; bottom: 5px; }

button:focus-visible, .hslot:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.slot:hover, .slot:focus-visible {
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 10px rgba(255,201,60,.45);
}
.hslot { cursor: pointer; }
.hslot:hover { box-shadow: inset 0 0 0 2px var(--gold), 0 0 8px rgba(255,201,60,.45); }
#panelAction:hover:not(:disabled), .clothBtn:hover, .roundWood:hover, .iconbtn:hover {
  filter: brightness(1.08);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
