.city-window-measuring { animation: none !important; transition: none !important; }
.city-window-frame.city-window-placed {
    position: fixed !important;
    left: var(--city-window-left) !important;
    top: var(--city-window-top) !important;
    right: auto !important;
    bottom: auto !important;
    width: var(--city-window-width) !important;
    height: var(--city-window-height) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    transition: none !important;
}
.city-window-titlebar {
    cursor: move;
    touch-action: none;
    user-select: none;
}
.city-window-placed .city-window-titlebar { flex-shrink: 0; }
.city-window-titlebar :is(button, a, input, label, select, textarea, [role="button"]) {
    cursor: pointer;
    touch-action: manipulation;
}
.city-window-active { user-select: none; }
.city-window-handles {
    position: fixed;
    left: var(--city-window-left);
    top: var(--city-window-top);
    width: var(--city-window-width);
    height: var(--city-window-height);
    pointer-events: none;
}
.city-window-drag-cap {
    position: absolute;
    top: 0;
    left: calc(14px * var(--ui-scale, 1));
    right: calc(14px * var(--ui-scale, 1));
    height: calc(14px * var(--ui-scale, 1));
    pointer-events: auto;
}
.city-window-drag-cap::after {
    content: '';
    display: block;
    width: calc(28px * var(--ui-scale, 1));
    margin: 0 auto;
    border-top: calc(3px * var(--ui-scale, 1)) solid currentColor;
    opacity: .35;
}
.city-window-resize {
    position: absolute;
    display: block;
    z-index: 20;
    touch-action: none;
    user-select: none;
    pointer-events: auto;
}
.city-window-resize[data-window-resize="n"],
.city-window-resize[data-window-resize="s"] {
    left: calc(14px * var(--ui-scale, 1));
    right: calc(14px * var(--ui-scale, 1));
    height: calc(6px * var(--ui-scale, 1));
    cursor: ns-resize;
}
.city-window-resize[data-window-resize="n"] { top: 0; }
.city-window-resize[data-window-resize="s"] { bottom: 0; }
.city-window-resize[data-window-resize="e"],
.city-window-resize[data-window-resize="w"] {
    top: calc(14px * var(--ui-scale, 1));
    bottom: calc(14px * var(--ui-scale, 1));
    width: calc(6px * var(--ui-scale, 1));
    cursor: ew-resize;
}
.city-window-resize[data-window-resize="e"] { right: 0; }
.city-window-resize[data-window-resize="w"] { left: 0; }
.city-window-resize:is([data-window-resize="nw"], [data-window-resize="ne"],
    [data-window-resize="sw"], [data-window-resize="se"]) {
    width: calc(14px * var(--ui-scale, 1));
    height: calc(14px * var(--ui-scale, 1));
}
.city-window-resize[data-window-resize="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.city-window-resize[data-window-resize="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.city-window-resize[data-window-resize="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
.city-window-resize[data-window-resize="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
.city-window-resize[data-window-resize="se"]::after {
    content: '';
    position: absolute;
    right: calc(3px * var(--ui-scale, 1));
    bottom: calc(3px * var(--ui-scale, 1));
    width: calc(6px * var(--ui-scale, 1));
    height: calc(6px * var(--ui-scale, 1));
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: .55;
}
/* Keep nested fixed-width reward cards and calendar scrollers inside the resized frame. */
.city-window-placed > .dr-card,
.city-window-placed > .mp-scroll {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    box-sizing: border-box;
}
.city-window-placed > .dr-card { min-height: 100%; }
.city-window-placed > :is(.popup-content, .panel-content, .warehouse-modal-body, .system-help-body) {
    min-height: 0;
    overflow: auto;
}

/* Expanded defaults: use the content's full height, limited only by real screen space. */
.city-window-frame {
    --city-window-screen-gap: clamp(8px, calc(12px * var(--ui-scale, 1)), 16px);
    --city-window-expanded-max-height: calc(100dvh - 2 * var(--city-window-screen-gap));
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}
.city-window-frame:not(.city-window-placed) {
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(var(--city-window-expanded-max-height) - var(--city-window-content-chrome, 0px)) !important;
}
#cameraSettingsPanel.city-window-frame:not(.city-window-placed) {
    --city-window-expanded-max-height: calc(100dvh - var(--bar-height, 56px) - 28px);
}
#buildingPopup.city-window-frame:not(.city-window-placed) {
    --city-window-expanded-max-height: calc(100dvh - 60px);
}
#constructionPopup.city-window-frame:not(.city-window-placed) {
    --city-window-expanded-max-height: calc(100dvh - 100px);
}
/* 건물 정보 팝업은 화면 우측에 항상 고정 (JS applyRightDockedPopup이 클래스를 붙임) */
:is(#buildingPopup, #publicBuildingPopup, #constructionPopup).popup-docked-right:not(.city-window-placed) {
    left: auto !important;
    right: calc(12px * var(--ui-scale, 1)) !important;
    top: calc(84px * var(--ui-scale, 1)) !important;
    bottom: auto !important;
    transform: none !important;
    --city-window-expanded-max-height: calc(100dvh - 84px * var(--ui-scale, 1) - 96px);
}
/* Release finite-body caps in both default and user-sized windows. The frame owns overflow. */
.city-window-frame :is(.popup-content, .panel-content, .pop-panel-content, .budget-panel-content,
    .help-panel-content, .help-content, .happiness-panel-body, .tourism-panel-body,
    .warehouse-modal-body, .offline-progress-body, .dr-card, .mp-scroll,
    .city-customize-panel, .skin-list, .skin-launch-body, .tsm-body, #achievementList) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}
.city-window-frame .offline-main-side {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}
/* Reserve expanded report content before the footer in the frame's scroll flow. */
.city-window-frame .offline-progress-body { flex: 0 0 auto !important; }
/* The report frame scrolls as a whole: the sticky title needs its own backdrop or rows
   slide under its text. Wide layout: the report column keeps its full height so the title
   sticks to the end, and the advisor column stays pinned to the visible frame. */
.city-window-frame .offline-progress-header {
    background: #FEFAEC;
    box-shadow: 0 6px 8px -8px rgba(80, 60, 10, 0.35);
}
@media (min-width: 701px) {
    .city-window-frame .offline-main-side { align-self: flex-start; }
    .city-window-frame .offline-advisor-side { position: sticky; top: 0; }
}
.city-window-frame :is(.city-window-titlebar, .city-customize-tabs) { flex-shrink: 0; }
.city-window-frame .city-window-titlebar:not(.city-window-drag-cap) {
    position: sticky !important;
    top: 0;
    z-index: 12;
}
.city-window-frame .city-window-attached-close {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    z-index: 14;
}
.city-window-frame:is(.dr-panel, .mp-card) .city-window-titlebar { background: #FEFAEC; }
.city-window-frame.city-window-reward-fits { overflow: visible !important; }
/* News/SNS use their existing scroll roots for navigation and reading position. */
#newsPanel.city-window-frame {
    --city-window-expanded-max-height: calc(100dvh - 2 * var(--news-window-inset, 16px));
    overflow: hidden !important;
}
#newsPanel.city-window-frame:not(.city-window-placed) {
    height: calc(var(--city-window-expanded-max-height) - var(--city-window-content-chrome, 0px)) !important;
}
#newsPanel.city-window-frame :is(.nh-page-area, #citySocialView) { max-height: none !important; }
#newsPanel.city-window-frame .nh-page-area { min-height: 0; flex: 1 1 0; }
