* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #bcd4ea; font-family: "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; color: #3a2a22; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hide { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; }

#start { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(#c9dcef, #f6e3d3); z-index: 20; }
.start-card { width: 100%; max-width: 380px; background: #fffaf2; border-radius: 28px; padding: 26px 22px 18px; box-shadow: 0 18px 50px rgba(80, 50, 30, 0.18); text-align: center; }
.start-card h1 { margin: 4px 0 6px; font-size: 28px; letter-spacing: -0.5px; }
.start-card p { margin: 0 0 16px; color: #6d5a4f; font-size: 15px; line-height: 1.5; }
.start-card .fine { font-size: 12px; color: #a08c80; margin: 12px 0 0; }
#station-input { width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 16px; border: 2px solid #f0d9c2; background: #fff; outline: none; color: #3a2a22; }
#station-input:focus { border-color: #e8836c; }
#suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 300px; overflow: auto; }
.sug { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; background: #fff1e3; color: #3a2a22; text-align: left; }
.sug b { font-size: 16px; } .sug span { font-size: 12px; color: #9a8174; }
.sug.soon { background: #f4f1ee; color: #a59a93; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 25; background: rgba(240, 232, 222, 0.6); color: #6d5a4f; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 5px solid #f3d6bd; border-top-color: #e8836c; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#hud { position: fixed; top: 0; left: 0; right: 0; display: none; align-items: center; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 12px 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
body.playing #hud, body.preview #hud, body.ended #hud { display: flex; }
.hud-mid { display: flex; flex-direction: column; align-items: center; background: rgba(255, 250, 242, 0.92); border-radius: 16px; padding: 6px 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
#where { font-weight: 700; font-size: 14px; } #clock { font-size: 12px; color: #8a7467; }
body.preview #clock { display: none; }
.hud-sold { background: #e8584a; color: #fff; font-weight: 800; border-radius: 16px; padding: 9px 14px; font-size: 17px; box-shadow: 0 4px 14px rgba(200, 60, 40, 0.3); min-width: 74px; text-align: center; }
body.preview .hud-sold { visibility: hidden; }

.chip { padding: 9px 14px; border-radius: 999px; background: #fff1e3; color: #6b4a3a; font-weight: 700; font-size: 14px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); }
.chip.ghost { background: rgba(255, 250, 242, 0.85); color: #8a7467; font-weight: 600; }
.big { width: 100%; padding: 15px; border-radius: 18px; background: #e8584a; color: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 6px 18px rgba(200, 60, 40, 0.3); }
.big.alt { background: #3a2a22; box-shadow: none; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }

#introcard { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 34px); max-width: 420px; margin: 0 auto; background: rgba(255, 250, 242, 0.95); border-radius: 24px; padding: 16px 16px 14px; z-index: 12; text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); animation: up 0.5s 2.6s both; }
#introcard h2 { margin: 0 0 4px; font-size: 22px; } #introcard p { margin: 0; font-size: 13px; color: #8a7467; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

#panel { position: fixed; left: 0; right: 0; bottom: 0; display: none; flex-direction: column; gap: 8px; padding: 10px 10px calc(env(safe-area-inset-bottom) + 22px); background: linear-gradient(rgba(60, 40, 30, 0), rgba(60, 40, 30, 0.35) 18%, rgba(48, 32, 24, 0.85)); z-index: 11; max-width: 560px; margin: 0 auto; }
body.playing #panel { display: flex; }
#orders { display: flex; gap: 6px; min-height: 64px; }
.order { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 8px 8px 12px; border-radius: 16px; background: #fffaf2; color: #3a2a22; text-align: left; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); animation: pop 0.3s both; }
.order small { display: block; font-size: 11px; color: #9a8174; } .order b { font-size: 15px; white-space: nowrap; }
.order i { position: absolute; left: 0; bottom: 0; height: 5px; background: #6cc070; transition: width 0.4s linear; }
.order:active { transform: scale(0.96); }
.order.shake { animation: shake 0.35s; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.empty-orders { flex: 1; display: flex; align-items: center; justify-content: center; color: #fff6e6; font-size: 13px; opacity: 0.85; }
.panel-row { display: flex; gap: 8px; align-items: center; }
.fills { display: flex; background: rgba(255, 250, 242, 0.18); border-radius: 999px; padding: 3px; flex: none; }
.fills button { padding: 8px 13px; border-radius: 999px; background: transparent; color: #fff6e6; font-weight: 700; font-size: 14px; }
.fills button.on { background: #fffaf2; color: #3a2a22; }
.fills button[data-fill="팥"].on { box-shadow: inset 0 -3px 0 #5a2a2e; } .fills button[data-fill="슈크림"].on { box-shadow: inset 0 -3px 0 #f2c230; }
#tray { flex: 1; display: flex; flex-wrap: nowrap; overflow: hidden; gap: 0; align-items: center; min-height: 40px; background: rgba(255, 250, 242, 0.12); border-radius: 14px; padding: 0 4px; }
.trayfish { width: 36px; height: 23px; margin-right: -6px; flex: none; }
.tray-empty { font-size: 11px; color: rgba(255, 246, 230, 0.7); padding-left: 6px; }
#molds { width: 100%; height: 168px; display: block; touch-action: manipulation; }

#float { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.bubble { position: absolute; left: 0; top: 0; background: #fffaf2; padding: 6px 10px; border-radius: 14px; font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fffaf2; border-bottom: 0; }
.bubble.happy { background: #fff0c9; } .bubble.sad { background: #e9e6f2; color: #6a6280; }
.plus { position: absolute; left: 0; top: 0; color: #fff; font-weight: 900; font-size: 20px; text-shadow: 0 2px 0 #c0392b, 0 0 12px rgba(255, 160, 60, 0.9); }

#result { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(40, 28, 22, 0.45); z-index: 30; }
.result-card { width: 100%; max-width: 400px; background: #fffaf2; border-radius: 26px; padding: 16px; text-align: center; animation: pop 0.4s both; }
.result-card h2 { margin: 4px 0 10px; font-size: 18px; }
#card-img { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
.result-card .row .big { flex: 1; }

#info { position: fixed; left: 12px; right: 12px; top: 70px; max-width: 420px; margin: 0 auto; background: #fffaf2; border-radius: 18px; padding: 12px 16px; font-size: 13px; line-height: 1.55; color: #5d4a40; z-index: 40; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
#info p { margin: 6px 0; } #info a { color: #c0392b; }
#toast { position: fixed; left: 50%; top: 84px; transform: translate(-50%, -20px); background: #3a2a22; color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; opacity: 0; transition: 0.25s; z-index: 50; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#osm { position: fixed; right: 6px; bottom: calc(env(safe-area-inset-bottom) + 3px); font-size: 10px; color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); z-index: 35; text-decoration: none; }
#start ~ #osm { color: #8a7467; }

#pins { position: fixed; inset: 0; pointer-events: none; z-index: 11; display: none; }
body.picking #pins { display: block; }
#pin-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; left: 0; top: 0; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 20px; background: #2f9a63; color: #fff; font-weight: 900; font-size: 18px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.15); border: 3px solid #fff; pointer-events: auto; transform: translate(-50%, -50%); }
.pin.letter { background: #7d8d99; }
.pin:active { transform: translate(-50%, -50%) scale(0.92); }
#exitpick { position: fixed; left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 22px); max-width: 440px; margin: 0 auto; background: rgba(255, 250, 242, 0.96); border-radius: 24px; padding: 14px 14px 10px; z-index: 12; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); animation: up 0.4s 1.2s both; }
#exitpick h2 { margin: 0 0 2px; font-size: 20px; text-align: center; }
#ep-note { margin: 0 0 10px; font-size: 12.5px; color: #8a7467; text-align: center; line-height: 1.45; }
#ep-note.warn { color: #a5512f; }
#ep-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 26vh; overflow: auto; }
.ep { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 14px; background: #fff1e3; color: #3a2a22; text-align: left; min-width: 0; }
.ep b { flex: none; min-width: 30px; height: 30px; border-radius: 15px; background: #2f9a63; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; padding: 0 6px; }
.ep.letter b { background: #7d8d99; }
.ep span { font-size: 12px; color: #7a6458; line-height: 1.3; overflow: hidden; }
.ep span em { font-style: normal; color: #c0392b; font-weight: 700; }
.ep.wide { grid-column: span 2; }

.ep small { font-size: 11px; color: #9a8174; }
.ep.dim { opacity: 0.45; }
#ep-clusters { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: -4px 0 8px; }
#ep-clusters button { width: 38px; height: 34px; border-radius: 12px; background: #3a2a22; color: #fff; font-size: 22px; font-weight: 800; line-height: 1; }
#ep-cname { flex: 1; text-align: center; font-weight: 800; font-size: 14px; color: #3a2a22; }
#intro-mix { margin-top: 4px !important; color: #c0392b !important; font-weight: 700; }
.hud-right { display: flex; gap: 6px; align-items: center; }
.mute { width: 40px; height: 40px; border-radius: 14px; background: rgba(255, 250, 242, 0.92); color: #6b4a3a; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.mute .cross { display: none; } .mute.off .cross { display: inline; } .mute.off .wave { display: none; } .mute.off { color: #b9a79c; }
#guide { display: none; text-align: center; font-size: 14px; font-weight: 800; color: #3a2a22; background: #ffe7a3; border-radius: 12px; padding: 7px 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2); }
#guide.show { display: block; animation: pop 0.25s both; }
#tray { position: relative; }
#tray.full { box-shadow: inset 0 0 0 2px #ffb347; }
.tray-full { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: #ff8a3d; color: #fff; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 9px; }
.plus.heart { color: #fff; text-shadow: 0 2px 0 #e0577a, 0 0 12px rgba(255, 120, 160, 0.9); font-size: 18px; }
.plus.tip { color: #fff; text-shadow: 0 2px 0 #2f9a63, 0 0 12px rgba(120, 220, 150, 0.9); font-size: 17px; }

#chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
#chips:empty { display: none; }
.chips-label { width: 100%; font-size: 12px; color: #a08c80; }
#chips .chip { font-size: 13px; padding: 7px 12px; }
.nohit { font-size: 13px; color: #a08c80; margin: 8px 0 0; }
.shared-label { margin: 4px 0 2px !important; font-size: 14px !important; color: #a08c80 !important; }
.shared-where { margin: 0 0 18px !important; font-size: 24px !important; font-weight: 900; color: #3a2a22 !important; }
#shared .big { margin-top: 8px; }

/* pinch-zoom works on the page; the 3D map keeps its own drag/pinch, buttons skip double-tap zoom */
#scene { touch-action: none; }
#info { padding-right: 44px; }
#info-close { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 12px; background: #f3e6d6; color: #6b4a3a; font-size: 22px; font-weight: 700; line-height: 1; }
.ep.hide { display: none; }
.shared-region { margin: -12px 0 16px !important; font-size: 14px !important; color: #8a7467 !important; }
.shared-region:empty { display: none; }
