@font-face {
  font-family: BlackHan;
  src: url("fonts/title-ko.woff2?v=2") format("woff2");
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f7f3e8;
  --ink: #203e3a;
  --soft: #51625a;
  --red: #ab3d2b;
  --display: BlackHan, "Malgun Gothic", sans-serif;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--paper); }
body { color: var(--ink); word-break: keep-all; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, .stage:focus-visible { outline: 3px solid #08777a; outline-offset: 3px; }
[hidden] { display: none !important; }
.icons, .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.arcade {
  --edge: clamp(12px, 3vw, 46px);
  width: min(1610px,100%); height: 100vh; height: 100svh; margin: auto;
  padding: env(safe-area-inset-top) max(var(--edge),env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--edge),env(safe-area-inset-left));
  display: grid; grid-template-rows: clamp(53px,8vh,76px) minmax(0,1fr) clamp(60px,8.2vh,74px);
}
.bar, .rail, nav, .best, .brand, .control-hint, .balance { display: flex; align-items: center; }
.bar, .rail { justify-content: space-between; gap: 10px; }
.rail { justify-content: center; }
.brand { flex: none; gap: 8px; font: 400 clamp(19px,2.1vw,27px)/1 var(--display); letter-spacing: -.05em; }
.brand svg { color: var(--red); width: 34px; height: 34px; }
nav { gap: 7px; }
.glass, .dialog-close { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fcf9ef; border: 1px solid #acb5a9; }
.glass:hover, .dialog-close:hover { background: #e8eadc; }
.glass .ic { width: 18px; height: 18px; }
.best { gap: 4px; font-size: 13px; font-weight: 700; white-space: nowrap; padding-right: 12px; margin-right: 5px; border-right: 1px solid #bfc3b5; }
.best .ic { color: #90602e; width: 16px; height: 16px; margin-right: 3px; }
.best b { margin-left: 3px; font: 800 17px Arial,sans-serif; font-variant-numeric: tabular-nums; }
.counter { position: relative; isolation: isolate; overflow: hidden; border: 1.5px solid #61796b; border-radius: 16px; box-shadow: 0 2px 0 #acb3a5; background: #dfd9bf; }
.stage, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage { z-index: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; cursor: pointer; outline-offset: -4px !important; }
.stage:focus:not(:focus-visible) { outline: none; }
.stage canvas { display: block; pointer-events: none; }
[data-mode="playing"] .stage { cursor: crosshair; }
.intro, .live, .start, .play-hint, .feedback { position: absolute; z-index: 1; pointer-events: none; }
.intro { left: 0; right: 0; top: clamp(15px,5.8%,70px); text-align: center; padding: 0 12px; }
h1, h2, p { margin: 0; }
h1 { font: 400 clamp(36px,5.3vw,73px)/1.06 var(--display); letter-spacing: -.06em; color: #223e35; text-shadow: 0 2px #fdf6da85; }
.intro p { font-size: clamp(12px,1.19vw,17px); font-weight: 650; letter-spacing: -.035em; color: #374f43; margin-top: 6px; }
.start { bottom: 6.6%; left: 50%; transform: translateX(-50%); }
.primary {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 49px; min-width: 158px; padding: 10px 24px; background: var(--red); color: #fffbed;
  border: 1.5px solid #702e21; border-radius: 12px; box-shadow: 0 4px 0 #713526, 0 6px 18px #44251938;
  font-size: 17px; font-weight: 800; letter-spacing: -.04em; white-space: nowrap;
}
.primary .ic { width: 16px; height: 16px; }
.primary:hover { background: #983322; }
.primary:disabled { cursor: progress; opacity: .75; }
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #713526; }
.live { left: clamp(12px,2vw,30px); top: clamp(12px,2.4vh,25px); border: 1px solid #9baf9b; background: #fffbeaeb; border-radius: 10px; padding: 7px 13px 8px; }
.live span { color: #4e6254; font-size: 11px; font-weight: 700; }
.live div { display: flex; align-items: baseline; gap: 4px; }
.live output { font: 700 clamp(23px,3.8vh,39px)/1.04 Arial,sans-serif; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.live b { font-size: 12px; }
.feedback, .play-hint { left: 50%; transform: translateX(-50%); white-space: nowrap; text-align: center; }
.feedback { top: 14%; font-size: 17px; font-weight: 850; opacity: 0; padding: 4px 13px; border-radius: 20px; color: #214e40; background: #fffce5ea; }
.feedback.show { animation: pop .85s ease both; }
@keyframes pop { 0% { opacity: 0; translate: 0 6px; } 18%,77% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -7px; } }
.play-hint { bottom: 6.5%; padding: 7px 13px; color: #fffced; background: #23483edb; border-radius: 20px; font-weight: 700; font-size: 13px; }
.play-hint.warn { background: #853822ed; }
.balance { position: absolute; right: clamp(12px,2vw,30px); top: clamp(12px,2.4vh,25px); z-index: 1; pointer-events: none; flex-direction: column; align-items: flex-start; gap: 8px; padding: 8px 10px 12px; border: 1px solid #9baf9b; background: #fffbeaeb; border-radius: 10px; font-size: 11px; font-weight: 750; }
.level { position: relative; width: clamp(64px,8vw,112px); height: 8px; border-radius: 5px; border: 1px solid #b7bbac; background: linear-gradient(90deg,#dba587 0%,#ead9b4 26%,#adccb0 47%,#adccb0 53%,#ead9b4 74%,#dba587); }
.level::after { content: ""; position: absolute; left: 50%; top: -2px; height: 10px; width: 1px; background: #496953; }
.level i { position: absolute; z-index: 1; left: var(--tilt,50%); top: -3px; width: 7px; height: 12px; transform: translateX(-50%); border: 1px solid #f8f5e4; border-radius: 3px; background: var(--ink); }
.balance.risky .level i { background: var(--red); }
.control-hint { gap: 14px; color: #4c5c53; font-size: 12px; font-weight: 650; }
.control-hint span { display: inline-flex; align-items: center; gap: 3px; }
kbd { display: inline-block; padding: 3px 5px; border: 1px solid #9eaa9c; border-bottom-width: 2px; border-radius: 4px; background: #fffcf2; color: var(--ink); font: 650 11px/1 Arial,sans-serif; }
.touch-hint { display: none; }
.game-controls { width: min(100%,520px); display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: clamp(7px,2.5vw,20px); }
.game-controls button { min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; font-weight: 750; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.steer { background: #fbf9ef; border: 1px solid #778b79; box-shadow: 0 2px #879785; }
.steer .ic { width: 17px; height: 17px; }
.steer:disabled { opacity: .55; cursor: default; }
.steer[aria-pressed="true"] { background: #31574b; color: #fffbed; box-shadow: none; transform: translateY(2px); }
.drop { background: var(--red); border: 1px solid #743528; color: #fffbed; box-shadow: 0 2px #743528; }
.drop .ic { width: 19px; height: 19px; }
.drop:disabled { background: #ddd8c9; border-color: #bcb6a5; color: #686655; box-shadow: none; }
.cover { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: #1c342e68; padding: 12px; }
.panel, .dialog-inner { padding: 23px 27px 26px; border: 1px solid #8ea593; border-radius: 14px; color: var(--ink); background: #fbf7e9; box-shadow: 0 5px 18px #17352730; }
.panel { width: min(310px,100%); text-align: center; }
.panel-bowl { width: 37px; height: 35px; color: var(--red); }
.panel h2, .dialog-inner h2 { margin: 6px 0 0; font: 400 31px/1.16 var(--display); letter-spacing: -.05em; }
.panel p, .dialog-inner p { color: #486054; font-size: 14px; line-height: 1.55; margin-top: 9px; }
.panel p:empty { display: none; }
.panel .result-score { font-weight: 800; color: var(--ink); font-size: 16px; }
.panel .primary, .dialog-inner .primary { margin-top: 17px; min-height: 42px; font-size: 15px; }
dialog { padding: 0; width: min(366px,calc(100% - 30px)); border: 0; border-radius: 14px; background: transparent; color: var(--ink); max-height: 92svh; }
dialog::backdrop { background: #17382e9c; }
.dialog-inner { position: relative; }
.dialog-close { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; }
.dialog-inner .primary { width: 100%; }
@media (pointer: coarse) { .key-hint { display: none; } .touch-hint { display: flex; } }
@media (max-width:600px) {
  .arcade { --edge: 9px; }
  .brand { gap: 5px; font-size: 19px; } .brand svg { width: 27px; height: 27px; }
  nav { gap: 4px; } .glass { width: 38px; height: 38px; }
  .best { margin-right: 2px; padding-right: 7px; gap: 2px; font-size: 11px; }
  .best b { font-size: 14px; } .best .ic { width: 13px; height: 13px; margin-right: 1px; }
  .counter { border-radius: 12px; } .intro { top: 8%; } .intro p { font-size: 13px; }
  .live { padding: 6px 9px; } .start { bottom: 8%; }
  .balance { gap: 5px; font-size: 11px; } .level { width: 54px; }
  .control-hint { font-size: 11px; letter-spacing: -.03em; } .play-hint { font-size: 12px; }
}
@media (max-width:365px) { .best span:first-of-type { display: none; } .level { width: 40px; } .control-hint { font-size: 10px; } .game-controls button { font-size: 13px; gap: 4px; } }
@media (max-height:500px) and (orientation:landscape) {
  .arcade { grid-template-rows: 43px minmax(0,1fr) 54px; --edge: 10px; }
  .brand { font-size: 18px; } .brand svg { width: 26px; height: 26px; } .glass { width: 34px; height: 34px; }
  .intro { top: 8%; left: 3%; right: auto; width: 28%; padding: 8px 10px; border-radius: 9px; background: #fff9e8df; text-align: left; } h1 { font-size: clamp(22px,4vw,38px); }
  .intro p { font-size: 11px; margin-top: 4px; } .start { left: 5%; transform: none; bottom: 12%; }
  .primary { min-height: 36px; min-width: 118px; font-size: 13px; padding: 5px 12px; }
  .panel { padding: 12px 16px 15px; } .panel-bowl { width: 24px; height: 24px; } .panel h2 { font-size: 24px; }
}
@media (prefers-reduced-motion:reduce) { .feedback.show { animation: none; opacity: 1; } }
