/* Fairy-tale HUD: an independent, last-loaded presentation layer.
   No game-state or world-position rules live here. */
:root {
  --ui-parchment: #fff6df;
  --ui-wood: #553b38;
  --ui-blue: #1c354f;
  --ui-gold: #f1c56b;
}
.topbar {
  gap: 13px;
  padding: 10px clamp(10px,2vw,26px);
  background: linear-gradient(180deg,rgba(12,25,52,.96),rgba(16,34,61,.78) 72%,transparent) !important;
}
.brand { min-width: 168px; }
.brand-mark { border-radius: 12px; background: linear-gradient(145deg,#b78343,#594434); box-shadow: inset 0 2px 0 #ffe5a6a6,0 3px 12px #08162d88; }
.brand b { color: #fff2d5; text-shadow: 0 2px 3px #060f2490; }
.resource {
  min-width: 103px;
  gap: 9px;
  padding: 7px 12px;
  background: linear-gradient(180deg,#fffaf0,#f4e7cf);
  border: 1px solid #f9e4bb;
  border-bottom-color:#b88a51;
  box-shadow: 0 3px 0 #98744855,0 6px 16px #0719325c;
}
.resource-icon { background:#f7ddb0; border-radius:50%; }
.resource b { font-variant-numeric: tabular-nums; }
.icon-button { background:linear-gradient(180deg,#674d42,#3d3a43);border-color:#d8bb80; box-shadow: 0 3px 0 #201e2b; }
.quest-card {
  top: clamp(102px,12vh,145px);
  right: clamp(12px,2vw,32px);
  width: min(296px,26vw);
  padding: 18px 17px 16px;
  border: 2px solid #caa56a;
  border-radius: 19px;
  background: linear-gradient(145deg,rgba(255,249,232,.98),rgba(239,222,182,.97)) !important;
  box-shadow: 0 7px 0 #7b513155,0 14px 30px #091e3766;
}
.quest-eyebrow { padding-right: 28px; color:#946528; }
.quest-card h2 { margin:10px 0 9px; font:700 clamp(18px,1.45vw,22px)/1.16 Georgia,serif; color:#44372e; }
.quest-card p { font-size: 12px; line-height: 1.5; color:#5d625c; }
.quest-footer button,.primary-action { min-height:39px; background:linear-gradient(180deg,#ffe4a2,#e5b55b); color:#513b29; border:1px solid #c28d42;box-shadow:0 3px 0 #a67539; }
.quest-footer button:focus-visible,.primary-action:focus-visible { outline-color:#204f6e; }
.quest-footer button:hover:not(:disabled),.primary-action:hover:not(:disabled) {filter:brightness(1.04)}
.quest-toggle { position:absolute;top:12px;right:12px;z-index:2;display:grid;place-items:center;width:28px;height:28px;border:1px solid #d7bd89;border-radius:50%;background:#fff5d9;color:#705239;font-weight:bold;font-size:21px;line-height:1; }
.quest-card.collapsed { width: min(260px,28vw);padding:12px 15px 10px; }
.quest-card.collapsed .quest-details { display:none; }
.quest-card.collapsed .quest-eyebrow { margin-right:4px; }
.bottom-nav {
  gap: 7px;
  padding: 7px;
  border:1px solid #d8bf8c;
  border-radius:17px;
  background:linear-gradient(180deg,#55483f,#302f3b) !important;
  box-shadow:0 4px 0 #1b2635,0 10px 30px #06182e80;
}
.nav-item { min-height:47px;min-width:113px;padding:10px 12px;gap:6px;color:#fff4db; border-radius:11px; }
.nav-item span { color:#ffd991; }
.nav-item.active { background:linear-gradient(180deg,#ffedbf,#f4c971);border:1px solid #ffebbd;color:#59412f;box-shadow:0 2px 0 #b48342; }
.nav-item:hover:not(.active){background:#ffffff19}
.object-panel:not(.is-workshop-panel) {
  width:min(365px,calc(100vw - 20px));
  grid-template-columns:90px minmax(0,1fr);
  border:2px solid #cba771;
  border-radius:20px;
  background:linear-gradient(150deg,#fff9e9,#eddfc6);
  box-shadow:0 7px 0 #83603b60,0 18px 44px #0a1e39a8;
}
.object-panel:not(.is-workshop-panel) .panel-art { background:radial-gradient(ellipse,#fff6d9,#ddd9c6);border:1px solid #e7d2a9; }
.object-panel:not(.is-workshop-panel) .panel-kicker { color:#996727; }
.object-panel:not(.is-workshop-panel) .panel-content h2 { color:#4c382c; }
.object-panel:not(.is-workshop-panel) .panel-content>p { color:#655f55; font-size:11px; }
.panel-close { background:#f1dfbf;border:1px solid #d0b58c;color:#684e36; }
.modal { max-height:min(88dvh,760px);overflow:auto;overscroll-behavior:contain; }
/* Compact HUD on narrow screens leaves the playable world visible. */
@media(max-width:900px){
  .topbar{gap:6px;padding:8px 9px}
  .brand{min-width:auto}
  .brand-mark{width:34px;height:34px}
  .brand b{font-size:17px}
  .resources{gap:5px;margin-left:auto}
  .resource{min-width:0;padding:5px 7px;gap:4px;border-radius:10px}
  .resource-icon{width:23px;height:23px}
  .resource small{font-size:8px}
  .resource b{font-size:13px}
  .quest-card{top:78px;right:8px;width:min(258px,58vw);padding:12px}
  .quest-card.collapsed{width:min(218px,56vw)}
  .quest-card p{font-size:10px}
  .quest-card h2{font-size:17px}
  .quest-toggle{top:8px;right:8px;width:26px;height:26px}
  .bottom-nav{left:8px;right:8px;bottom:calc(8px + env(safe-area-inset-bottom));transform:none;gap:3px;padding:4px}
  .nav-item{flex:1;min-width:0;min-height:52px;display:flex;flex-direction:column;justify-content:center;gap:2px;padding:6px 3px;font-size:9px}
  .nav-item span{font-size:18px}
  .object-panel:not(.is-workshop-panel){left:8px;right:8px;bottom:calc(76px + env(safe-area-inset-bottom));width:auto;grid-template-columns:75px minmax(0,1fr);padding:12px}
}
@media(max-width:500px){
  .brand small{display:none}
  .brand b{font-size:15px}
  .brand-mark{width:29px;height:29px;font-size:18px}
  .resource{padding:4px 5px}
  .resource-icon{display:none}
  .resource small{font-size:7px}
  .resource b{font-size:12px}
  .icon-button{width:32px;height:32px;flex:0 0 32px}
  .quest-card{width:min(220px,61vw)}
  .quest-card.collapsed{width:min(192px,59vw)}
}
@media(max-height:650px) and (min-width:901px){
  .quest-card{top:79px}
  .object-panel:not(.is-workshop-panel){bottom:82px}
}
@media(prefers-reduced-motion:reduce){.quest-toggle,.nav-item{transition:none}}

/* Camera gestures apply to the empty scenery only; interactive buttons keep native clicks. */
.scene { touch-action: none; }
.scene .world-object, .scene .quest-card, .scene .quest-card button { touch-action: manipulation; }
.scene:focus-visible { outline: 2px solid #ffe5a1; outline-offset: -3px; }
