:root {
  font-family: Inter, system-ui, sans-serif;
  color: #222;
  background: #333;
  font-size: 14px;
  color-scheme: light;
  --ink: #222;
  --line: #555;
  --paper: #fff;
  --shade: #efefef;
  --touch: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: grid; place-items: center; overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
button {
  min-width: var(--touch);
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 4px 10px;
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
}
@media (hover: hover) { button:hover:not(:disabled) { background: #dedede; } }
button:disabled { background: #f2f2f2; color: #666; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #222; outline-offset: 2px; }
button.primary, button[aria-pressed=true], button.learned { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (hover: hover) { button.primary:hover:not(:disabled), button[aria-pressed=true]:hover:not(:disabled), button.learned:hover:not(:disabled) { background: #444; } }
button.primary:disabled { background: #777; color: #fff; border-color: #777; }
input, select { min-height: var(--touch); border: 1px solid #666; border-radius: 5px; padding: 4px 8px; width: 100%; background: white; }
label { display: grid; gap: 4px; font-weight: 600; min-width: 0; }
h1, h2, p, ol { margin: 0; }
h1 { font-size: 1.45rem; line-height: 1.15; }
h2 { font-size: 1.05rem; line-height: 1.2; }
hr { border: 0; border-top: 1px solid #ccc; margin: 4px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#game { position: relative; width: min(100vw, 177.7778dvh, 1280px); aspect-ratio: 16 / 9; overflow: hidden; background: #dcdcdc; isolation: isolate; }
#game:has(.creation) { min-height: min(400px, 100dvh); }
#game[aria-busy=true]::after { content: 'Loading Lepakland…'; position: absolute; inset: 0; display: grid; place-items: center; }
#world, #scenery, #hud, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#world { image-rendering: pixelated; }
#scenery, #hud, #overlay { pointer-events: none; }
#hud button, #hud input, #scenery button, #overlay > * { pointer-events: auto; }
#feedback { position: absolute; z-index: 6; bottom: 18%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 86%; padding: 9px 15px; border: 1px solid #222; border-radius: 6px; background: #fff; font-weight: 700; pointer-events: none; }
#feedback:empty { display: none; }
#orientation, .touch-ui, .mobile-only, .mobile-chat-bar { display: none; }
.panel { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); padding: 9px 11px; display: flex; flex-direction: column; gap: 7px; }
.panel-heading, .pair, .screen-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-heading > span { font-size: .9em; text-align: right; }
.label, legend { text-transform: uppercase; font-size: .72rem; letter-spacing: .055em; font-weight: 750; }
.meter { display: inline-block; min-width: 12px; height: 7px; background: #ddd; border-radius: 5px; overflow: hidden; }
.meter i { display: block; height: 100%; background: #555; }
.vital { display: grid; grid-template-columns: 24px 1fr minmax(43px,auto); align-items: center; gap: 6px; font-size: .85rem; }
.vital span:last-child { text-align: right; }
.world-feature, .world-hit, .world-name { position: absolute; left: var(--x); top: var(--y); }
.world-feature { width: var(--w); height: var(--h); color: #474747; font-size: .86rem; font-weight: 650; padding: 5px 7px; }
.world-feature.round, .world-feature.campfire { display: grid; place-items: center; }
.world-feature button, .world-hit button { background: #eeeeeed9; }
@media (hover: hover) { .world-feature button:hover, .world-hit button:hover { background: white; } }
.world-hit { transform: translate(-50%, -50%); }
.world-hit button { font-size: .72rem; padding-inline: 5px; min-height: 44px; }
.world-place { transform: translate(-50%, calc(-100% - 4px)); transition: opacity .2s; }
.world-place.below { transform: translate(-50%, 4px); }
.world-place.from-left { transform: translate(0, calc(-100% - 4px)); }
.world-place.from-right { transform: translate(-100%, calc(-100% - 4px)); }
.world-place.below.from-left { transform: translate(0, 4px); }
.world-place.below.from-right { transform: translate(-100%, 4px); }
.world-place.near { opacity: .7; }
.world-place.cold button { opacity: .55; text-decoration: line-through; }
.world-place.near:hover, .world-place.near:focus-within { opacity: 1; }
.world-place button { position: relative; white-space: nowrap; }
@media (max-width: 700px) {
  .world-place button { min-height: 22px; min-width: 0; padding: 1px 5px; font-size: .62rem; border-radius: 4px; }
  .world-place button::before { content: ''; position: absolute; inset: -11px -4px; }
}
.world-name { transform: translateX(-50%); font-size: .78rem; font-weight: 700; text-align: center; white-space: nowrap; }
.world-name > span { display: inline-block; margin-top: 4px; padding: 1px 3px; border-radius: 3px; background: #ffffffe8; }
.world-actor {
  width: 5.3%; height: 19%; transform: translate(-50%, -100%);
  padding: 0; border: 0; background: transparent;
}
.world-actor:hover:not(:disabled) { background: transparent; }
.world-actor > span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); }
.world-actor:hover > span, .world-actor:focus-visible > span { text-decoration: underline; }
#hud > .panel, .auto-bar, .hotbar, .desktop-menu, .rare { position: absolute; }
.status { top: 2.22%; left: 1.25%; width: 22%; }
.party { top: 17%; left: 1.25%; width: 14%; }
.minimap, .inspect, .last, .outing-log, .next { right: 1.25%; width: 16%; }
.minimap { top: 2.22%; }
.minimap-button { min-height: clamp(52px, 7.5vw, 96px); background: #e8e8e8; border-style: dashed; }
.inspect, .outing-log { top: 23.4%; }
.last { top: 43.8%; }
.next { top: 54%; border-style: dashed; }
.chat { left: 1.25%; bottom: 2.22%; width: 26.5%; height: 24%; gap: 4px; }
.chat-tabs, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chat-tabs button { flex: 1; }
.messages { flex: 1; overflow: auto; min-height: 0; overflow-wrap: anywhere; font-size: .85rem; }
.hotbar { bottom: 2.22%; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 5px; }
.habit-strip, .hot-slots { border: 1px solid #555; border-radius: 6px; background: #fff; display: flex; align-items: center; gap: 5px; padding: 4px 6px; }
.hot-slots { background: #ececec; }
.hot-slot button { width: clamp(44px, 3.75vw, 48px); height: clamp(44px, 3.75vw, 48px); padding: 2px; font-size: .78rem; line-height: 1.05; }
.hotbar small { background: #ededed; padding: 2px 4px; }
.hot-slot.spotlight button { outline: 2px solid #222; outline-offset: 2px; }
.locked { border: 1px dashed #888; color: #555; border-radius: 5px; padding: 4px; }
.desktop-menu { bottom: 2.22%; right: 1.25%; display: flex; gap: 4px; }
.auto-bar { left: 31.25%; top: 2.22%; width: 37.5%; flex-direction: row; align-items: center; background: #222; color: white; }
.auto-bar > div { flex: 1; min-width: 0; }
.auto-bar button { color: #222; }
.lap-meter { display: flex; gap: 4px; margin-top: 4px; }
.lap-meter .meter { flex: 1; height: 5px; background: #727272; }
.lap-meter i { background: white; }
.rare { top: 13%; left: 50%; transform: translateX(-50%); }
.rare button { border-width: 2px; }
.guide { top: 2.22%; left: 31.25%; width: 37.5%; }
.guide p { line-height: 1.4; }
.checklist { top: 2.22%; right: 1.25%; width: 18%; }
.quest-objectives { display: grid; gap: 3px; padding-left: 1.5rem; }
.checklist .quest-objectives { font-size: .86rem; }
.quest-log .quest-objectives { margin-block: 4px; }
.current { font-weight: 750; }
.screen { position: absolute; inset: 0; background: #c4c4c4; padding: clamp(12px, 1.875vw, 24px); display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.screen-head { flex: none; }
.screen-head .actions { justify-content: flex-end; }
.columns { display: grid; flex: 1; min-height: 0; gap: 12px; }
.columns > .panel { min-width: 0; min-height: 0; overflow: auto; }
.screen.creation { align-items: center; gap: 5px; container-type: size; }
.creation > .screen-head, .creation > .create-columns { width: min(100%, 660px); }
.creation > .screen-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: max(0px, calc((100cqh - 350px) / 2));
}
.character-controls {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 21rem);
  justify-content: end;
  gap: 6px;
}
.character-controls > button { grid-column: 1; grid-row: 1; padding-inline: 4px; }
.character-slots {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.character-slots button {
  min-width: min(var(--touch), 100%);
  width: 100%;
  padding-inline: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.create-columns { grid-template-columns: minmax(128px, 1fr) minmax(0, 1.8fr); flex: none; }
.preview { display: grid; place-content: center; justify-items: center; flex: 1; min-height: 108px; border: 1px dashed #999; background: #e6e6e6; border-radius: 4px; overflow: hidden; }
.preview canvas { width: min(var(--preview-width), 100%); height: auto; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.preview small { color: #333; text-align: center; }
.create-preview .preview { min-height: 68px; }
.create-preview .preview canvas { width: min(var(--preview-width), 100%, 30cqh); }
.create-preview .actions { justify-content: center; }
.create-preview .actions button { padding-inline: 6px; }
.create-fields form { display: grid; gap: 6px; }
.create-identity, .create-name, .appearance-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.create-identity { align-items: end; }
.create-name { grid-template-columns: auto minmax(0, 1fr); }
.create-name input { grid-column: 1 / -1; }
#availability { text-align: right; font-size: .85rem; }
.appearance-picker { display: grid; gap: 3px; font-weight: 600; }
.appearance-selector {
  display: grid;
  grid-template-columns: var(--touch) minmax(0, 1fr) var(--touch);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
}
.appearance-selector button {
  padding: 0;
  border: 0;
  background: var(--shade);
  font-size: 1.5rem;
  line-height: 1;
  touch-action: manipulation;
}
.appearance-selector button:first-child { border-radius: 5px 0 0 5px; }
.appearance-selector button:last-child { border-radius: 0 5px 5px 0; }
.appearance-selector output { font-size: .85rem; overflow-wrap: anywhere; }
.gear-columns { grid-template-columns: 28% 1fr 23%; }
.paper-doll { display: grid; grid-template-columns: minmax(64px, 1fr) minmax(64px, 1.6fr) minmax(64px, 1fr); gap: 5px; }
.paper-doll > div:not(.preview) { display: grid; gap: 6px; }
.paper-doll > div:not(.preview) div, .slot { min-height: 48px; display: grid; place-content: center; text-align: center; background: #eee; border: 1px solid #888; border-radius: 5px; font-size: .8rem; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 9px; }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 5px; }
.bag-grid button, .bag-grid > span { min-height: 48px; min-width: 44px; padding: 2px; font-size: .78rem; }
.bag-grid > span { border: 1px dashed #a5a5a5; background: #f5f5f5; border-radius: 5px; }
.bag-grid .uncommon { border-width: 2px; }
.bag-grid .rare { position: static; border-width: 3px; transform: none; }
.item-icon { min-height: 90px; display: grid; place-content: center; background: #e6e6e6; border: 1px dashed #aaa; }
.skill-columns { grid-template-columns: 31% 1fr 18%; }
.trees { display: grid; gap: 5px; }
.combat-tree { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.routine-tree { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trees > div { display: grid; align-content: start; gap: 6px; }
.trees button { overflow-wrap: anywhere; min-height: 48px; padding-inline: 2px; }
.routine-detail { display: grid; gap: 6px; background: #eee; border-radius: 6px; padding: 8px; }
.habit-slots > button { width: 100%; }
.plan-columns { grid-template-columns: 34% 1fr 21%; }
.zone-grid { position: relative; min-height: 150px; margin: 16px; flex: 1; border: 1px dashed #888; background-color: #e6e6e6; background-image: repeating-linear-gradient(0deg, transparent 0 19px, #ccc 19px 20px), repeating-linear-gradient(90deg, transparent 0 19px, #ccc 19px 20px); cursor: crosshair; }
.route-marker { position: absolute; transform: translate(-50%, -50%); }
.route-marker button { border-radius: 50%; }
.loop-step { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; min-height: 48px; padding: 3px 6px; gap: 6px; border: 1px solid #888; border-radius: 5px; }
.loop-step > span { display: grid; place-content: center; border: 1px solid #555; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; }
.step-edit, .stop-settings { align-items: end; }
.step-edit label, .stop-settings label { flex: 1; min-width: 90px; }
.forecast-actions { margin-top: auto; display: grid; gap: 5px; }
.modal-screen { background: #0005; align-items: center; justify-content: safe center; }
.modal { width: min(100%, 1120px); max-height: 100%; overflow: auto; }
.compact-modal { width: min(100%, 460px); }
.class-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: auto; }
.class-card { overflow: visible !important; }
.class-top { display: grid; grid-template-columns: 40% 1fr; gap: 7px; }
.class-top .pair { margin-top: 5px; }
.class-modal footer p { flex: 1; min-width: 160px; }
.away-columns { grid-template-columns: 1fr 1fr; overflow: auto; }
.away-columns > div { display: grid; align-content: start; gap: 8px; min-width: 0; }
.away-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.away-totals .pair, .notable, .away-loot span { border: 1px solid #888; border-radius: 5px; padding: 8px; }
.notable { font-weight: 700; }
.notable.rare { position: static; transform: none; border-width: 2px; }
.away-loot { display: flex; flex-wrap: wrap; gap: 5px; }
.timeline ol { display: grid; gap: 5px; padding: 0; list-style: none; max-height: 290px; overflow: auto; }
.timeline li { display: grid; grid-template-columns: 60px 1fr; gap: 5px; padding: 5px; background: #eee; }
.timeline li.rare { position: static; transform: none; }
.timeline li.end { background: #333; color: white; }
.away-modal footer { justify-content: flex-end; }
.map-screen { padding: 0; background: #ddd; }
.map-canvas { position: relative; min-height: 100%; width: 100%; }
.map-canvas img { position: absolute; width: 100%; height: 100%; object-fit: fill; image-rendering: pixelated; }
.map-pin, .map-title, .map-filters, .map-legend, .map-detail { position: absolute; }
.map-pin { left: var(--x); top: var(--y); transform: translateX(-50%); z-index: 1; }
.map-pin:not(.zone-pin) { border-radius: 4px; background: #222; color: white; padding: 3px 6px; pointer-events: none; }
.map-pin button { background: #fff; }
.map-pin button[aria-pressed=true] { background: #222; }
.map-title { left: 12px; top: 12px; }
.map-filters { right: 12px; top: 12px; justify-content: flex-end; }
.map-legend { left: 12px; bottom: 12px; }
.map-detail { right: 12px; top: 34%; width: 21%; min-width: 168px; z-index: 2; }
@media (min-width: 951px) and (max-width: 1150px) {
  :root { font-size: 12px; }
  .desktop-menu button { padding-inline: 5px; }
}
@media (orientation: landscape) and (max-height: 550px), (orientation: landscape) and (max-width: 950px) {
  :root { font-size: 12px; }
  #game { width: 100vw; height: 100dvh; aspect-ratio: auto; }
  .touch-ui, .mobile-only, .mobile-chat-bar { display: block; }
  .desktop-menu, .minimap, .last, .inspect, .outing-log, .next, .checklist, .job-level { display: none !important; }
  .status { left: 10px; top: 8px; width: 174px; border-radius: 16px; gap: 3px; padding-block: 5px; }
  .party { top: 78px; left: 10px; width: max-content; padding: 4px 8px; border-radius: 12px; }
  .party .pair { display: none; }
  .touch-menu, .touch-chip, .touch-action, .stick, .mobile-chat-bar { position: absolute; }
  .touch-menu { right: 10px; top: 8px; display: flex; gap: 7px; }
  .touch-menu button, .touch-action button { border-radius: 50%; padding: 4px; }
  .touch-chip { top: 8px; right: 165px; }
  .touch-chip button { border-radius: 18px; }
  .touch-action { right: 12px; bottom: 11px; display: grid; gap: 5px; justify-items: end; }
  .touch-action > button { border-radius: 18px; padding-inline: 10px; }
  .touch-action > div { display: flex; gap: 5px; align-items: end; }
  .touch-action > div button:last-child { min-height: 62px; min-width: 62px; }
  .stick { pointer-events: auto; touch-action: none; display: grid; place-items: center; width: 100px; height: 100px; left: 12px; bottom: 10px; border-radius: 50%; border: 1px dashed #555; background: #ddd9; }
  .stick div { position: absolute; width: 45px; height: 45px; border: 1px solid #555; border-radius: 50%; background: white; }
  .stick span { position: relative; pointer-events: none; font-size: .8rem; font-weight: 700; }
  .hotbar { bottom: 12px; }
  .hot-slots, .hotbar small { display: none; }
  .habit-strip { max-width: 240px; flex-wrap: wrap; justify-content: center; padding-block: 1px; }
  .habit-strip:has(.locked) .locked { display: none; }
  .chat { display: none; }
  .chat.chat-open { display: flex; width: min(330px, 66%); left: 10px; bottom: 63px; height: 185px; z-index: 4; }
  .mobile-chat-bar { bottom: 10px; left: 119px; max-width: 120px; }
  .mobile-chat-bar button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 18px; }
  .guide { top: 60px; left: 10px; width: min(40%, 230px); gap: 4px; }
  .auto-bar { top: 54px; left: auto; right: 10px; width: min(60%, 380px); }
  .rare { top: 120px; }
  .screen { padding: 8px; gap: 7px; }
  .screen-head { flex-wrap: wrap; }
  .columns { gap: 6px; }
  .panel { padding: 6px; gap: 5px; }
  .map-detail { top: 23%; right: 7px; width: 24%; }
  .map-title { top: 6px; left: 6px; }
  .map-legend { left: 6px; bottom: 6px; }
  .map-filters { top: 5px; right: 5px; gap: 3px; }
  .map-pin button { max-width: 135px; padding: 3px; font-size: .8rem; }
  .modal-screen { justify-content: safe start; }
  .world-place button { min-height: 26px; min-width: 0; padding: 2px 6px; font-size: .66rem; border-radius: 4px; }
  .world-place button::before { content: ''; position: absolute; inset: -9px -4px; }
}
@container (max-width: 470px) {
  .creation > .screen-head { grid-template-columns: minmax(0, 1fr); gap: 4px; margin-top: 0; }
  .create-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2.35fr); gap: 6px; }
  .create-identity { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .create-identity, .create-name, .appearance-fields { column-gap: 4px; }
}
@container (max-height: 330px) {
  .create-fields form { gap: 3px; }
  .appearance-picker { gap: 1px; }
}
@container (max-width: 530px) {
  .create-preview .preview canvas { width: min(var(--preview-width), 100%, 22cqh); }
}
@media (orientation: portrait) and (pointer: coarse) {
  #game { display: none; }
  #orientation { display: block; padding: 16px; color: white; text-align: center; }
}
.minimap-button { position: relative; }
.mini-feature, .mini-player { position: absolute; left: var(--x); top: var(--y); pointer-events: none; }
.mini-feature { width: var(--w); height: var(--h); border: 1px solid #aaa; background: #ccc6; }
.mini-player { width: 8px; height: 8px; border-radius: 50%; background: #222; transform: translate(-50%, -50%); }
.minimap-button svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.minimap-button polygon { fill: none; stroke: #444; stroke-width: 5; stroke-dasharray: 10 8; }
#hud > .next { top: 59%; }
.map-filters { z-index: 3; }
@media (orientation: landscape) and (max-height: 550px), (orientation: landscape) and (max-width: 950px) {
  .party { top: 86px; }
  .zone-pin[data-zone=hollow] { top: 14%; }
  .zone-pin[data-zone=mill] { top: auto; bottom: 2%; }
  .zone-pin[data-zone=lake] { top: auto; bottom: 2%; }
  .map-detail { top: 29%; }
}
.world-feature.gate { display: flex; align-items: end; }

@media (orientation: landscape) and (max-height: 550px), (orientation: landscape) and (max-width: 950px) {
  .desktop-hint { display: none; }
  .town-controls .touch-action { top: 55px; bottom: auto; }
}
.world-layer { position:absolute; inset:0; pointer-events:none; }
.minimap-button { position:relative; padding:0; overflow:hidden; }
.minimap-button canvas { width:100%; height:100%; display:block; image-rendering:pixelated; }
@media (max-width: 950px) {
  #hud > .minimap { display:flex !important; top:55px; right:12px; width:124px; padding:4px; gap:2px; font-size:9px; }
  .minimap-button { min-height:60px; height:60px; }
  .town-controls .touch-action { top:auto; bottom:10px; }
  .town-controls .touch-action > div { display:grid; grid-template-columns:44px 62px; }
  .town-controls .touch-action > button { max-width:112px; }
}

.quest-mark { position:absolute; left:50%; top:-1.2em; transform:translateX(-50%); background:#fff; border:1px solid #555; border-radius:50%; min-width:20px; }
.quest-columns { grid-template-columns:minmax(160px,1fr) 3fr; }

.path-sign { display:grid; gap:4px; width:100px; background:#fff; border:1px solid #555; border-radius:4px; padding:5px; text-align:center; font-size:12px; }

.checklist { top:26%; }

/* Touch devices: no double-tap zoom, no long-press callout/selection while holding skills. */
@media (pointer: coarse) {
  #game { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  #game input { -webkit-user-select: text; user-select: text; }
}
@media (min-width: 951px) and (max-width: 1150px) {
  .party { top: 19%; }
}
/* Touch tablets keep the desktop layout but get readable small labels. */
@media (pointer: coarse) and (min-width: 951px) {
  .label, legend, .world-name, .world-hit button, .world-place button, .paper-doll > div:not(.preview) div, .slot, .bag-grid button, .hot-slot button { font-size: max(10px, .84rem); }
  .paper-doll small { font-size: 10px; }
}
/* Phone landscape: safe areas, readable labels, outing bar clear of the minimap. */
@media (orientation: landscape) and (max-height: 550px), (orientation: landscape) and (max-width: 950px) {
  #hud { inset: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); width: auto; height: auto; }
  .screen { padding: max(8px, var(--safe-t)) max(8px, var(--safe-r)) max(8px, var(--safe-b)) max(8px, var(--safe-l)); }
  .map-screen { padding: 0; }
  .map-title { left: calc(6px + var(--safe-l)); }
  .map-legend { left: calc(6px + var(--safe-l)); bottom: calc(6px + var(--safe-b)); }
  .map-filters { right: calc(5px + var(--safe-r)); }
  .map-detail { right: calc(7px + var(--safe-r)); }
  .you-pin { transform: translate(-50%, calc(-100% - 46 / 720 * 100dvh - 3px)); }
  .party { top: 92px; }
  .label, legend { font-size: .84rem; }
  .world-name, .world-hit button, .world-place button, .stick span { font-size: .84rem; }
  .world-hit button { white-space: nowrap; }
  #hud > .minimap { font-size: 10px; }
  .paper-doll > div:not(.preview) div, .bag-grid button, .slot, .map-pin button { font-size: .84rem; }
  .paper-doll small { font-size: 10px; }
  .auto-bar { top: 8px; left: 194px; right: 170px; width: auto; max-width: 440px; margin-inline: auto; padding-block: 4px; }
  .auto-bar .pair { min-width: 0; }
  .auto-bar .pair > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gear-columns { grid-template-columns: minmax(208px, 30%) minmax(0, 1fr) minmax(150px, 23%); }
  .bag .bag-grid { flex: 1 1 0; min-height: 53px; overflow: auto; grid-auto-rows: 48px; }
}
@media (orientation: landscape) and (max-width: 640px) {
  .hotbar { bottom: 66px; }
}
@media (orientation: landscape) and (max-height: 340px) {
  .zone-pin[data-zone=hollow] { top: 16%; }
  .map-detail { top: 31%; }
}
