/* Usability layer: keep the stone artwork, give decisions and controls room. */
:root { --muted: #c8bdad; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #ffe18a; outline-offset: 3px;
}
button.item { padding: 0; }
.ccard { font: inherit; color: var(--text); }
#quest-track .qt { width: 100%; font: inherit; font-size: 14px; text-align: left; }
.quest-more { font: inherit; font-size: 13px; color: var(--cream); background: #30291f;
  border: 1px solid var(--rim); border-radius: 6px; min-height: 36px; padding: 4px 10px; cursor: pointer; }
#inventory, #journal, #dialogue, #inv-detail, #book-note { font-size: 14px; }
.stat, .line, #inv-detail .reqs span, #inv-detail .vs, .setbonus, #journal .jq .st { font-size: 13px; }
.item .slot-name { font-size: 10px; }
#inv-detail .line em { font-size: 12px; }
#micro .skill.small { width: 44px; height: 44px; }
#worldmap { cursor: default; gap: 12px; }
#worldmap-close { min-height: 44px; padding: 6px 24px; }
#worldmap canvas { max-height: calc(100dvh - 130px); max-width: calc(100vw - 24px); object-fit: contain; }
#action-hint { position: absolute; bottom: calc(100% + 28px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(360px, 90vw); padding: 10px 14px; background: #241e19;
  border: 2px solid var(--accent); border-radius: 8px; font-size: 14px; text-align: center; }
#action-hint[hidden] { display: none; }
#settings .settings-box { max-height: calc(100dvh - 32px); overflow-y: auto; }
#settings .set-row, #settings .set-mute { font-size: 14px; }
#settings .close { top: 0; right: 0; }
#inventory #inv-close, #journal .close, #spellbook .close { top: -12px; right: -12px; }
#inv-detail { max-height: calc(100dvh - 130px); overflow-y: auto; }
#inv-detail .btns { flex-wrap: wrap; }
#inv-detail .btns button { min-height: 40px; }
#goal { font: inherit; }
@media (max-width: 1200px) {
  #inventory { top: 16px; bottom: 110px; left: auto; right: 16px; width: min(720px, calc(100vw - 32px)); max-height: none; }
  #inv-detail { position: absolute; inset: 40px 0 0; width: auto; max-height: none; z-index: 2;
    background: #302820; overflow-y: auto; }
  body.inv-open #dialogue { display: none; }
  body.inv-open #trade { top: 16px; left: 16px; right: 16px; bottom: auto; transform: none;
    width: auto; max-height: 46dvh; overflow-y: auto; }
  body:has(#trade:not([hidden])) #inventory { top: 51dvh; bottom: 12px; }
}
@media (max-width: 640px) {
  #hud { transform: none; left: 6px; }
  #hud-portrait { width: 56px; height: 70px; }
  #hud-icon { width: 76px; height: 76px; }
  #hud-level { font-size: 24px; }
  .hud-side { width: 130px; }
  #side { right: 6px; top: 8px; gap: 4px; max-width: 145px; }
  #minimap { width: 82px; height: 82px; }
  #quest-track .qt { font-size: 13px; padding: 4px 6px; }
  #actions { bottom: 6px; width: calc(100vw - 12px); border-width: 12px; padding: 0; }
  #actions .slots { display: grid; grid-template-columns: 44px 44px 1fr; gap: 4px; width: 100%; }
  #spells { grid-column: 1 / -1; grid-row: 1; justify-content: center; gap: 8px; }
  #potions { justify-content: flex-end; }
  #actions .skill, #actions .spell, #actions .potion { width: 44px; height: 44px; min-width: 44px; }
  #micro { flex-direction: row; right: 6px; bottom: 130px; gap: 2px; border-width: 8px; }
  #micro .skill.small { width: 44px; height: 44px; }
  #chat { bottom: 194px; left: 6px; width: min(300px, calc(100vw - 12px)); }
  #chat:not(:focus-within):not(:hover) #log { max-height: 48px; }
  #inventory, #journal, #spellbook { top: 12px; right: 12px; bottom: 190px; left: 12px;
    width: auto; max-height: none; }
  #editor { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 60dvh; }
  #inventory { border-width: 16px; }
  #editor, #journal, #spellbook { overflow-y: auto; }
  .inv-cols { grid-template-columns: 1fr; }
  #dialogue { max-height: 55dvh; overflow-y: auto; }
  #target-frame { bottom: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
