.map-editor,
.map-editor.items-mode,
.map-editor.monsters-mode {
  left: auto;
  right: 0;
  top: 136px;
  bottom: 0;
  width: min(350px, calc(100vw - 56px));
  height: auto;
  max-height: calc(100dvh - 136px);
  transform: none;
  border-radius: 8px 0 0 0;
  overflow: auto;
  box-sizing: border-box;
  z-index: 30;
  background: rgba(12, 24, 25, 0.97);
}
.map-editor.open.items-mode, .map-editor.open.monsters-mode { display: block; }
.map-editor #mapEditorHeader { cursor: default; position: sticky; top: -12px; z-index: 3; background: #0c1819; padding: 8px 0; }
.map-editor #teleportButton { display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 8px 12px; border: 1px solid #f2d184; border-radius: 6px; background: #f2d184; color: #182724; font: inherit; font-weight: 800; cursor: pointer; }
.map-editor #teleportButton:hover { background: #ffe6a9; }
.map-editor #teleportButton:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.map-editor #mapEditorHeader { flex-wrap: wrap; }
.map-editor #mapEditorHeader>strong { flex: 0 0 100%; }
.map-editor #mapEditorHeader>button { flex: 1 1 0; }
.map-editor #editCurrentMapButton { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px; border: 1px solid #8de0c0; border-radius: 6px; color: #14251c; background: #8de0c0; font: inherit; font-weight: 800; cursor: pointer; }
.map-editor #editCurrentMapButton:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.map-editor #mapEditorHeader>:is(#spawnMonsterButton, #createNpcButton) { flex: 1 1 100%; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 12px; border: 1px solid #f0a17d; border-radius: 6px; color: #281912; background: #f0a17d; font: inherit; font-weight: 800; cursor: pointer; }
.map-editor :is(#spawnMonsterButton, #createNpcButton):hover { background: #ffbc9b; }
.map-editor :is(#spawnMonsterButton, #createNpcButton):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.map-editor :is(#spawnMonsterButton, #createNpcButton):disabled { opacity: .65; cursor: wait; }
.map-editor .editor-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-editor .paint-tool-row { display: grid; grid-template-columns: 1fr; }
.map-editor button { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.map-editor .editor-row button, .map-editor .editor-tabs button, .map-editor .editor-map-tabs button {
  display: flex; align-items: center; gap: 8px; text-align: left; min-height: 36px;
}
.map-editor .layer-row button { width: auto; }
.editor-tool-icon, .world-clock svg, .rain-toggle svg { width: 17px; height: 17px; flex: 0 0 17px; vertical-align: middle; }
.map-editor .editor-tool-icon { margin-right: 4px; }
.map-editor .item-editor-layout, .map-editor .monster-editor-layout {
  display: flex; flex-direction: column; overflow: visible;
}
.map-editor.items-mode .item-editor-panel.active, .map-editor.monsters-mode .monster-editor-panel.active { overflow: visible; }
.map-editor .item-list-panel, .map-editor .selected-items-panel, .map-editor .monster-list-panel { max-height: 300px; flex: none; }
.map-editor .item-detail, .map-editor .monster-detail { flex: none; width: auto; }
.map-editor .monster-card { grid-template-columns: 36px minmax(0, 1fr) 72px; }
.map-editor input:not([type=checkbox]), .map-editor select { max-width: 100%; min-width: 0; box-sizing: border-box; }
.map-editor [hidden] { display: none !important; }
.rain-toggle { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid #365252; color: #e2edeb; font-size: 13px; }
.rain-toggle input { margin-left: auto; accent-color: #62cfa2; width: 18px; height: 18px; }
.world-hud { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 5px; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
.currency-hud { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; background: #102624; border: 1px solid #607a78; border-radius: 6px; padding: 6px 4px; box-sizing: border-box; }
.currency-hud > div { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 4px; padding: 0 4px; color: #e8eceb; font-size: 10px; }
.currency-hud svg { width: 15px; height: 15px; color: #efd382; grid-row: span 2; align-self: center; }
.currency-hud > div:nth-child(2) svg { color: #cad7dc; }
.currency-hud > div:nth-child(3) svg { color: #91dcd8; }
.currency-hud > div:nth-child(4) svg { color: #d8b0e5; }
.currency-hud > div:nth-child(5) svg { color: #ef9a8a; }
.currency-hud strong { grid-column: 1 / -1; text-align: center; font: 700 12px ui-monospace, monospace; min-width: 0; white-space: nowrap; }
.currency-hud svg { grid-row: auto; }
.world-clock { display: flex; align-items: center; gap: 9px; padding: 5px 12px; border: 1px solid #607a78; border-radius: 6px; background: #102624; color: #eff7ef; }
.world-hud .coord-hud { position: static; transform: none; padding: 4px 10px; font-size: 11px; min-height: 24px; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
.world-clock time { font: 700 17px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.world-clock [data-raining=true] { color: #85d5fb; }
@media (max-width: 620px) {
  .world-hud { top: 8px; }
  .player-hud { top: 136px; }
  .game-root:has(.map-editor.open) .player-hud { display: none; }
  .map-editor, .map-editor.items-mode, .map-editor.monsters-mode { width: min(320px, calc(100vw - 56px)); }
}
@media (min-width: 621px) and (max-width: 1000px) {
  .world-hud { left: auto; right: 10px; transform: none; width: calc(100vw - 300px); }
}
.terrain-selector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; padding: 10px; border: 1px solid #53636a; }
.terrain-selector label { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }
.terrain-selector svg { width: 16px; height: 16px; flex-shrink: 0; }
.travel-dialog { box-sizing: border-box; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; color: #f2f5f3; background: #18221f; border: 1px solid #6a8476; border-radius: 8px; }
.travel-dialog::backdrop { background: #0009; }
.travel-dialog h2 { margin: 0; font-size: 20px; }
.travel-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.travel-dialog button { color: inherit; background: #2b3933; border: 1px solid #779487; border-radius: 4px; padding: 10px 14px; cursor: pointer; }
.travel-dialog button:disabled { opacity: .5; cursor: not-allowed; }
.travel-dialog button:focus-visible { outline: 2px solid #f0cf72; outline-offset: 2px; }
.travel-dialog #closeSkins { width: 36px; height: 36px; padding: 5px; }
.travel-dialog #closeSkins svg { width: 22px; height: 22px; }
.travel-actions { display: flex; justify-content: flex-end; gap: 12px; }
.skin-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.skin-tabs button { font-size: 13px; min-width: 0; padding: 9px 6px; white-space: normal; }
.skin-tabs [aria-selected="true"] { background: #426850; border-color: #9fc8a9; }
.skin-choice { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; min-height: 140px; }
.skin-preview { display: block; width: 64px; height: 80px; background-repeat: no-repeat; background-position: left top; image-rendering: pixelated; }
.travel-dialog [role="status"] { overflow-wrap: anywhere; }
.map-editor #rainControls, .map-editor #heatControls { display: grid; gap: 8px; margin: 10px 0; }
.map-editor #heatControls label { display: grid; gap: 4px; font-size: 12px; }
.catalog-monster-drops { min-width: 0; margin: 12px 0; padding: 8px; border: 1px solid #557a72; }
.catalog-drop-row { padding: 8px 0; border-bottom: 1px solid #557a72; margin-bottom: 8px; }
.catalog-drop-heading { display: flex; align-items: center; gap: 6px; }
.catalog-drop-heading img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.catalog-drop-heading select { flex: 1; width: 0; }
.catalog-drop-heading button { flex: 0 0 30px; padding: 4px; height: 30px; }
.catalog-drop-heading svg { width: 16px; height: 16px; }
.catalog-drop-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.catalog-drop-fields label { display: grid; gap: 3px; min-width: 0; font-size: 11px; }
.catalog-drop-fields input { width: 100%; }
.map-editor #chestControls { display: grid; gap: 10px; margin: 10px 0; font-size: 12px; }
.map-editor #chestControls select { display: block; width: 100%; margin-top: 4px; padding: 8px; color: #eef5f3; background: #182724; border: 1px solid #557a72; border-radius: 4px; }
.map-editor #chestControls input[type=radio] { width: auto; }
.chest-skin-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; max-height: 270px; overflow: auto; padding: 2px; }
.map-editor .chest-skin-choice { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 3px; min-width: 0; height: 91px; border-radius: 4px; border: 1px solid #53636a; background: #172625; color: #e7efee; font-size: 10px; line-height: 12px; }
.map-editor .chest-skin-choice[aria-pressed=true] { border-color: #f0d276; background: #354435; color: #fff7cc; }
.chest-skin-choice canvas { width: 60px; height: 60px; flex: 0 0 60px; image-rendering: pixelated; }
.chest-skin-choice span { min-width: 0; text-align: center; overflow-wrap: anywhere; }
.chest-skin-preview { display: flex; align-items: center; flex-direction: column; min-height: 166px; border-bottom: 1px solid #365252; padding-bottom: 8px; }
.chest-skin-preview canvas { display: block; width: 180px; height: 150px; max-width: 100%; image-rendering: pixelated; }
.map-editor #heatControls select { padding: 8px; color: #eef5f3; background: #182724; border: 1px solid #557a72; border-radius: 4px; }
.stamina-hud { box-sizing: border-box; width: min(260px, 80vw); padding: 6px 10px; background: #182724; border: 1px solid #829269; border-radius: 4px; color: #f5f7ef; }
.stamina-hud > span { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.stamina-hud svg { width: 16px; height: 16px; color: #f4d36a; }
.stamina-hud strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.stamina-hud progress { display: block; width: 100%; height: 8px; margin: 5px 0; accent-color: #a3d85a; }
.stamina-hud small { display: block; font-size: 10px; }
.faint-overlay { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
.faint-overlay > div { position: absolute; left: 0; width: 100%; height: 51%; background: #000; transform: scaleY(var(--faint, 0)); }
.faint-overlay > div:first-child { top: 0; transform-origin: top; }
.faint-overlay > div:last-child { bottom: 0; transform-origin: bottom; }
.game-root:has(#staminaHud:not([hidden])) .map-editor { top: 198px; max-height: calc(100dvh - 210px); }
.map-editor #rainControls label { display: grid; gap: 4px; font-size: 12px; min-width: 0; }
.map-editor #rainControls select, .map-editor #rainControls input { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px; color: #eef5f3; background: #182724; border: 1px solid #557a72; border-radius: 4px; }
