:root {
  --bg: #0e1014;
  --panel: #14171d;
  --raise: #1c2028;
  --line: #262b34;
  --text: #f3f4f6;
  --mute: #8b919c;
  --accent: #2bd46a;
  --accent-deep: #178a42;
  --f-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  --f-disp: "Black Han Sans", var(--f-ui);
  --f-num: "Archivo Black", var(--f-ui);
  --f-mono: "Space Mono", ui-monospace, monospace;
  --head: 64px;
  --foot: 40px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--f-ui);
  -webkit-font-smoothing: antialiased; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 2px 7px; color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chip { font-family: var(--f-mono); font-size: 10.5px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--mute); }
.chip.hot { border-color: var(--accent); }
.chip.hot { background: var(--accent); color: #fff; }

.app { display: grid; grid-template-rows: var(--head) 1fr var(--foot); grid-template-columns: minmax(0, 1fr); height: 100svh; }

/* 머리줄 */
.top { position: relative; display: flex; min-width: 0; border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.logo { display: flex; align-items: center; padding: 0 20px; min-width: 0; }
.logo b { font-family: var(--f-disp); font-weight: 400; font-size: 26px; letter-spacing: -0.01em; white-space: nowrap; }
.top-r { margin-left: auto; display: flex; }
.top-target {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: baseline; gap: 8px; white-space: nowrap;
}
.top-target span { font-family: var(--f-disp); font-size: 20px; color: var(--mute); }
.top-target span:last-child { color: var(--text); }
.top-target b { font-family: var(--f-num); font-weight: 400; font-size: 44px; line-height: 1; color: var(--accent); text-shadow: 0 0 18px rgba(43, 212, 106, .45); }
body:not([data-state="play"]) .top-target { display: none; }
.best-top { display: flex; align-items: center; gap: 8px; padding: 0 18px; border-left: 1px solid var(--line); font-family: var(--f-mono); font-size: 11px; color: var(--mute); }
.best-top b { font-family: var(--f-num); font-weight: 400; font-size: 18px; color: var(--accent); }
.sound { border-left: 1px solid var(--line); width: 56px; display: flex; align-items: center; justify-content: center; color: var(--mute); }
.sound svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound svg path:first-child { fill: currentColor; stroke: none; }
.sound .x { display: none; }
.sound[aria-pressed="false"] .w { display: none; }
.sound[aria-pressed="false"] .x { display: inline; }
.sound:hover { color: var(--text); }

/* 본문 */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 0; }
.stage {
  position: relative; min-height: 0; border-right: 1px solid var(--line);
  background-image: linear-gradient(#15181d 1px, transparent 1px), linear-gradient(90deg, #15181d 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  display: flex; align-items: center; justify-content: center; padding: 8px;
}
.stage-in { position: relative; width: 100%; height: calc(100svh - var(--head) - var(--foot) - 16px); }
#scene { display: block; width: 100%; height: 100%; border-radius: 14px; background: #000; touch-action: none; transition: opacity .3s; user-select: none; -webkit-user-select: none; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); }
#scene.fade { opacity: 0; }
#scene.thud { animation: thud .26s ease-out; }
@keyframes thud { 30% { transform: translateY(6px); filter: brightness(.55); } }
#scene.alarm { animation: alarm .3s steps(2) 4; }
@keyframes alarm { 50% { box-shadow: 0 0 0 4px #ff2a55, 0 0 40px rgba(255, 42, 85, .6); filter: saturate(1.6) hue-rotate(-20deg); } }

.hud-msg {
  position: absolute; right: 16px; bottom: 16px; max-width: calc(100% - 32px);
  background: rgba(12, 14, 18, .78); color: #fff; border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px;
  padding: 14px 20px 15px; font-family: var(--f-disp); font-size: 24px; line-height: 1.2;
  backdrop-filter: blur(10px) saturate(1.4); -webkit-backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: rotate(-2.5deg); transform-origin: 100% 100%;
  animation: popin .42s cubic-bezier(.2, 1.6, .4, 1);
}
.hud-msg::before {
  display: block; width: max-content; margin-bottom: 6px; padding: 2px 9px; border-radius: 99px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .02em; background: rgba(255, 255, 255, .12);
}
.hud-msg b { font-weight: 400; color: var(--accent); }
.hud-msg small { display: block; font-family: var(--f-mono); font-size: 12px; opacity: .75; margin-top: 6px; }
.hud-msg.big { font-size: 28px; }
.hud-msg.big::before { content: "목표"; color: var(--accent); }
.hud-msg.ok {
  background: linear-gradient(135deg, #6bf59c, #2bd46a 55%, #1fb859); color: #052611; border-color: rgba(255, 255, 255, .5);
  box-shadow: 0 0 0 4px rgba(43, 212, 106, .22), 0 16px 36px rgba(43, 212, 106, .35), inset 0 2px 0 rgba(255, 255, 255, .5);
  transform: rotate(2deg);
}
.hud-msg.ok::before { content: "도착"; background: #052611; color: #6bf59c; }
.hud-msg.ok b { color: #052611; }
.hud-msg.bad {
  background: linear-gradient(135deg, #ff4d6d, #ff2a55 60%, #c8103a); border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 0 0 4px rgba(255, 42, 85, .22), 0 16px 36px rgba(255, 42, 85, .35), -3px 0 0 #00f0ff;
  animation: popin .42s cubic-bezier(.2, 1.6, .4, 1), glitch .5s steps(2) .42s 2;
}
.hud-msg.npc { background: linear-gradient(135deg, #3a1d10, #5a2c16); border-color: #d4a94a; box-shadow: 0 0 0 3px rgba(212, 169, 74, .25), 0 16px 36px rgba(0, 0, 0, .5); }
.hud-msg.npc::before { content: "승객"; background: #d4a94a; color: #2a1408; }
.hud-msg.npc b { color: #f3d27a; }
.hud-msg.lvl { background: linear-gradient(135deg, #fff36b, #fcee0a 55%, #e0c800); color: #1a1600; border-color: rgba(255, 255, 255, .6); box-shadow: 0 0 0 4px rgba(252, 238, 10, .22), 0 16px 36px rgba(252, 238, 10, .3), inset 0 2px 0 rgba(255, 255, 255, .6); font-size: 28px; }
.hud-msg.lvl::before { content: "레벨 업"; background: #1a1600; color: #fcee0a; }
.hud-msg.lvl b { color: #c8103a; }
.hud-msg.bad::before { content: "추락"; background: #1a0008; color: #ff8fa3; }
@keyframes popin { from { transform: scale(.6) rotate(-10deg); opacity: 0; } }
@keyframes glitch { 50% { transform: translateX(3px) rotate(-2.5deg); box-shadow: 0 0 0 4px rgba(255, 42, 85, .22), 0 16px 36px rgba(255, 42, 85, .35), 3px 0 0 #00f0ff; } }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }
.hud-floor {
  position: absolute; right: 12px; top: 12px; min-width: 92px; padding: 8px 14px; border-radius: 12px;
  background: #07080b; color: var(--accent); text-shadow: 0 0 12px rgba(43, 212, 106, .7);
  font-family: var(--f-num); font-size: 52px; line-height: 1; text-align: right;
}
.hud-floor::after { content: "층"; font-family: var(--f-disp); font-size: 20px; margin-left: 4px; }

/* 오른쪽 판 */
.panel { display: flex; min-height: 0; overflow: auto; background: var(--panel); }
.p { display: flex; flex-direction: column; width: 100%; min-height: 100%; }

.go-wrap { margin-top: auto; padding: 14px; }
.go {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  height: 60px; padding: 0 20px; border-radius: 14px; background: var(--accent); color: #fff;
  font-family: var(--f-disp); font-size: 24px; transition: filter .12s, transform .08s;
}
.go .arr { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.go:hover { filter: brightness(1.07); }
.go:hover .arr { transform: translateY(-3px); }
.go:active { transform: scale(.98); }

/* 고르기 */
.sel-top { display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 0; }
.practice {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; text-align: center;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); transition: border-color .12s, background .12s;
}
.practice b { font-family: var(--f-disp); font-weight: 400; font-size: 17px; }
.practice span { font-size: 11.5px; color: var(--mute); }
.practice:hover { border-color: #3a404b; background: #181b21; }
.chars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding-bottom: 4px; }
.char { width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); overflow: hidden; padding: 0; background: #fff; transition: box-shadow .12s; }
.char img { width: 100%; height: 100%; object-fit: contain; display: block; }
.char.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.types { padding: 14px 14px 0; display: grid; gap: 12px; }
.type {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px 13px 12px; transition: border-color .12s, background .12s;
}
.type:hover { background: #181b21; border-color: #3a404b; }
.type .no { font-family: var(--f-mono); font-size: 10.5px; color: var(--mute); }
.type .nm { display: block; font-family: var(--f-disp); font-size: 17px; }
.type .ds { display: block; font-size: 12px; color: var(--mute); margin-top: 2px; }
.type .mt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-left: 8px; white-space: nowrap; }
.type .mt b { font-family: var(--f-num); font-weight: 400; font-size: 14px; color: var(--accent); }
.type .mt i { font-style: normal; font-family: var(--f-mono); font-size: 10px; color: var(--mute); }
.type.sel { border-color: var(--accent); background: rgba(43, 212, 106, .07); }
.type.sel .no { color: var(--accent); }
.type .prac {
  margin-top: 4px; padding: 3px 10px; border-radius: 99px; font-family: var(--f-ui); font-size: 11.5px; font-weight: 600; color: var(--text);
  background: linear-gradient(180deg, #3b424e, #262b33); border: 1px solid #0b0d10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 2px 0 #0b0d10; cursor: pointer;
}
.type .prac:hover { color: var(--accent); }
.type .prac:active { transform: translateY(2px); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5); }
.pl-tol { margin: 10px 2px 0; font-size: 12.5px; color: var(--mute); text-align: center; }
.rs-world { margin: 0; padding: 0 16px 14px; font-size: 13px; color: var(--text); }
.rs-world b { color: var(--accent); font-weight: 700; }

/* 운행 중 */
.pl-target { padding: 18px 16px 16px; }
.pl-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--mute); margin-bottom: 10px; }
.led {
  display: flex; justify-content: center; align-items: center; height: 132px; border-radius: 16px;
  background: #050608; box-shadow: inset 0 2px 10px rgba(0, 0, 0, .8), 0 0 0 1px #20242c;
}
.led svg { height: 92px; width: auto; overflow: visible; }
.led .on { fill: #3dff85; filter: drop-shadow(0 0 6px rgba(43, 212, 106, .85)); }
.led .off { fill: #0a2214; }
.led.pulse { animation: pop .35s ease-out; }
@keyframes pop { from { filter: brightness(2.2); } }

/* 열림 버튼판 */
.plate {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px;
  margin: 0 16px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #1a1d23, #15181d);
}
.open-btn {
  position: relative; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, #f4f6f8, #c9ced4 60%, #9ba2aa);
  box-shadow: 0 0 0 6px #0f1115, 0 0 0 7px #2c313a, 0 5px 0 6px #0f1115, 0 5px 0 7px #2c313a, 0 16px 24px rgba(0, 0, 0, .5);
  transition: transform 50ms ease-out, box-shadow 50ms ease-out;
  touch-action: none;
}
.open-btn::before { /* 불 들어오는 테두리 */
  content: ""; position: absolute; inset: 12px; border-radius: 50%;
  border: 3px solid #b0b6bd; transition: border-color 80ms, box-shadow 80ms;
}
.open-btn svg { position: relative; width: 56px; fill: #1a1a1a; }
.open-btn.live::before { border-color: #8fe9b0; box-shadow: 0 0 8px rgba(43, 212, 106, .35); }
.open-btn.down { transform: translateY(5px); box-shadow: 0 0 0 6px #0f1115, 0 0 0 7px #2c313a, 0 0 0 6px #0f1115, 0 0 0 7px #2c313a, 0 6px 10px rgba(0, 0, 0, .5); }
.open-btn.down::before { border-color: var(--accent); box-shadow: 0 0 18px rgba(43, 212, 106, .8), inset 0 0 8px rgba(43, 212, 106, .5); }
.open-btn.down svg { fill: var(--accent); }

/* ── 엘리베이터마다 다른 열림 버튼 ─────────────── */
.open-btn .lever { display: none; }
/* 아파트: 스테인리스 사각 판 + 둥근 열림 버튼 + 점자 */
body[data-etype="apt"] .open-btn {
  width: 128px; height: 156px; border-radius: 10px;
  background:
    radial-gradient(circle, #8a929b 2.2px, transparent 2.6px) 50% 86% / 12px 10px no-repeat,
    radial-gradient(circle, #8a929b 2.2px, transparent 2.6px) calc(50% - 12px) 86% / 12px 10px no-repeat,
    radial-gradient(circle, #8a929b 2.2px, transparent 2.6px) calc(50% + 12px) 92% / 12px 10px no-repeat,
    radial-gradient(circle, #8a929b 2.2px, transparent 2.6px) calc(50% - 12px) 92% / 12px 10px no-repeat,
    repeating-linear-gradient(90deg, #d9dee3 0 1px, #c9cfd5 1px 2px, #e3e7eb 2px 3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(0, 0, 0, .15), 0 0 0 1px #7d8792, 0 4px 0 #59626c, 0 12px 22px rgba(0, 0, 0, .5);
}
body[data-etype="apt"] .open-btn::before {
  inset: auto; left: 50%; top: 40%; width: 78px; height: 78px; margin: -39px 0 0 -39px;
  border: 3px solid #9aa3ac; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #ffffff, #dfe4e8 60%, #b9c0c7);
  box-shadow: 0 3px 0 #7d8792, 0 6px 10px rgba(0, 0, 0, .25);
  transition: transform 50ms, box-shadow 50ms, border-color 80ms;
}
body[data-etype="apt"] .open-btn svg { position: absolute; left: 50%; top: 40%; width: 40px; margin: -10px 0 0 -20px; fill: #2a3038; transition: transform 50ms; }
body[data-etype="apt"] .open-btn.live::before { border-color: #9ad8b0; }
body[data-etype="apt"] .open-btn.down { transform: none; }
body[data-etype="apt"] .open-btn.down::before { transform: translateY(3px); border-color: var(--accent); box-shadow: 0 0 0 #7d8792, 0 0 16px rgba(43, 212, 106, .8), inset 0 2px 6px rgba(0, 0, 0, .2); }
body[data-etype="apt"] .open-btn.down svg { transform: translateY(3px); fill: #138a43; }

/* 초고층: 검은 유리 터치 버튼 */
body[data-etype="tower"] .open-btn {
  background: radial-gradient(circle at 50% 22%, #3a4660, #121826 60%, #070a12);
  box-shadow: 0 0 0 6px #0f1115, 0 0 0 7px #2c313a, 0 3px 0 6px #0f1115, 0 3px 0 7px #2c313a, 0 16px 30px rgba(0, 0, 0, .6);
}
body[data-etype="tower"] .open-btn::before { border-color: rgba(143, 211, 255, .45); box-shadow: 0 0 12px rgba(143, 211, 255, .35); }
body[data-etype="tower"] .open-btn::after { content: ""; position: absolute; left: 22%; top: 9%; width: 56%; height: 30%; border-radius: 50%; background: linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0)); }
body[data-etype="tower"] .open-btn svg { fill: #cfe8ff; filter: drop-shadow(0 0 6px rgba(143, 211, 255, .8)); }
body[data-etype="tower"] .open-btn.down { transform: translateY(3px) scale(.97); }
body[data-etype="tower"] .open-btn.down::before { border-color: #8fd3ff; box-shadow: 0 0 26px rgba(143, 211, 255, .9), inset 0 0 14px rgba(143, 211, 255, .6); }
body[data-etype="tower"] .open-btn.down svg { fill: #fff; }
/* 갤럭시: 레트로 우주선 조종판. 경고 띠 + 리벳 + 주황 젤리 돔, 위에 깜빡이는 LED */
body[data-etype="neo"] .open-btn {
  width: 140px; height: 150px; border-radius: 14px;
  background:
    radial-gradient(circle, #8a8fa8 2.5px, #2a2836 3px, transparent 3.5px) 10px 10px / calc(100% - 20px) calc(100% - 20px) no-repeat,
    radial-gradient(circle at 10px 10px, #8a8fa8 2.5px, transparent 3.5px),
    repeating-linear-gradient(135deg, #ffd23f 0 8px, #15121c 8px 16px);
  box-shadow: inset 0 0 0 9px transparent, 0 0 0 1px #05030a, 0 5px 0 #05030a, 0 14px 26px rgba(0, 0, 0, .6);
}
body[data-etype="neo"] .open-btn::before { /* 안쪽 금속 판 */
  inset: 9px; border-radius: 9px; border: 0;
  background: radial-gradient(circle at 50% 0%, #3a3550, #1a1726 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), inset 0 -2px 6px rgba(0, 0, 0, .6);
}
body[data-etype="neo"] .open-btn .lever { display: block; position: absolute; inset: 0; }
body[data-etype="neo"] .open-btn .lever i, body[data-etype="neo"] .open-btn .lever em { display: none; }
body[data-etype="neo"] .open-btn .lever::before { /* 깜빡이는 LED 세 개 */
  content: ""; position: absolute; left: 50%; top: 22px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: #1ae5d0; box-shadow: -18px 0 0 #ff4fa3, 18px 0 0 #ffd23f, 0 0 8px #1ae5d0;
  animation: blink 1.3s steps(2) infinite;
}
@keyframes blink { 50% { background: #0a4a44; box-shadow: -18px 0 0 #5a1a3a, 18px 0 0 #5a4a10; } }
body[data-etype="neo"] .open-btn .lever::after { /* 주황 젤리 돔 + 크롬 테 */
  content: ""; position: absolute; left: 50%; top: 58%; width: 74px; height: 74px; margin: -37px 0 0 -37px; border-radius: 50%;
  background: radial-gradient(circle at 40% 28%, #ffd0a0 0 8%, #ff8a2a 30%, #d4500a 70%, #8a2a00);
  box-shadow: 0 0 0 5px #c9ccd8, 0 0 0 6px #4a4a5a, 0 5px 0 5px #6a6a7a, 0 6px 0 6px #2a2a36, 0 10px 18px rgba(0, 0, 0, .55), inset 0 -6px 10px rgba(0, 0, 0, .3);
  transition: transform 50ms, box-shadow 60ms, background 60ms;
}
body[data-etype="neo"] .open-btn svg { position: absolute; left: 50%; top: 58%; width: 36px; margin: -9px 0 0 -18px; fill: #3a1200; z-index: 1; opacity: .85; transition: transform 50ms; }
body[data-etype="neo"] .open-btn.down { transform: none; }
body[data-etype="neo"] .open-btn.down .lever::after {
  transform: translateY(5px);
  background: radial-gradient(circle at 40% 28%, #d8fffa 0 8%, #4af0e0 30%, #12a89a 70%, #064a44);
  box-shadow: 0 0 0 5px #c9ccd8, 0 0 0 6px #4a4a5a, 0 0 0 5px #6a6a7a, 0 0 0 6px #2a2a36, 0 0 26px rgba(26, 229, 208, .9), inset 0 -6px 10px rgba(0, 0, 0, .3);
}
body[data-etype="neo"] .open-btn.down svg { transform: translateY(5px); fill: #04302a; }
/* 런던 1920: 놋쇠 판에 긴 흑단 레버. 누르면 아래로 철컥 */
body[data-etype="old"] .open-btn {
  width: 132px; height: 190px; border-radius: 16px; perspective: 420px;
  background: linear-gradient(160deg, #f0d48a, #c9a248 40%, #8a6a24 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), inset 0 -3px 0 rgba(0, 0, 0, .3), 0 0 0 2px #3a2810, 0 8px 0 #3a2810, 0 16px 26px rgba(0, 0, 0, .55);
}
body[data-etype="old"] .open-btn::before { inset: 10px; border-radius: 10px; border: 2px solid rgba(58, 40, 16, .45); box-shadow: inset 0 0 0 4px rgba(255, 235, 180, .25); }
body[data-etype="old"] .open-btn svg { display: none; }
body[data-etype="old"] .open-btn .lever { display: block; position: absolute; inset: 0; transform-style: preserve-3d; }
body[data-etype="old"] .lever .slot { position: absolute; left: 50%; top: 22%; width: 16px; height: 56%; margin-left: -8px; border-radius: 8px; background: #2a1c0a; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .8); }
body[data-etype="old"] .lever .hub { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff2c4, #c9a248 50%, #6a4e16); box-shadow: 0 3px 4px rgba(0, 0, 0, .5); }
body[data-etype="old"] .lever .arm {
  position: absolute; left: 50%; bottom: 50%; width: 13px; height: 82px; margin-left: -6.5px; border-radius: 6px;
  background: linear-gradient(90deg, #120a06, #3a2a20 45%, #0a0604);
  transform-origin: 50% 100%; transform: rotateX(14deg); transition: transform 70ms cubic-bezier(.3, 1.6, .5, 1);
  box-shadow: 4px 6px 8px rgba(0, 0, 0, .35);
}
body[data-etype="old"] .lever .arm b { position: absolute; left: 50%; top: -14px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #6a5a50, #120a06 60%); box-shadow: 0 4px 6px rgba(0, 0, 0, .5); }
body[data-etype="old"] .open-btn.down { transform: none; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), inset 0 -3px 0 rgba(0, 0, 0, .3), 0 0 0 2px #3a2810, 0 8px 0 #3a2810, 0 16px 26px rgba(0, 0, 0, .55); }
body[data-etype="old"] .open-btn.down::before { border-color: rgba(58, 40, 16, .45); box-shadow: inset 0 0 0 4px rgba(255, 235, 180, .25); }
body[data-etype="old"] .open-btn.down .arm { transform: rotateX(166deg); }
body[data-etype="old"] .lever em { position: absolute; left: 0; right: 0; text-align: center; font-family: var(--f-num); font-style: normal; font-size: 10px; letter-spacing: .12em; color: #3a2810; opacity: .75; }
body[data-etype="old"] .lever .up { top: 9%; } body[data-etype="old"] .lever .dn { bottom: 9%; }
body[data-etype="old"] .open-btn.live .lever .dn { color: #7a1a0a; opacity: 1; }

/* 결과 */
.rs-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 16px 0; font-size: 12px; color: var(--mute); }
.rs-score { padding: 6px 16px 4px; }
.rs-score b { display: block; font-family: var(--f-num); font-weight: 400; font-size: 120px; line-height: .95; letter-spacing: -0.05em; color: var(--accent); text-shadow: 0 0 24px rgba(43, 212, 106, .35); }
.rs-score span { font-family: var(--f-disp); font-size: 32px; }
.rs-sub { margin: 0; padding: 4px 16px 14px; font-size: 12.5px; color: var(--mute); }
.rs-card { padding: 0 16px 14px; }
.rs-card img { display: block; width: 100%; max-width: 220px; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); }
.rs-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.rs-btns button, .plain {
  height: 48px; border-radius: 12px; border: 1px solid var(--line); font-family: var(--f-disp); font-size: 16px; transition: background .12s, border-color .12s;
}
.rs-btns button:hover, .plain:hover { background: #181b21; border-color: #3a404b; }
.rs-end { margin-top: auto; padding: 16px; display: grid; gap: 12px; }
.plain { font-family: var(--f-ui); font-size: 14px; color: var(--mute); border-color: transparent; }

.foot {
  display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line);
  padding: 0 20px env(safe-area-inset-bottom); font-family: var(--f-mono); font-size: 11px;
}
.foot a { color: var(--mute); text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot .fan { margin-left: auto; font-family: var(--f-ui); font-size: 11px; color: #5d636d; }

.toast { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; }


/* ── 입체 버튼 ─────────────────────────────────────── */
:root {
  --b3d-face: linear-gradient(180deg, #3b424e 0%, #2a2f38 48%, #22262d 100%);
  --b3d-edge: #0b0d10;
  --b3d-lift: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(0, 0, 0, .28), 0 5px 0 var(--b3d-edge), 0 10px 16px rgba(0, 0, 0, .45);
  --b3d-down: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 2px 6px rgba(0, 0, 0, .45), 0 1px 0 var(--b3d-edge), 0 3px 6px rgba(0, 0, 0, .4);
}
.type, .practice, .rs-btns button, .plain, .rank-btn, .rank-tabs button, .char {
  background: var(--b3d-face); border: 1px solid #0b0d10; box-shadow: var(--b3d-lift);
  transition: transform .06s ease-out, box-shadow .06s ease-out, filter .12s;
}
.type:hover, .practice:hover, .rs-btns button:hover, .plain:hover, .rank-btn:hover, .rank-tabs button:hover { background: var(--b3d-face); filter: brightness(1.12); border-color: #0b0d10; }
.type:active, .practice:active, .rs-btns button:active, .plain:active, .rank-btn:active, .rank-tabs button:active, .char:active { transform: translateY(4px); box-shadow: var(--b3d-down); }
/* 고른 것: 초록 LED 가 켜진 판 */
.type.sel, .char.sel, .rank-tabs button.sel {
  background: linear-gradient(180deg, #2f4a3a 0%, #1f3329 50%, #19291f 100%);
  box-shadow: inset 0 1px 0 rgba(160, 255, 190, .25), inset 0 0 0 1.5px var(--accent), 0 5px 0 #06150c, 0 10px 18px rgba(43, 212, 106, .18);
}
.type .no { width: 9px; height: 9px; border-radius: 50%; font-size: 0; background: #11151a; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8); }
.type.sel .no { background: var(--accent); box-shadow: 0 0 8px var(--accent), 0 0 2px #fff inset; }
.char { padding: 0; background: radial-gradient(circle at 50% 35%, #fefefe, #dfe4ea); transition: transform .15s cubic-bezier(.2, 1.6, .4, 1), box-shadow .06s; }
.char img { border-radius: 50%; }
.char:hover { transform: translateY(-2px) rotate(-6deg) scale(1.05); }
.char.sel { background: radial-gradient(circle at 50% 35%, #f4fff7, #bdf2cf); transform: rotate(-4deg); }
.plain { color: var(--mute); }
/* 출발: 초록 젤리 버튼 */
.go {
  background: linear-gradient(180deg, #6bf59c 0%, #2bd46a 45%, #1fb859 100%); color: #052611;
  border: 1px solid #0d5a2a;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(0, 0, 0, .18), 0 6px 0 #127a38, 0 12px 20px rgba(43, 212, 106, .28);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .06s ease-out, box-shadow .06s ease-out, filter .12s;
}
.go:hover { filter: brightness(1.05); }
.go:active { transform: translateY(5px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 2px 8px rgba(0, 0, 0, .25), 0 1px 0 #127a38, 0 4px 8px rgba(43, 212, 106, .2); }

/* 랭킹 */
.rank-btn { display: flex; align-items: center; gap: 6px; margin: 10px 8px; padding: 0 12px; border-radius: 10px; font-size: 13px; color: var(--text); }
.menu-btn { margin-left: 12px; }
.menu-types { padding: 0; }
.rank-btn svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rank { position: fixed; inset: 0; z-index: 20; background: rgba(5, 6, 8, .66); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.rank-card { width: min(420px, 100%); max-height: 86svh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: slide .2s ease-out; }
.rank-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.rank-head b { font-family: var(--f-disp); font-weight: 400; font-size: 26px; }
.rank-x { width: 36px; height: 36px; border-radius: 10px; color: var(--mute); display: flex; align-items: center; justify-content: center; }
.rank-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rank-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.rank-tabs button { height: 42px; border-radius: 10px; font-family: var(--f-disp); font-size: 15px; }
.rank-meta { margin: 0 0 10px; font-size: 12.5px; color: var(--mute); }
.rank-meta b { color: var(--accent); }
.rank-meta small { font-size: 11px; color: #5d636d; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; padding: 10px 14px; border-radius: 12px; background: #1a1d23; }
.rank-list li:nth-child(-n+3) .rk { color: var(--accent); }
.rank-list .rk { font-family: var(--f-num); font-size: 16px; color: var(--mute); }
.rank-list b { font-family: var(--f-num); font-weight: 400; font-size: 24px; }
.rank-list b small { font-family: var(--f-disp); font-size: 14px; margin-left: 3px; color: var(--mute); }
.rank-list .dt { font-family: var(--f-mono); font-size: 11px; color: var(--mute); }
.rank-list li.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.rank-list li.empty { display: block; text-align: center; color: var(--mute); font-size: 13px; padding: 26px 10px; }

/* 폰: 위에 장면, 아래에 판 */
@media (max-width: 860px) {
  :root { --head: 56px; }
  .top-target b { font-size: 36px; }
  .top-target span { font-size: 16px; }
  .app { grid-template-rows: var(--head) auto auto; height: auto; min-height: 100svh; }
  .logo b { font-size: 20px; }
  .best-top { display: none; }
  .rank-btn span { display: none; }
  .rank-btn { padding: 0 10px; margin: 8px 6px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .stage { border-right: 0; padding: 8px; }
  .stage { padding: 6px; }
  .stage-in { width: 100%; height: 62svh; }
  body[data-state="play"] .stage-in { height: calc(100svh - var(--head) - var(--foot) - 152px); }
  #scene { border-radius: 12px; }
  .hud-msg { font-size: 18px; padding: 10px 14px 11px; right: 10px; bottom: 10px; max-width: calc(100% - 20px); border-radius: 14px; }
  .hud-msg.big { font-size: 21px; }
  .hud-floor { font-size: 38px; min-width: 70px; right: 8px; top: 8px; }
  .panel { overflow: visible; }
  .p { min-height: 0; }
  .types { padding: 10px 10px 0; gap: 8px; }
  .sel-top { padding: 10px 10px 0; }
  .char { width: 100%; height: auto; }
  .sel-top { flex-direction: row; flex-wrap: wrap; }
  .practice { flex: 1 1 100%; }
  .chars { flex: 1 1 100%; gap: 10px; }
  .pl-tol { display: none; }
  .type { padding: 11px 12px 11px 10px; }
  .type .nm { font-size: 17px; }
  .go-wrap { position: sticky; bottom: 0; background: var(--panel); z-index: 2; padding: 8px 10px 12px; }
  .go { height: 60px; font-size: 24px; }
  /* 운행 중엔 숫자 | 버튼 한 줄 */
  #pPlay { flex-direction: row; align-items: stretch; padding: 10px; gap: 10px; }
  .pl-target { flex: 1; padding: 0; display: flex; flex-direction: column; }
  .pl-top { margin-bottom: 6px; }
  .led { flex: 1; height: auto; min-height: 104px; }
  .led svg { height: 64px; }
  .plate { flex: 0 0 auto; margin: 0; padding: 12px 16px 18px; }
  .open-btn { width: 96px; height: 96px; }
  body[data-etype="old"] .open-btn { width: 96px; height: 130px; }
  body[data-etype="apt"] .open-btn { width: 96px; height: 118px; }
  body[data-etype="neo"] .open-btn { width: 104px; height: 112px; }
  body[data-etype="neo"] .open-btn .lever::after { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  body[data-etype="neo"] .open-btn svg { width: 26px; margin: -6.5px 0 0 -13px; }
  body[data-etype="neo"] .open-btn .lever::before { top: 16px; }
  body[data-etype="apt"] .open-btn::before { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  body[data-etype="apt"] .open-btn svg { width: 32px; margin: -8px 0 0 -16px; }
  body[data-etype="old"] .lever .arm { height: 50px; }
  .open-btn svg { width: 42px; }
  .plate-key { display: none; }
  .rs-score b { font-size: 88px; }
  .rs-score span { font-size: 26px; }
  .rs-card { display: flex; justify-content: center; }
  .rs-card img { max-width: 180px; }
  .foot { min-height: var(--foot); }
  .foot { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .foot .fan { margin-left: 0; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
