main:has(#jw-ui) { height:100dvh; min-height:0; padding:0; overflow:hidden; }
main:has(#jw-ui) > .content { min-height:0; margin:0; overflow:hidden; }
main:has(#jw-ui) > .container, main:has(#jw-ui) > .container > .content { width:100%; height:100%; min-width:0; min-height:0; margin:0; padding:0; overflow:hidden; }

.main-header { --bg:rgba(8,14,15,.78); --color:#edf4ec; --scrollbg:#0b1213; --scrollcolor:#edf4ec; }


/* 게임 화면 위에 필요한 조작만 배치합니다. */
#jw-ui { --p-ink:#eaf0e8; --p-muted:#95aaa0; --p-mint:#b5edc4; --p-line:rgba(196,224,205,.13); position:relative; width:100%; height:100%; min-width:0; overflow:hidden; background:#10221e; color:var(--p-ink); isolation:isolate; container-type:size; container-name:aegis; }
#jw-ui *, .p-game-dialog * { box-sizing:border-box; }
#jw-ui [hidden] { display:none !important; }
#jw-ui h2, #jw-ui h3, #jw-ui p, .p-game-dialog h2, .p-game-dialog p { margin:0; }
#jw-ui .jw-button, .p-game-dialog .jw-button { --jwbutton-bg:#1c322c; --jwbutton-color:#eaf0e8; --jwbutton-bghover:#2b463b; --jwbutton-height:40px; border-color:rgba(196,224,205,.18); border-radius:7px; box-shadow:none; font-weight:500; }
#jw-ui .jw-button:hover, .p-game-dialog .jw-button:hover { border-color:#83b897; box-shadow:none; }
#jw-ui .jw-button:focus-visible, #jw-three-canvas:focus-visible, .p-game-dialog .jw-button:focus-visible { outline:2px solid #c8f5a9; outline-offset:3px; }
#jw-ui .jw-button:disabled, .p-game-dialog .jw-button:disabled { opacity:.4; cursor:not-allowed; transform:none; }
#jw-ui .jw-button.solid, .p-game-dialog .jw-button.solid { --jwbutton-bg:#c6f3ad; --jwbutton-color:#173226; --jwbutton-bghover:#d8ffc0; border-color:#c6f3ad; font-weight:700; }
#jw-ui .p-game-header { position:absolute; z-index:3; top:18px; left:18px; right:18px; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; pointer-events:none; }
#jw-ui .p-game-resources { display:flex; gap:24px; padding:13px 18px; border-radius:10px; background:rgba(16,34,28,.92); pointer-events:auto; }
#jw-ui .p-game-resources > div { display:flex; flex-direction:column; gap:6px; }
#jw-ui .p-game-resources > div > span { color:var(--p-muted); font-size:12px; }
#jw-ui .p-game-resources strong { display:flex; align-items:center; gap:6px; color:#e4eddf; font-size:20px; line-height:1; font-variant-numeric:tabular-nums; font-weight:400; }
#jw-ui .p-game-resources b { font-weight:650; }
#jw-ui .p-game-resources small { color:#82998b; font-size:12px; }
#jw-ui .p-game-resources .p-core-value { color:#a9e4b4; }
#jw-ui .p-game-resources .p-credit-value { color:#e9d7a3; }
#jw-ui .p-game-tools { display:flex; gap:6px; pointer-events:auto; }
#jw-ui .p-game-tools .jw-button { min-width:40px; padding:0 10px; }
#jw-ui .p-game-layout, #jw-ui .p-battlefield { position:absolute; inset:0; min-width:0; }
#jw-ui .p-battlefield { overflow:hidden; background:radial-gradient(ellipse at 46% 43%,#2f5045 0%,#1d3730 45%,#122b25 78%); }
#jw-three-canvas { --p-field-top:100; --p-field-bottom:190; position:absolute; inset:0; touch-action:manipulation; outline-offset:-4px; }
#jw-three-canvas canvas { display:block; width:100%; height:100%; max-width:none; }
#jw-ui .p-field-bottom { position:absolute; z-index:2; bottom:132px; left:18px; }
#jw-ui .p-game-skills { display:flex; gap:8px; }
#jw-ui .p-game-skills .jw-button { --jwbutton-height:52px; min-width:142px; gap:10px; padding:8px 12px; text-align:left; background:rgba(19,44,35,.94); }
#jw-ui .p-game-skills kbd { color:#c2d6c2; font:inherit; }
#jw-ui .p-game-skills small { display:block; margin-top:3px; color:#a2b8a6; font-size:12px; font-weight:400; }
#jw-ui .p-game-skills .is-selected { border-color:#f4cd80; background:#3a3d2d; }
#jw-ui .p-command-panel { position:absolute; z-index:2; bottom:18px; left:18px; width:min(560px,calc(100% - 440px)); padding:12px; border-radius:10px; background:rgba(16,34,28,.94); }
#jw-ui #jw-range-text { margin-bottom:8px; color:#b9cdbb; font-size:12px; }
#jw-ui .p-tower-shop { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
#jw-ui .p-tower-card { --jwbutton-height:64px; display:grid; grid-template-columns:24px 1fr; align-content:center; gap:3px 6px; min-width:0; padding:8px; white-space:normal; text-align:left; background:#1b3127; }
#jw-ui .p-tower-card > i { grid-row:1 / 3; color:var(--tower-color); font-size:26px; font-style:normal; text-align:center; }
#jw-ui .p-tower-card strong { display:block; color:#e1eade; font-weight:500; line-height:1.25; word-break:keep-all; }
#jw-ui .p-tower-card > b { grid-column:2; color:#e4d8ad; font-weight:500; }
#jw-ui .p-tower-card.is-selected { border-color:#b9d6a1; background:#2b4230; }
#jw-ui .p-tower-card.is-unaffordable { opacity:.48; }
#jw-ui .p-tower-detail { position:absolute; z-index:3; top:76px; right:18px; width:260px; padding:14px; border-radius:10px; background:rgba(16,34,28,.96); }
#jw-ui .p-tower-detail h3 { display:flex; justify-content:space-between; gap:8px; font-size:16px; font-weight:500; }
#jw-ui .p-tower-detail h3 span { color:#acc694; font-size:12px; }
#jw-ui .p-tower-stats { display:flex; justify-content:space-between; margin:12px 0; color:#9aaf9b; font-size:12px; }
#jw-ui .p-tower-stats b { display:block; margin-top:4px; color:#dce9d6; font-size:16px; font-weight:500; }
#jw-ui .p-tower-actions { display:flex; gap:6px; }
#jw-ui .p-tower-actions .jw-button { flex:1; padding:0 8px; }
#jw-ui .p-tower-actions .p-sell { color:#c4bfa7; }
#jw-ui .p-game-footer { position:absolute; z-index:2; bottom:18px; right:76px; width:310px; padding:12px; border-radius:10px; background:rgba(16,34,28,.94); }
#jw-ui .p-wave-progress { display:flex; justify-content:space-between; gap:8px; margin-bottom:10px; color:#a7bda7; font-size:12px; }
#jw-round-text { color:#d9e9d8; }
#jw-ui .p-game-playback { display:flex; align-items:center; gap:6px; }
#jw-ui .p-game-playback .jw-button { min-width:40px; }
#jw-ui #jw-start-btn { flex:1; padding:0 10px; }
#jw-ui .p-game-loading { position:absolute; inset:0; z-index:5; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:20px; background:#19382d; color:#bfceb9; }
#jw-ui .p-brand-symbol { color:#c6f3ad; font-size:42px; line-height:1; }
#jw-ui .p-game-loading p { max-width:390px; padding:0 20px; text-align:center; line-height:1.8; }
#jw-ui .p-game-toast { position:absolute; z-index:4; left:50%; top:100px; width:max-content; max-width:calc(100% - 36px); padding:10px 16px; transform:translateX(-50%); border-radius:8px; background:rgba(22,44,29,.96); color:#e3efd5; text-align:center; line-height:1.6; pointer-events:none; }
#jw-ui .p-game-noscript { position:absolute; z-index:6; inset:0; display:grid; place-items:center; padding:20px; background:#19382d; color:#ffcec4; }
#jw-ui:fullscreen { width:100%; height:100dvh; }
.p-game-dialog { width:min(560px,calc(100% - 32px)); max-height:calc(100dvh - 48px); margin:auto; padding:38px; overflow:auto; border:1px solid #52634a; border-radius:18px; background:#1b3025; color:#eaf1e1; box-shadow:0 30px 100px rgba(0,0,0,.4); }
.p-game-dialog::backdrop { background:rgba(5,19,14,.65); backdrop-filter:blur(5px); }
.p-game-dialog .p-dialog-eyebrow { display:block; margin-bottom:17px; color:#c0dea7; font-size:12px; letter-spacing:3px; }
.p-game-dialog h2 { color:#edf4e4; font-size:36px; line-height:1.25; font-weight:600; letter-spacing:-1px; }
.p-game-dialog #jw-dialog-description { margin-top:16px; color:#a8bba4; line-height:1.8; word-break:keep-all; }
.p-game-dialog .p-dialog-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; }
#jw-ui .p-game-dialog .p-dialog-actions .jw-button { --jwbutton-height:48px; flex:1; padding:0 20px; }
.p-game-dialog .p-briefing { display:grid; gap:16px; margin-top:26px; }
.p-game-dialog .p-briefing > div { display:grid; grid-template-columns:30px 1fr; gap:10px; }
.p-game-dialog .p-briefing b { color:#c5e3aa; font-size:16px; font-weight:500; }
.p-game-dialog .p-briefing strong { display:block; margin-bottom:5px; color:#e0ead7; font-weight:500; }
.p-game-dialog .p-briefing p { color:#9fb299; line-height:1.7; }
.p-game-dialog .p-upgrade-choices { display:grid; gap:10px; margin-top:22px; }
#jw-ui .p-game-dialog .p-upgrade-choices .jw-button { --jwbutton-height:auto; display:grid; grid-template-columns:38px minmax(0,1fr); align-items:center; justify-content:start; gap:14px; width:100%; padding:17px; white-space:normal; text-align:left; }
.p-game-dialog .p-upgrade-choices i { color:#c4e4ad; font-size:28px; font-style:normal; }
.p-game-dialog .p-upgrade-choices strong { display:block; margin-bottom:7px; font-size:16px; }
.p-game-dialog .p-upgrade-choices small { display:block; color:#a2b59b; font-size:inherit; line-height:1.6; }
.p-game-dialog .p-result-stars { margin:24px 0 12px; color:#d5eeb3; font-size:36px; letter-spacing:12px; }
.p-game-dialog .p-result-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-top:24px; }
.p-game-dialog .p-result-grid span { color:#97ae93; font-size:12px; }
.p-game-dialog .p-result-grid strong { display:block; margin-top:8px; color:#e4efd8; font-size:24px; font-weight:500; }
.p-game-dialog .p-record { margin-top:22px; color:#95ad8d; font-size:12px; }
@container aegis (max-width:1100px) {
	#jw-ui .p-command-panel { width:calc(100% - 410px); }
	#jw-ui .p-tower-card { grid-template-columns:1fr; text-align:center; }
	#jw-ui .p-tower-card > i { display:none; }
	#jw-ui .p-tower-card > b { grid-column:1; }
}
@container aegis (max-width:900px) {
	#jw-three-canvas { --p-field-bottom:280; }
	#jw-ui .p-tower-card { --jwbutton-height:76px; }
	#jw-ui .p-command-panel { bottom:146px; left:12px; right:12px; width:auto; padding:10px; }
	#jw-ui .p-field-bottom { bottom:86px; left:12px; }
	#jw-ui .p-game-footer { bottom:12px; left:12px; right:72px; width:auto; padding:10px; }
	#jw-ui .p-wave-progress { margin-bottom:6px; }
	#jw-ui .p-tower-detail { top:76px; right:12px; width:240px; }
	#jw-ui .p-game-toast { top:90px; }
}
@container aegis (max-width:520px) {
	#jw-ui .p-game-header { top:12px; left:12px; right:12px; }
	#jw-ui .p-game-resources { gap:14px; padding:10px; }
	#jw-ui .p-game-resources strong { font-size:18px; gap:4px; }
	#jw-ui .p-game-tools { position:absolute; top:70px; right:0; }
	#jw-ui .p-tower-detail { top:132px; width:228px; }
	#jw-ui .p-tower-card { padding:6px 2px; }
	#jw-ui .p-game-skills .jw-button { min-width:134px; padding:7px 10px; }
	#jw-ui .p-game-toast { top:118px; }
	.p-game-dialog { padding:26px 22px; }
	.p-game-dialog h2 { font-size:30px; }
}
@media (max-width:768px) {
	#jw-ui .p-game-header { left:72px; }
	#jw-ui:fullscreen .p-game-header { left:12px; }
}
@container aegis (max-height:540px) and (min-width:650px) {
	#jw-three-canvas { --p-field-top:80; --p-field-bottom:166; }
	#jw-ui .p-game-header { top:10px; }
	#jw-ui .p-game-resources { padding:8px 12px; }
	#jw-ui .p-command-panel { bottom:10px; left:12px; right:auto; width:calc(100% - 330px); padding:8px; }
	#jw-ui .p-tower-card { --jwbutton-height:76px; }
	#jw-ui .p-field-bottom { bottom:112px; left:auto; right:60px; }
	#jw-ui .p-game-skills .jw-button { --jwbutton-height:44px; min-width:116px; padding:5px 8px; }
	#jw-ui .p-game-footer { bottom:10px; left:auto; right:60px; width:240px; padding:8px; }
	#jw-ui .p-tower-detail { top:76px; right:12px; width:228px; }
}
@media (prefers-reduced-motion:reduce) {
	#jw-ui *, .p-game-dialog * { transition:none !important; }
}
