* { box-sizing: border-box; }
html, body { margin: 0; background: #171a16; font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
button, a { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
#stage { background: #272b23; color: #f8f0dc; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.game-header { position: absolute; z-index: 5; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.game-header a, .game-header button { pointer-events: auto; }
.back, .sound { border: 1px solid #d6c49275; border-radius: 99px; padding: 9px 13px; color: #fff6df; background: #171b17d9; text-decoration: none; font-size: 12px; font-weight: 750; }
.header-title { color: #fff6df; font-size: 13px; font-weight: 800; text-shadow: 0 1px 5px #000; }
.sound { margin-left: auto; }
.feedback { position: absolute; z-index: 3; bottom: calc(130px + env(safe-area-inset-bottom)); left: 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; text-shadow: 0 2px 7px #000; opacity: 0; transition: opacity .18s; white-space: nowrap; }
.feedback.show { opacity: 1; }
.feedback strong { color: #d6ff88; font-size: clamp(22px, 4vw, 32px); font-weight: 900; }
.feedback span { color: #fff3d5; font-size: 14px; font-weight: 800; }
.panel { position: absolute; z-index: 4; width: min(340px, calc(100% - 32px)); padding: 23px; border: 1px solid #d7bf82; border-radius: 9px; background: #20251feF; box-shadow: 0 12px 36px #0007; }
#title, #result, #pause {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  padding: 28px; border: 0; border-radius: 22px;
  background: #fff; color: #1a1a1a; box-shadow: 0 10px 34px rgba(0, 0, 0, .18);
  text-align: center;
}
#error { left: max(20px, env(safe-area-inset-left)); bottom: max(38px, env(safe-area-inset-bottom)); }
#title h2, #result h2, #pause h2 { color: #1a1a1a; font-size: 24px; font-weight: 750; line-height: 1.3; letter-spacing: -.03em; }
#title h2 { margin: 0 0 24px; }
#title .name-label { display: block; margin: 0 0 8px; color: #444; font-size: 14px; font-weight: 700; }
#title .name-input { display: block; width: 100%; height: 48px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid #e5e5e5; border-radius: 14px; background: #fafafa; color: #111; font: inherit; font-size: 16px; text-align: center; }
#title .name-input::placeholder { color: #aaa; }
#title .primary, #result .primary, #pause .primary { width: min(100%, 220px); padding: 13px 20px; border: 0; border-radius: 999px; background: #1a1a1a; color: #fff; font-size: 15px; font-weight: 700; }
#title .primary:hover, #result .primary:hover, #pause .primary:hover { background: #333; }
#title :focus-visible, #result :focus-visible, #pause :focus-visible { outline: 3px solid #555; outline-offset: 3px; }
.panel h2 { margin: 0; color: #fff5da; font-size: clamp(24px, 4vw, 35px); line-height: 1.13; letter-spacing: -.05em; }
.panel p { margin: 12px 0 18px; line-height: 1.5; color: #e1d6bd; font-size: 15px; }
.primary { border: 0; border-radius: 5px; padding: 13px 19px; background: #c8f66e; color: #18210e; font-weight: 900; }
.primary:hover { background: #dcff9c; }
.reset-view { position: absolute; z-index: 4; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); padding: 9px 12px; border: 1px solid #d6c49275; border-radius: 99px; background: #171b17d9; color: #fff6df; font-size: 12px; font-weight: 800; }
.notice { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 12px 20px; border-radius: 6px; background: #171b17eb; font-weight: 800; }
.notice p { margin: 0; }
.pause-panel { top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.pause-panel .primary { margin-top: 20px; }
#result-name { display: block; overflow-wrap: anywhere; }
#result .result-zero { display: block; }
.salary-options { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
.salary-options legend { width: 100%; margin-bottom: 8px; color: #444; font-size: 14px; font-weight: 700; }
.salary-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.salary-buttons button { min-height: 42px; padding: 6px 2px; border: 1px solid #ddd; border-radius: 10px; background: #fff; color: #1a1a1a; font-size: 14px; font-weight: 700; }
.salary-buttons button[aria-pressed="true"] { border-color: #1a1a1a; background: #1a1a1a; color: #fff; }
#result .primary { margin-top: 16px; }
.swing { position: absolute; z-index: 4; right: max(20px, env(safe-area-inset-right)); bottom: calc(65px + env(safe-area-inset-bottom)); min-width: 110px; min-height: 54px; border: 0; border-radius: 999px; background: #1a1a1a; color: #fff; font-size: 16px; font-weight: 700; touch-action: manipulation; box-shadow: 0 4px 14px #0005; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #c8f66e; outline-offset: 3px; }
@media (max-width: 550px) {
  .header-title { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .header-title { display: none; }
  #title, #result, #pause { width: min(320px, calc(100% - 32px)); padding: 16px 22px; }
  #title h2, #result h2, #pause h2 { font-size: 22px; }
  #title h2 { margin-bottom: 12px; }
  #title .name-label { margin-bottom: 5px; }
  #title .name-input { height: 38px; margin-bottom: 10px; }
  #title .primary, #result .primary, #pause .primary { padding: 9px 16px; }
  .feedback { top: 65px; bottom: auto; left: 16px; align-items: flex-start; }
  .feedback strong { font-size: 19px; }
  .feedback span { font-size: 12px; }
  .salary-options { margin-top: 8px; }
  .salary-options legend { margin-bottom: 4px; }
  .salary-buttons button { min-height: 36px; }
  #result .primary { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .feedback { transition: none; } }
