/* 시안 2: 코인게임방 (네온 오락실) */
:root {
  --bg: #14062e;
  --card: #1f0d47;
  --text: #f4eaff;
  --line: #7a3cff;
  --orange: #ff2d95;
  --yellow: #ffe600;
  --peach: #00e5ff;
  --wheel-colors: #ff2d95,#00e5ff,#ffe600,#7c4dff,#39ff14,#ff6d00;
  --wheel-line: #14062e;
  --wheel-text: #14062e;
  --wheel-hub: #14062e;
  --wheel-hub-line: #00e5ff;
  --ladder-line: #5b3bb3;
}

body {
  font-family: "Courier New", "Malgun Gothic", monospace;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(122, 60, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 60, 255, 0.18) 1px, transparent 1px);
  background-size: 32px 32px;
}

.title {
  color: #fff; letter-spacing: 4px;
  text-shadow: 0 0 6px #ff2d95, 0 0 16px #ff2d95, 0 0 32px #ff2d95, 3px 3px 0 #00e5ff;
  animation: flicker 3s infinite;
}
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 94% { opacity: 0.55; } 96% { opacity: 1; } 98% { opacity: 0.7; } }
.subtitle { color: #00e5ff; text-shadow: 0 0 8px #00e5ff; letter-spacing: 1px; }

.menu-btn {
  background: #1a0a3d; border: 3px solid; border-radius: 12px; box-shadow: none;
}
.menu-btn:active { transform: scale(0.97); box-shadow: none; }
.menu-name { letter-spacing: 2px; }
.c1 { border-color: #ff2d95; color: #ff2d95; box-shadow: 0 0 14px #ff2d95, inset 0 0 14px rgba(255,45,149,0.35); }
.c2 { border-color: #00e5ff; color: #00e5ff; box-shadow: 0 0 14px #00e5ff, inset 0 0 14px rgba(0,229,255,0.35); }
.c3 { border-color: #ffe600; color: #ffe600; box-shadow: 0 0 14px #ffe600, inset 0 0 14px rgba(255,230,0,0.3); }

.bar h2 { color: #ffe600; text-shadow: 0 0 10px #ffe600; }
.back {
  background: transparent; color: #00e5ff; border: 2px solid #00e5ff; border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,229,255,0.6);
}

.card {
  background: var(--card); border: 3px solid #7a3cff; border-radius: 14px;
  box-shadow: 0 0 16px rgba(122,60,255,0.7);
}
.card h3 { color: #ffe600; }

.big-btn {
  background: #ff2d95; color: #fff; border: 3px solid #fff; border-radius: 12px;
  box-shadow: 0 0 18px #ff2d95; letter-spacing: 2px;
}
.big-btn:active { transform: scale(0.97); box-shadow: 0 0 6px #ff2d95; }
.big-btn.alt { background: #00bcd4; box-shadow: 0 0 18px #00e5ff; color: #08142e; border-color: #08142e; }
.big-btn.alt:active { box-shadow: 0 0 6px #00e5ff; }

.result {
  background: #0d0424; color: #ffe600; border: 2px dashed #00e5ff; border-radius: 10px;
  text-shadow: 0 0 8px #ffe600;
}

.pointer { border-top-color: #ffe600; filter: drop-shadow(0 0 8px #ffe600); }

.edit-row input {
  background: #0d0424; color: #fff; border: 2px solid #7a3cff; border-radius: 10px;
}
.edit-row input:focus { border-color: #00e5ff; box-shadow: 0 0 8px #00e5ff; }
.del-btn { background: #ff2d95; border-radius: 10px; }
.add-btn { border-color: #00e5ff; color: #00e5ff; border-radius: 10px; }

.stepper button { background: #ff2d95; border-radius: 10px; box-shadow: 0 0 12px #ff2d95; }
.stepper button:active { box-shadow: 0 0 4px #ff2d95; }
.stepper b { color: #ffe600; text-shadow: 0 0 8px #ffe600; }

.ladder-row.top button { color: #14062e; border-radius: 10px; box-shadow: 0 0 10px currentColor; }
.ladder-row.bottom .slot { background: #0d0424; color: #8f7bc9; border: 2px solid #4a2a9a; border-radius: 10px; }
.ladder-row.bottom .slot.win { background: #39ff14; color: #0b2a00; border-color: #39ff14; box-shadow: 0 0 14px #39ff14; }
.ladder-row.bottom .slot.lose { background: #2a0a22; color: #ff2d95; border-color: #ff2d95; }
.cover {
  background: repeating-linear-gradient(0deg, #1a0a3d, #1a0a3d 6px, #240f52 6px, #240f52 12px);
  border: 3px solid #ff2d95; border-radius: 12px; box-shadow: 0 0 16px #ff2d95; color: #ff2d95;
}

.cface { color: #5a3a00; border-color: #c88a00; }
.cface.top { background: radial-gradient(circle at 35% 30%, #fff58a, #ffe600); }
.cface.bottom { background: radial-gradient(circle at 35% 30%, #9af6ff, #00e5ff); color: #003844; border-color: #0097a7; }
.cside { background: #d4a800; }
.cside:nth-child(even) { background: #b88e00; }
.ground { background: #ff2d95; box-shadow: 0 0 14px #ff2d95; }
.shadow { background: rgba(0, 229, 255, 0.35); }

/* ===== 오락기 몸체 ===== */
#home .title { display: none; }

.cabinet {
  max-width: 560px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(90deg, #2a0f5c 0, #1a0838 7%, #1a0838 93%, #2a0f5c 100%);
  border-left: 6px solid #ff2d95; border-right: 6px solid #00e5ff;
  box-shadow: 0 0 30px rgba(122, 60, 255, 0.6);
}

/* 간판 */
.marquee {
  position: relative; margin: 12px 12px 0; padding: 22px 12px;
  border-radius: 16px 16px 4px 4px; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, #ffe600, #ff9f00);
  box-shadow: 0 0 26px rgba(255, 230, 0, 0.8);
}
.marquee span {
  position: relative; z-index: 1; font-size: 2.2rem; font-weight: 900;
  color: #14062e; letter-spacing: 6px; text-shadow: 3px 3px 0 #ff2d95;
}
.marquee::before, .marquee::after {
  content: ""; position: absolute; left: 0; right: 0; height: 12px;
  background-image: radial-gradient(circle, #fff 3px, transparent 4px);
  background-size: 22px 12px; animation: bulbs 0.8s steps(2) infinite;
}
.marquee::before { top: 2px; }
.marquee::after { bottom: 2px; animation-delay: 0.4s; }
@keyframes bulbs { 0% { opacity: 1; } 100% { opacity: 0.25; } }

/* 화면 테두리 + 브라운관 줄무늬 */
.bezel {
  position: relative; flex: 1; margin: 10px 12px;
  border-radius: 20px; background: #0a0320;
  border: 10px solid #0b0b14;
  box-shadow: inset 0 0 40px rgba(0, 229, 255, 0.25), 0 0 0 3px #3a1d7a;
  overflow: hidden;
}
.bezel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 4px);
}
.bezel .app { padding: 16px 12px 24px; }

/* 조작부 */
.control-panel {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 12px; padding: 12px 18px 14px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #3b1a80, #22094f);
  border-top: 4px solid #ff2d95;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
}

/* 조이스틱 */
.joystick { position: relative; width: 72px; height: 72px; flex: none; cursor: pointer; }
.js-base {
  position: absolute; left: 4px; right: 4px; bottom: 4px; height: 24px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #333 0%, #111 70%);
  border: 3px solid #000; box-shadow: 0 3px 0 #000;
}
.js-lever {
  position: absolute; left: 50%; bottom: 16px; width: 10px; height: 40px; margin-left: -5px;
  border-radius: 5px; background: linear-gradient(90deg, #888, #ddd, #777);
  transform-origin: 50% 100%; transition: transform 0.15s ease;
}
.js-ball {
  position: absolute; left: -12px; top: -24px; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8db8, #ff2d95 45%, #a3005a);
  box-shadow: 0 0 12px rgba(255, 45, 149, 0.8);
}
.js-lever.tilt-l { transform: rotate(-22deg); }
.js-lever.tilt-r { transform: rotate(22deg); }

/* 오락기 둥근 버튼 */
.arcade-btns { display: flex; gap: 14px; }
.ab {
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer; position: relative;
  border: 4px solid #000; font-family: inherit; padding: 0;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.ab span {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  margin-top: 4px; font-size: 0.75rem; font-weight: bold; color: #f4eaff; white-space: nowrap;
}
.ab-a { background: radial-gradient(circle at 35% 30%, #ffa3c9, #ff2d95 55%, #a3005a); box-shadow: 0 6px 0 #5a0032; }
.ab-b { background: radial-gradient(circle at 35% 30%, #b3f6ff, #00e5ff 55%, #00838f); box-shadow: 0 6px 0 #00434a; }
.ab:active { transform: translateY(5px); box-shadow: 0 1px 0 #000; }
.control-panel { padding-bottom: 26px; }

/* 동전 구멍 */
.coin-door {
  flex: none; width: 76px; height: 76px; border-radius: 10px;
  background: linear-gradient(180deg, #2b2b2b, #111);
  border: 3px solid #555; box-shadow: inset 0 0 8px #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.coin-slot {
  position: relative; width: 8px; height: 30px; border-radius: 3px; background: #000;
  border: 2px solid #ff6d00; box-shadow: 0 0 10px #ff6d00, inset 0 0 4px #ff6d00;
}
.coin-drop {
  position: absolute; left: 50%; top: -38px; width: 26px; height: 26px; margin-left: -13px;
  border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff58a, #ffc400 60%, #b88e00);
  border: 2px solid #8a6a00;
}
.coin-drop.go { animation: coinIn 0.6s ease-in forwards; }
@keyframes coinIn {
  0% { opacity: 1; top: -46px; transform: scaleX(1); }
  45% { opacity: 1; top: -26px; transform: scaleX(0.25); }
  100% { opacity: 0; top: 6px; transform: scaleX(0.25); }
}
.insert {
  margin: 0; font-size: 0.6rem; font-weight: bold; color: #ff6d00; letter-spacing: 1px;
  text-align: center; line-height: 1.1;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 0% { opacity: 1; } 100% { opacity: 0.15; } }

/* ===== 마우스를 올렸을 때 반응 ===== */
@media (hover: hover) {
  .menu-btn, .big-btn, .back, .stepper button, .ladder-row.top button,
  .del-btn, .add-btn, .ab {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, filter 0.15s ease;
  }
  .menu-btn { position: relative; }
  .menu-btn:hover { transform: translateY(-4px) scale(1.02); }
  .menu-btn:hover::after {
    content: "PRESS START"; position: absolute; right: 14px; bottom: 10px;
    font-size: 0.7rem; letter-spacing: 2px; animation: blink 0.6s steps(2) infinite;
  }
  .c1:hover { background: #ff2d95; color: #14062e; box-shadow: 0 0 30px #ff2d95, 0 0 60px rgba(255,45,149,0.5); }
  .c2:hover { background: #00e5ff; color: #14062e; box-shadow: 0 0 30px #00e5ff, 0 0 60px rgba(0,229,255,0.5); }
  .c3:hover { background: #ffe600; color: #14062e; box-shadow: 0 0 30px #ffe600, 0 0 60px rgba(255,230,0,0.5); }

  .big-btn:not(:disabled):hover {
    transform: translateY(-3px) scale(1.02); filter: brightness(1.15);
    box-shadow: 0 0 28px #ff2d95, 0 0 56px rgba(255, 45, 149, 0.6);
  }
  .big-btn.alt:not(:disabled):hover { box-shadow: 0 0 28px #00e5ff, 0 0 56px rgba(0, 229, 255, 0.6); }

  .back:hover { background: #00e5ff; color: #14062e; box-shadow: 0 0 20px #00e5ff; }
  .stepper button:not(:disabled):hover { transform: scale(1.1); box-shadow: 0 0 22px #ff2d95; }
  .ladder-row.top button:not(:disabled):hover { transform: translateY(-3px); filter: brightness(1.2); box-shadow: 0 0 18px currentColor; }
  .del-btn:hover { filter: brightness(1.2); box-shadow: 0 0 12px #ff2d95; }
  .add-btn:hover { background: rgba(0, 229, 255, 0.12); box-shadow: 0 0 14px #00e5ff; }

  .ab:hover { filter: brightness(1.2); transform: translateY(-2px); }
  .ab-a:hover { box-shadow: 0 8px 0 #5a0032, 0 0 22px #ff2d95; }
  .ab-b:hover { box-shadow: 0 8px 0 #00434a, 0 0 22px #00e5ff; }
  .joystick:hover .js-lever { transform: rotate(-14deg); }
  .coin-door:hover .coin-slot { box-shadow: 0 0 20px #ff6d00, inset 0 0 6px #ff6d00; }
}

/* ===== 스크롤 없이 한 화면에 맞추기 ===== */
html, body { height: 100%; }
body { overflow: hidden; }
.cabinet { height: 100vh; height: 100dvh; min-height: 0; }
.marquee { flex: none; margin-top: 8px; padding: 14px 12px; }
.marquee span { font-size: clamp(1.4rem, 5vh, 2.2rem); }
.bezel { display: flex; min-height: 0; margin: 8px 12px; }
.bezel .app {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  width: 100%; max-width: none; padding: 10px 10px 12px;
}
.screen.active { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.bar { flex: none; margin-bottom: 8px; }
.bar h2 { font-size: 1.3rem; }
.back { padding: 6px 12px; font-size: 0.9rem; }
.card.main {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  margin-bottom: 0; padding: 10px;
}
.big-btn { flex: none; margin-top: 8px; padding: 10px; font-size: 1.15rem; }
.result { flex: none; margin-top: 8px; padding: 8px; min-height: 0; font-size: 1.05rem; }
.btn-pair { display: flex; gap: 8px; flex: none; }
.btn-pair .big-btn { flex: 1; min-width: 0; }

/* 첫 화면 */
#home .subtitle { flex: none; margin: 4px 0 10px; }
#home .menu { flex: 1; min-height: 0; gap: 10px; }
#home .menu-btn { flex: 1; min-height: 0; padding: 8px 12px; }

/* 룰렛: 남는 공간에 맞춰 원판 크기 조절 */
.wheel-wrap {
  flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0;
  container-type: size; display: flex; align-items: center; justify-content: center;
}
.wheel-box { position: relative; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.wheel-box canvas { width: 100%; height: 100%; display: block; }
.pointer { top: -4px; border-left-width: 12px; border-right-width: 12px; border-top-width: 24px; }

/* 항목 편집 팝업 */
.edit-panel {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 3, 32, 0.85); padding: 8px;
}
.edit-panel.hidden { display: none; }
.edit-inner {
  width: 100%; max-height: 100%; display: flex; flex-direction: column;
  background: var(--card); border: 3px solid #00e5ff; border-radius: 14px;
  box-shadow: 0 0 20px #00e5ff; padding: 12px;
}
.edit-inner h3 { margin: 0 0 8px; color: #ffe600; }
.edit-list { flex: 1; min-height: 0; overflow-y: auto; }
.edit-list .edit-row { margin-bottom: 6px; }
.edit-list .edit-row input { padding: 8px 10px; }
.edit-list .del-btn { width: 40px; }
.edit-list .add-btn { padding: 8px; }

/* 사다리 */
.stepper-bar { flex: none; display: flex; justify-content: space-around; gap: 8px; margin-bottom: 8px; }
.stepper-bar .stepper { gap: 8px; font-weight: bold; }
.stepper-bar .stepper button { width: 36px; height: 36px; font-size: 1.3rem; border-radius: 10px; }
.stepper-bar .stepper b { min-width: 20px; font-size: 1.2rem; }
.ladder-row { flex: none; }
.ladder-row.top button { padding: 6px 0; }
.ladder-row.bottom .slot { padding: 6px 2px; font-size: 0.85rem; }
.ladder-box { flex: 1; min-height: 0; }
#ladderCanvas { height: 100%; }
.cover p { font-size: 1rem; }
.cover .big-btn { width: auto; padding: 10px 24px; }

/* 동전: 남는 높이에 맞춰 바닥 기준으로 배치 */
.coin-stage { flex: 1; min-height: 0; height: auto; overflow: hidden; }
.scene { transform-origin: 50% calc(100% - 47px); }
.coin-pos { top: auto; bottom: -23px; }
.ground { top: auto; bottom: 16px; }
.shadow { top: auto; bottom: 16px; }

/* 조작부를 조금 작게 */
.control-panel { position: relative; flex: none; padding: 8px 18px 22px; margin-bottom: 0; }
.joystick { width: 60px; height: 60px; }
.js-lever { height: 32px; bottom: 14px; }
.js-ball { width: 28px; height: 28px; left: -9px; top: -20px; }
.ab { width: 46px; height: 46px; }
.coin-door { width: 64px; height: 60px; }
.coin-slot { height: 24px; }

/* 세로가 짧은 화면 */
@media (max-height: 700px) {
  .marquee { padding: 10px 12px; margin-top: 6px; }
  .marquee::before, .marquee::after { height: 8px; background-size: 18px 8px; }
  .bezel { margin: 6px 10px; border-width: 6px; }
  #home .subtitle { display: none; }
  .menu-name { font-size: 1.4rem; }
  .menu-desc { font-size: 0.85rem; }
  .big-btn { padding: 8px; font-size: 1.05rem; }
}

@media (max-width: 380px) {
  .marquee span { font-size: 1.7rem; letter-spacing: 3px; }
  .control-panel { padding-left: 10px; padding-right: 10px; }
  .arcade-btns { gap: 8px; }
}

/* ===== 백두산 천지 배경 ===== */
body {
  background: #1a2366 url("baekdu.svg") center bottom / cover no-repeat fixed;
}
/* 오락기 옆면은 살짝 비쳐 보이게 */
.cabinet {
  background: linear-gradient(90deg, rgba(42, 15, 92, 0.85) 0, rgba(26, 8, 56, 0.55) 7%, rgba(26, 8, 56, 0.55) 93%, rgba(42, 15, 92, 0.85) 100%);
}
/* 오락기 화면 안에도 천지가 보이도록 */
.bezel {
  background:
    linear-gradient(rgba(10, 3, 32, 0.1), rgba(10, 3, 32, 0.35)),
    url("baekdu.svg") center bottom / cover no-repeat;
}
.card {
  background: rgba(31, 13, 71, 0.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
#home .menu-btn { background: rgba(26, 10, 61, 0.45); }
/* 배경 위에서도 글씨가 잘 보이게 */
#home .menu-name, #home .menu-desc, .bar h2, .result { text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.7); }
