/* The world is the screen; controls are a translucent, floating game HUD. */
body.map-active { overflow: hidden; }
.app:has(.world-view:not(.hidden)) { width: 100%; max-width: none; padding: 0; margin: 0; }
.world-view:not(.hidden) { position: fixed; inset: 0; display: block; height: var(--app-viewport-height, 100dvh); padding: 0; overflow: hidden; }
.world-panel-frame { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; background: #799153; isolation: auto; }
.world-panel { position: absolute; inset: 0; height: 100% !important; background: #799153; scrollbar-width: none; }
.world-panel::-webkit-scrollbar { display: none; }
.world { --map-padding: 0px; --map-padding-total: 0px; border-radius: 0; background: #799153; }
.world-view > .topbar { position: absolute; z-index: 90; top: max(18px, env(safe-area-inset-top)); left: 22px; right: 22px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar-brand { gap: 9px; font-size: 18px; text-shadow: 0 2px 8px #1d392d; color: #fffbe8; letter-spacing: 2px; }
.topbar-brand small { color: #f4f3d9; font-size: 7px; text-shadow: 0 1px 4px #142c23; }
.topbar-brand .brand-mark { border-color: #ffffff60; background: #203f3866; color: #ffe7a5; }
.topbar .circ-btn, .world-panel-frame .map-toolbar, .map-control-bar,
.mobile-map-hud, .journey-strip, .world-stats-bar > span {
  background: #183f365e !important; color: #fffbe8 !important;
  border: 1px solid #ffffff40 !important;
  box-shadow: 0 4px 18px #122c2920;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar .circ-btn { border-radius: 12px; height: 38px; min-height: 38px; min-width: 38px; }
.topbar .circ-btn:hover { background: #214f44b8 !important; }
.world-stats-bar { position: absolute; z-index: 70; top: calc(max(18px, env(safe-area-inset-top)) + 51px); left: 22px; right: 22px; width: auto; display: flex; flex-wrap: nowrap; gap: 6px; padding: 0; min-height: 0; overflow-x: auto; scrollbar-width: none; pointer-events: none; }
.world-stats-bar > span { border-radius: 9px; font-size: 10px; padding: 5px 8px; flex-shrink: 0; }
.world-stats-bar b { color: #fff6c9; }
.world-stats-bar > span.stats-resource { color: #ffe5a2 !important; background: #57452188 !important; border-color: #f7d78166 !important; }
.journey-strip { position: absolute; z-index: 70; left: 22px; bottom: 86px; width: max-content; max-width: 350px; padding: 9px 12px; border-radius: 14px; gap: 8px; }
.journey-strip .journey-icon, .journey-strip h2 { display: none; }
.journey-strip p { max-width: 175px; margin: 0; color: #f0f3dce6; font-size: 10px; line-height: 1.65; }
.journey-strip .ghost { color: #fff3c4 !important; border: 0 !important; background: transparent !important; min-height: 36px; padding: 4px 8px; }
.journey-strip.has-companion { display: none; }
.world-panel-frame .map-toolbar { top: calc(max(18px, env(safe-area-inset-top)) + 88px); left: 22px; right: auto; border-radius: 13px; padding: 3px; z-index: 75; }
.map-toolbar .map-tgl, .map-filter-toggle { background: transparent !important; border-color: transparent !important; color: #fffbe8; box-shadow: none; width: 36px; height: 36px; }
.map-toolbar .map-tgl.on { background: #fff7d325 !important; border-color: #fff9d630 !important; }
.map-control-bar { position: absolute; z-index: 75; right: 22px; bottom: 22px; padding: 5px; border-radius: 15px; min-height: 0; gap: 12px; }
.map-control-hint { display: none; }
.map-controls { gap: 3px; }
.map-controls button { width: 38px; height: 38px; min-height: 38px; color: #fff9dc; border: 0; border-radius: 10px; background: transparent; font-size: 21px; }
.map-controls button:hover { background: #f6f3d52b; }
.map-controls output { color: #fff8de; width: 37px; font-size: 10px; }
.sync-status { position: absolute; bottom: 82px; right: 24px; z-index: 70; padding: 4px 8px; border-radius: 8px; background: #15392d55; color: #f5f5dc; pointer-events: none; font-size: 10px; text-shadow: 0 1px 3px #193c2c; }
.sync-status::before { background: #a3dc9b; }
.world-panel-frame .minimap { display: block; width: 110px; height: auto; top: auto !important; left: auto !important; right: 24px; bottom: 112px !important; z-index: 60; opacity: .78; pointer-events: auto; border: 1px solid #fff9df80; border-radius: 12px; box-shadow: 0 4px 18px #16332933; transform: none; }
.mobile-map-hud { position: absolute; display: grid; grid-template-columns: repeat(4, 1fr); z-index: 140; top: auto; left: 50%; right: auto; bottom: 22px; width: 294px; transform: translateX(-50%); gap: 3px; padding: 5px; border-radius: 18px; }
.mobile-map-menu-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: auto; height: 48px; background: transparent; border: 0; border-radius: 12px; color: #fcf8e2bf; box-shadow: none; }
.mobile-map-menu-btn span { font-size: 19px; line-height: 1; }
.mobile-map-menu-btn b { font-size: 10px; line-height: 1; font-weight: 500; }
.mobile-map-menu-btn.active { background: #fff9dc26; color: #fff3bb; box-shadow: inset 0 -2px 0 #f0d17b; }
.mobile-map-menu-btn:hover { background: #fff9dc1f; }
.bottom-grid, body.is-observer .bottom-grid, body.map-immersive .bottom-grid {
  display: flex; position: absolute; z-index: 130; top: 112px; right: 22px; bottom: 94px; left: auto;
  width: min(390px, calc(100% - 44px)); height: auto; max-height: none; margin: 0; padding: 0;
  border: 1px solid #fff9e5bb; border-radius: 20px; background: #fffdf3f5;
  box-shadow: 0 15px 50px #173a3540; transform: translateX(calc(100% + 30px)); opacity: 0; visibility: hidden;
  transition: transform .22s ease, opacity .22s, visibility .22s; pointer-events: none;
}
.bottom-grid.open, body.is-observer .bottom-grid.open, body.map-immersive .bottom-grid.open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.panel-nav { display: flex; padding: 9px 42px 9px 8px; }
.panel-nav button { min-height: 37px; font-size: 11px; }
.panel-nav kbd { display: none; }
.mobile-panel-close { display: grid; place-items: center; position: absolute; top: 12px; right: 10px; width: 29px; height: 29px; min-height: 29px; z-index: 5; font-size: 20px; }
.bottom-grid > .pet-panel, .bottom-grid > .social-panel, .bottom-grid > .log-panel { padding: 16px 18px; flex: 1; max-height: none; }
.mobile-panel-backdrop { position: absolute; inset: 0; z-index: 125; width: 100%; height: 100%; border: 0; border-radius: 0; background: #102e2814; backdrop-filter: none; }
body.admin-tools-open #adminPanel { position: absolute; inset: 108px 22px 94px; z-index: 150; margin: 0; overflow: auto; overscroll-behavior: contain; box-shadow: 0 15px 50px #173a3540; }
body.map-immersive .topbar, body.map-immersive .world-stats-bar, body.map-immersive .journey-strip, body.map-immersive .mobile-map-hud, body.map-immersive .map-toolbar, body.map-immersive .minimap, body.map-immersive .sync-status { opacity: 0; visibility: hidden; pointer-events: none; }
body.map-immersive #mapImmersiveBtn { background: #fff9dc36; color: #fff3bb; }

/* One painted ground canvas per visible chunk; DOM cells still own hit testing. */
.terrain-chunk { position: relative; }
.terrain-art-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: auto; }
.world .terrain { background: transparent !important; box-shadow: none; outline: none; }
.world .terrain::before, .world .terrain::after { content: none !important; }
.world .terrain-tile-stack { z-index: 1; }
.world .terrain-tile-layer { image-rendering: auto; }
.world .terrain-tile-layer[data-object-type] { animation: none; --object-float-y: 0px; --object-scale: 1; filter: drop-shadow(0 2px 1px #16321f28); }
.terrain-custom-skin { position: absolute; inset: 0; pointer-events: none; background: var(--terrain-skin-image) center / 100% 100% no-repeat; }
.world.hide-items .terrain-tile-object_visual[data-object-type="plant"] { display: block !important; }
.world.hide-plants .terrain-tile-layer[data-object-type="plant"] { display: none !important; }
.map-art-sprite { display: inline-block; width: 100%; height: 100%; min-width: 1em; min-height: 1em; aspect-ratio: 1; background-repeat: no-repeat; vertical-align: middle; image-rendering: auto; flex-shrink: 0; }
.asset-sprite-wrap { position: relative; overflow: hidden; isolation: isolate; }
.asset-sprite-wrap > .map-art-sprite { position: absolute; inset: 0; min-width: 0; min-height: 0; }
.pixel-pet.pet-sprite-avatar .asset-sprite { image-rendering: auto; }

@media (max-width: 900px) {
  .world-view > .topbar { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; }
  .topbar-brand { font-size: 16px; gap: 7px; }
  .topbar-brand .brand-mark { width: 29px; height: 29px; }
  .topbar .circ-btn { min-width: 33px; min-height: 34px; height: 34px; padding: 0 8px; font-size: 12px; }
  .world-stats-bar { top: calc(max(12px, env(safe-area-inset-top)) + 46px); left: 12px; right: 12px; }
  .world-stats-bar > span { padding: 4px 7px; font-size: 9px; }
  .world-panel-frame .map-toolbar { top: calc(max(12px, env(safe-area-inset-top)) + 80px); left: 12px; max-width: calc(100% - 24px); }
  .mobile-map-hud { width: min(310px, calc(100% - 24px)); bottom: calc(12px + env(safe-area-inset-bottom)); padding: 5px; }
  .mobile-map-menu-btn { height: 48px; }
  .map-control-bar { right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); padding: 3px; border-radius: 12px; }
  .map-controls button { width: 34px; min-height: 34px; height: 34px; font-size: 20px; }
  .map-controls output { width: 32px; }
  #mapImmersiveBtn { display: none; }
  .sync-status { right: 14px; bottom: calc(134px + env(safe-area-inset-bottom)); font-size: 9px; }
  .world-panel-frame .minimap { right: 14px; bottom: calc(165px + env(safe-area-inset-bottom)) !important; width: 82px; opacity: 0; pointer-events: none; }
  .world-panel-frame .minimap.visible { opacity: .85; pointer-events: auto; }
  .journey-strip { left: 12px; bottom: calc(158px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); padding: 7px 9px; }
  .journey-strip p { max-width: 170px; font-size: 10px; }
  .bottom-grid, body.is-observer .bottom-grid, body.map-immersive .bottom-grid { top: auto; bottom: calc(82px + env(safe-area-inset-bottom)); right: 8px; left: 8px; width: auto; max-height: min(74dvh, 760px); border-radius: 20px; transform: translateY(calc(100% + 100px)); }
  .bottom-grid.open, body.is-observer .bottom-grid.open { transform: none; }
  .bottom-grid > .pet-panel, .bottom-grid > .social-panel, .bottom-grid > .log-panel { flex: auto; min-height: 0; padding: 15px; }
  .mobile-panel-backdrop { background: #112f2838; }
  body.admin-tools-open #adminPanel { inset: 98px 8px calc(82px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(85px + env(safe-area-inset-bottom)); }
}

/* A single compact header, with the layer picker anchored to its own button. */
.world-view > .topbar { display: flex; align-items: center; flex-wrap: nowrap; gap: 14px; }
.topbar-brand { flex: 0 0 auto; }
.topbar .world-stats-bar { position: static; display: flex; flex: 1 1 0; min-width: 0; width: auto; padding: 0; pointer-events: auto; touch-action: pan-x; }
.topbar .top-actions { position: relative; display: flex; flex: 0 0 auto; align-items: center; flex-wrap: nowrap; gap: 6px; overflow: visible; }
.topbar .world-event-badge { display: none; }
.topbar .world-stats-bar .mobile-event-chip { display: inline-flex; }
.topbar .map-toolbar { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; inset: auto; display: flex; padding: 0; width: 38px; height: 38px; max-width: none; overflow: visible; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.topbar .map-filter-toggle { width: 38px; height: 38px; border: 1px solid #ffffff40 !important; border-radius: 12px; background: #183f365e !important; backdrop-filter: blur(12px); color: #fffbe8; animation: none; }
.map-filter-options { display: none; }
.map-toolbar.open .map-filter-options { display: flex; position: absolute; top: calc(100% + 10px); right: 0; gap: 4px; padding: 7px; border: 1px solid #fff7d366; border-radius: 14px; background: #193f36eb; backdrop-filter: blur(16px); box-shadow: 0 6px 24px #17392b35; }
.world-panel-frame .minimap { left: 22px !important; right: auto !important; bottom: 22px !important; }
.journey-strip { left: 152px; bottom: 22px; }
.log-pet-avatar { position: relative; overflow: hidden; isolation: isolate; }
@media (max-width: 900px) {
  .world-view > .topbar { gap: 8px; }
  .topbar-brand { gap: 0; }
  .topbar-brand > div { display: none; }
  .topbar-brand .brand-mark { width: 28px; height: 32px; }
  .topbar .top-actions { gap: 4px; }
  .topbar .map-toolbar, .topbar .map-filter-toggle { width: 32px; height: 34px; }
  .topbar .world-stats-bar { min-height: 34px; align-items: center; }
  .topbar .world-stats-bar > span { font-size: 9px; }
  .map-toolbar.open .map-filter-options { right: 0; max-width: calc(100vw - 24px); }
  .world-panel-frame .minimap { left: 12px !important; right: auto !important; bottom: calc(86px + env(safe-area-inset-bottom)) !important; opacity: .85; pointer-events: auto; max-width: 88px; height: auto !important; }
  .journey-strip { left: 100px; bottom: calc(140px + env(safe-area-inset-bottom)); max-width: calc(100% - 112px); }
}

/* Compact HUD: full status stays readable in a wrapping disclosure. */
.topbar .hud-disclosure { position: relative; flex: 0 0 auto; color: #fffbea; }
.topbar .hud-disclosure > summary { list-style:none; cursor:pointer; padding:10px 14px; border:1px solid #ffffff50; border-radius:14px; background:#183f368c; backdrop-filter:blur(14px); white-space:nowrap; font-size:13px; }
.topbar .hud-disclosure > summary::-webkit-details-marker { display:none; }
.topbar #worldInfo { margin-left:auto; }
.topbar #worldInfo .world-stats-bar { position:absolute; top:calc(100% + 12px); right:0; width:min(580px,calc(100vw - 44px)); display:flex; flex-wrap:wrap; gap:8px; overflow:auto; max-height:55dvh; padding:14px; background:#193f36f2; border:1px solid #ffffff50; border-radius:16px; box-shadow:0 12px 36px #102b3540; }
.topbar .world-stats-bar > span { flex:0 0 auto; white-space:normal; }
.topbar .account-menu-items { position:absolute; top:calc(100% + 12px); right:0; width:190px; display:grid; gap:6px; padding:10px; background:#193f36f5; border:1px solid #ffffff50; border-radius:16px; }
.topbar .account-menu-items .circ-btn { width:100%; height:40px; border-radius:10px; text-align:left; padding:0 12px; font-size:14px; white-space:nowrap; }
.topbar details:not([open]) > :not(summary) { display:none !important; }
.world .pet-avatar .pixel-pet.pet-sprite-avatar.map { width:clamp(24px, calc(var(--cell-size) * 1.05), 48px) !important; height:clamp(24px, calc(var(--cell-size) * 1.05), 48px) !important; padding:0 !important; border:0 !important; border-radius:0 !important; background:none !important; box-shadow:none !important; overflow:visible; }
.world .pet-avatar .pixel-pet.pet-sprite-avatar.map .pet-asset { width:100%; height:100%; overflow:visible; }
.world .pet-avatar .pet-sprite-avatar .asset-sprite { object-fit:contain; filter:drop-shadow(0 1px 1px #102b3570); }
.world .pet-avatar.mine .pet-sprite-avatar .asset-sprite { filter:drop-shadow(0 0 1px #fff0a1) drop-shadow(0 2px 2px #102b3570); }
@media(max-width:900px) {
 .topbar .hud-disclosure > summary { padding:8px 10px; font-size:12px; }
 .topbar #worldInfo .world-stats-bar { position:fixed; top:64px; left:12px; right:12px; width:auto; }
 .topbar #worldInfo .world-stats-bar > span { font-size:12px; }
}
@media(min-width:901px) { .topbar #worldInfo .world-stats-bar { left:auto; } }
.topbar #worldInfo .world-stats-bar > .stats-optional { display:inline-flex !important; }
.world .pet-avatar .pixel-pet.pet-sprite-avatar.map { outline:none !important; }
.world .pet-avatar:focus-visible { outline:2px dashed #fff5cc; outline-offset:3px; }

/* Portrait alpha must reveal the actual ground, never a filtered rectangle. */
.pixel-pet.pet-sprite-avatar {
  background:transparent !important; border:0 !important; border-radius:0 !important;
  box-shadow:none !important; outline:none !important;
  backdrop-filter:none !important; -webkit-backdrop-filter:none !important;
}
.world .pet-avatar .pet-sprite-avatar { animation:none !important; }
.pixel-pet.pet-sprite-avatar.large { width:88px; height:88px; padding:4px; }
.pixel-pet.pet-sprite-avatar.tiny { width:28px; height:28px; padding:0; }
.log-pet-avatar:has(.pet-sprite-avatar), .profile-portrait { background:transparent !important; border:0 !important; box-shadow:none !important; }
.topbar .account-menu-items #userSettingsBtn { width:100%; max-width:none; padding:0 12px; border-radius:10px; }
@media(max-width:900px) {
  .world .pet-avatar .pixel-pet.pet-sprite-avatar.map { width:clamp(24px, calc(var(--cell-size) * 1.05), 40px) !important; height:clamp(24px, calc(var(--cell-size) * 1.05), 40px) !important; }
}

/* Forest glass surfaces: terrain remains visible behind compact controls. */
.modal, .tutorial-overlay { background:#102a2433; backdrop-filter:none; }
.modal-panel, .modal-box, .cmd-menu, .obj-action-popup, .bottom-grid, .tutorial-card, .admin-panel { background:rgba(240,247,230,.70) !important; backdrop-filter:blur(10px) saturate(105%); -webkit-backdrop-filter:blur(10px) saturate(105%); border-color:#f5ffe3b3 !important; box-shadow:0 12px 40px #12382c25; }
.target-detail-card { display:block; background:#e2ebd35c !important; border:1px solid #c3d4b885; padding:12px; }
.target-detail-art { display:none; }
.target-detail-title { font-size:15px; }
.target-detail-desc, .target-detail-subtitle, .target-action-row { font-size:12px; }
.target-action-row { background:#f5faec55 !important; padding:10px; border-color:#c3d4b885 !important; }
.target-detail-chip { background:#e0ecd652 !important; }
.world .pet-avatar .pixel-pet.pet-sprite-avatar.map { width:min(calc(var(--cell-size) * .88), 44px) !important; height:min(calc(var(--cell-size) * .88), 44px) !important; }
.world-panel-frame > #worldOverlay, .world-panel-frame > #weatherParticles, #seasonParticles { position:absolute; inset:0; width:100%; height:100%; overflow:hidden; pointer-events:none; z-index:35; }
.world-panel-frame > #worldOverlay { transition:background 4s; }
#seasonParticles { z-index:36; }
.season-mote { position:absolute; top:-15px; width:5px; height:8px; border-radius:60% 10% 60% 10%; background:#c89545b0; animation:season-fall var(--duration) linear var(--delay) infinite; }
.season-mote.spring { background:#f1c5d3aa; border-radius:70% 30%; }
.season-mote.summer { width:3px; height:3px; background:#fff2bc90; border-radius:50%; }
.season-mote.winter { width:4px; height:4px; border-radius:50%; background:#fff9; }
.season-mote.firefly { background:#d4f89c; border-radius:50%; box-shadow:0 0 6px #d5f69b; }
@keyframes season-fall { from {transform:translate(0,-20px) rotate(0);opacity:0;} 15% {opacity:.65;} 85% {opacity:.65;} to {transform:translate(var(--drift),100vh) rotate(240deg);opacity:0;} }
.fusion-celebration { position:fixed; inset:0; z-index:5000; pointer-events:none; display:grid; place-items:center; background:radial-gradient(circle,#163a3270,transparent 65%); animation:fusion-fade 2.4s both; }
.fusion-reveal { position:relative; display:grid; justify-items:center; gap:8px; color:#fff7ce; text-shadow:0 2px 5px #142e26; animation:fusion-rise .65s ease-out both; }
.fusion-reveal strong {font-size:18px;} .fusion-reveal p {font-size:13px;}
.fusion-halo { position:absolute; width:160px; height:160px; top:-30px; border:1px solid #f4df8bb0; border-radius:50%; box-shadow:0 0 40px #e9d68e55,inset 0 0 35px #e9d68e55; }
.fusion-spark {position:absolute;left:50%;top:48%;width:4px;height:4px;border-radius:50%;background:#ffeb9f;box-shadow:0 0 5px #fff2ab;animation:fusion-spark 1.3s .15s ease-out both;}
@keyframes fusion-spark {from{transform:rotate(var(--angle)) translateX(15px);opacity:1;}to{transform:rotate(var(--angle)) translateX(180px);opacity:0;}}
@keyframes fusion-rise {from{transform:scale(.65) translateY(15px);opacity:0;}to{transform:none;opacity:1;}}
@keyframes fusion-fade {0%{opacity:0;}20%,75%{opacity:1;}100%{opacity:0;}}
@media(prefers-reduced-motion:reduce) {.season-mote,.weather-particle,.fusion-spark{display:none!important}.fusion-celebration,.fusion-reveal{animation:none}.world-panel-frame>#worldOverlay{transition:none}}
body.page-hidden .season-mote, body.page-hidden .weather-particle {animation-play-state:paused!important;}

/* Compact, translucent panels. Only the outer surface blurs the map. */
body.map-active { --glass-soft:rgba(247,251,239,.20); --glass-strong:rgba(247,251,239,.35); --muted:#50624f; }
.bottom-grid > .pet-panel, .bottom-grid > .social-panel, .bottom-grid > .log-panel { background:transparent !important; backdrop-filter:none; -webkit-backdrop-filter:none; padding:12px; gap:10px; }
.panel-nav, .cmd-menu-head { background:#e5efd233 !important; }
.panel-nav { padding:5px 36px 5px 6px; }
.panel-nav button { min-height:32px; padding:4px 7px; }
.panel-nav button.active { background:#faffef55; }
.log-group, .log-pet-card, .message, .relationship, .memory-item, .stat-details, .profile-row, .fusion-pet-card, .fusion-summary, .target-detail-card, .target-action-row { background:rgba(249,253,240,.20) !important; box-shadow:none; }
.modal-panel { width:min(420px,calc(100vw - 24px)); padding:14px; border-radius:13px; max-height:84dvh; }
.modal-panel.pet-profile-panel { max-width:min(360px,calc(100vw - 24px)); }
.modal-panel.help-panel, .modal-panel.place-modal-panel, .modal-panel.pet-fusion-panel { width:min(600px,calc(100vw - 24px)); }
.modal-panel .panel-head { margin-bottom:8px; gap:8px; }
.modal-panel h2, .modal-panel h3, .bottom-grid h2 { font-size:15px; }
.modal-panel button, .bottom-grid button { padding:5px 9px; }
.modal-actions { gap:6px; margin-top:10px; }
.cmd-menu.target-action-menu { width:min(310px,calc(100vw - 24px)); }
.cmd-menu-head { padding:7px 10px; font-size:12px; }
.target-detail-card { padding:9px 10px; }
.target-detail-title { font-size:14px; }
.target-detail-desc { margin:6px 0; line-height:1.5; }
.target-detail-meta { gap:4px; }
.target-detail-chip { padding:3px 6px; font-size:11px; }
.target-action-list { gap:5px; padding:6px; }
.target-action-row { padding:6px; gap:5px; border-radius:10px; }
.target-action-mode { padding:5px 7px; font-size:11px; min-height:32px; }
.topbar .hud-disclosure > summary { padding:7px 10px; font-size:12px; border-radius:10px; }
.topbar #worldInfo .world-stats-bar, .topbar .account-menu-items, .map-toolbar.open .map-filter-options { background:rgba(23,54,43,.70); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
.topbar #worldInfo .world-stats-bar { width:min(460px,calc(100vw - 24px)); padding:10px; gap:5px; }
.topbar .account-menu-items { width:166px; gap:4px; padding:7px; }
.topbar .account-menu-items .circ-btn { height:34px; min-height:34px; font-size:12px; }
.mobile-map-hud { width:258px; padding:4px; border-radius:14px; }
.mobile-map-menu-btn { height:40px; gap:3px; }
.mobile-map-menu-btn span { font-size:16px; }
.map-controls button { width:32px; height:32px; min-height:32px; font-size:18px; }
.map-control-bar { padding:3px; gap:6px; }
@media(min-width:901px) {
 .bottom-grid, body.is-observer .bottom-grid, body.map-immersive .bottom-grid { width:340px; top:86px; bottom:auto; max-height:calc(100dvh - 170px); border-radius:15px; }
 .bottom-grid > .pet-panel, .bottom-grid > .social-panel, .bottom-grid > .log-panel { max-height:calc(100dvh - 220px); overflow:auto; }
}
@media(max-width:900px) {
 .bottom-grid, body.is-observer .bottom-grid, body.map-immersive .bottom-grid { left:max(10px,calc((100vw - 340px)/2)); right:max(10px,calc((100vw - 340px)/2)); bottom:calc(68px + env(safe-area-inset-bottom)); max-height:70dvh; border-radius:15px; }
 .mobile-map-hud { width:min(266px,calc(100vw - 24px)); }
 .cmd-menu.target-action-menu { left:50% !important; right:auto !important; transform:translateX(-50%); bottom:calc(68px + env(safe-area-inset-bottom)); max-height:70dvh; }
 .topbar #worldInfo .world-stats-bar { width:auto; top:56px; }
 .modal-panel button, .care-btn, .command-btn, .forage-btn, .target-action-mode { min-height:36px; }
 .modal-panel input, .modal-panel select, .modal-panel textarea { font-size:16px; }
}
.log-panel .messages { height:auto; min-height:0; max-height:48dvh; }
.log-pet-body, .log-pet-lines, .log-group-head { background:transparent !important; }
.modal { padding:12px; }
.bottom-grid .panel-actions button { height:32px; min-height:32px; padding:4px 8px; }
.modal-panel input, .modal-panel select, .modal-panel textarea { padding:8px 10px; }
.modal-panel .pixel-pet.pet-sprite-avatar.large { width:72px; height:72px; }
@media(min-width:901px) { .topbar-brand { font-size:16px; } }
@media(max-width:900px) { .bottom-grid .panel-actions button { height:36px; min-height:36px; } }

/* Painted event icons share a bounded box in every HUD/catalogue context. */
.event-art-icon { display:inline-flex; width:20px; height:20px; flex:0 0 20px; vertical-align:middle; }
.pending-event-icon { width:30px; height:30px; flex:0 0 30px; }
.mobile-event-chip { align-items:center; gap:4px; }
.scheduled-event-marker .sched-ev-icon { width:26px; height:26px; display:block; }
.scheduled-event-marker .sched-ev-icon .asset-sprite-wrap { width:100%; height:100%; }

/* Mouse-operated desktops stay compact even in a narrow or zoomed window.
   Resize the interface only; the world camera and pointer coordinates stay 1:1. */
@media (hover:hover) and (pointer:fine) {
  .bottom-grid, body.is-observer .bottom-grid, body.map-immersive .bottom-grid {
    width:min(288px,calc(100vw - 24px)); left:auto; right:12px; top:64px; bottom:auto;
    max-height:min(660px,calc(100dvh - 126px)); border-radius:12px;
  }
  .bottom-grid > .pet-panel, .bottom-grid > .social-panel, .bottom-grid > .log-panel {
    padding:9px; gap:7px; max-height:min(620px,calc(100dvh - 166px)); overflow:auto;
  }
  .bottom-grid, .modal-panel, .modal-box, .cmd-menu, .obj-action-popup { font-size:11px; }
  .bottom-grid p, .modal-panel p, .help-body, .log-pet-lines, .log-pet-body, .message { font-size:11px; line-height:1.45; }
  .bottom-grid h2, .bottom-grid h3, .modal-panel h2, .modal-panel h3, .pet-title h3, .profile-name { font-size:13px; }
  .panel-nav { padding:4px 30px 4px 4px; gap:3px; }
  .panel-nav button { min-height:27px; padding:3px 5px; font-size:10px; border-radius:8px; }
  .bottom-grid .mobile-panel-close { top:5px; right:5px; width:24px; height:26px; min-height:26px; padding:0; font-size:16px; }
  .bottom-grid button, .modal-panel button, .modal-box button, .modal-panel label { font-size:11px; padding:4px 7px; }
  .bottom-grid .panel-actions button, .modal-panel button, .care-btn, .command-btn, .forage-btn { min-height:28px; height:auto; }
  .abilities { gap:6px; }
  .ability { padding:7px 8px 7px 11px; gap:4px; border-radius:9px; background:#f7fbef42; box-shadow:none; }
  .ability::before { width:3px; top:6px; bottom:6px; }
  .ability-top { gap:4px; flex-wrap:wrap; }
  .ability-top strong { font-size:12px; }
  .bottom-grid .mood-emoji { font-size:14px; }
  .pet-overview-card { grid-template-columns:76px minmax(0,1fr); gap:7px; }
  .pet-overview-art .pixel-pet.large { width:70px; height:70px; padding:2px; }
  .pet-basic-row { gap:5px; }
  .pet-quick-actions { grid-template-columns:minmax(0,1fr) auto auto; gap:5px; }
  .pet-quick-actions .ghost { min-width:52px; min-height:32px; padding:3px 6px; }
  .pet-quick-actions .career-badge { min-width:0; min-height:32px; padding:5px 7px; }
  .ability-tag { font-size:9px; padding:2px 5px; }
  .ability-chips { gap:4px; }
  .ability-chip { font-size:10px; padding:1px 5px; border-radius:6px; }
  .bottom-grid .ability-desc, .modal-panel .ability-desc { font-size:10px; line-height:1.45; }
  .stat-details, .relationship, .memory-item, .log-pet-card, .profile-row { padding:7px; font-size:11px; border-radius:9px; }
  .modal-panel { width:min(360px,calc(100vw - 24px)); padding:11px; }
  .modal-panel.pet-profile-panel { width:min(310px,calc(100vw - 24px)); }
  .modal-panel.help-panel, .modal-panel.place-modal-panel, .modal-panel.pet-fusion-panel { width:min(510px,calc(100vw - 24px)); }
  .modal-panel input, .modal-panel select, .modal-panel textarea { font-size:12px; padding:6px 8px; }
  .modal-panel .pixel-pet.pet-sprite-avatar.large { width:60px; height:60px; }
  .cmd-menu.target-action-menu { width:min(270px,calc(100vw - 24px)); }
  .target-detail-title { font-size:12px; }
  .target-detail-desc, .target-detail-subtitle, .target-action-row, .target-detail-chip, .target-action-mode { font-size:10px; }
  .target-action-mode { min-height:28px; padding:4px 6px; }
  .world-view > .topbar { top:12px; left:14px; right:14px; gap:8px; }
  .topbar-brand { font-size:13px; gap:6px; }
  .topbar-brand .brand-mark { width:24px; height:27px; }
  .topbar .hud-disclosure > summary { font-size:10px; padding:6px 8px; border-radius:8px; }
  .topbar .map-toolbar, .topbar .map-filter-toggle { width:28px; height:28px; }
  .topbar .account-menu-items { width:145px; padding:5px; }
  .topbar .account-menu-items .circ-btn { font-size:11px; min-height:28px; height:28px; }
  .topbar #worldInfo .world-stats-bar { width:min(390px,calc(100vw - 28px)); left:auto; right:0; padding:8px; }
  .topbar #worldInfo .world-stats-bar > span { font-size:10px; padding:3px 5px; }
  .mobile-map-hud { width:220px; padding:3px; gap:2px; bottom:12px; border-radius:11px; }
  .mobile-map-menu-btn { height:33px; gap:2px; border-radius:8px; }
  .mobile-map-menu-btn span { font-size:14px; }
  .mobile-map-menu-btn b { font-size:9px; }
  .map-control-bar { right:12px; bottom:12px; padding:2px; border-radius:10px; }
  .map-controls { gap:2px; }
  .map-controls button { width:27px; height:27px; min-height:27px; font-size:16px; }
  .map-controls output { width:28px; font-size:9px; }
  .sync-status { right:14px; bottom:50px; font-size:9px; }
  .world-panel-frame .minimap { max-width:88px; height:auto!important; left:14px!important; bottom:14px!important; }
  .journey-strip { left:110px; bottom:14px; padding:5px 7px; font-size:10px; }
}
@media (hover:hover) and (pointer:fine) and (max-width:600px) {
  .map-control-bar { bottom:60px; }
  .sync-status { bottom:96px; }
  .world-panel-frame .minimap { bottom:60px!important; }
  .journey-strip { display:none; }
}
