:root { --safe-top: 8px; }
html, body { margin: 0; height: 100%; background: #111418; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; font-family: system-ui, sans-serif; }
#game { display: block; width: 100vw; height: 100vh; height: 100dvh; }
#hud { position: fixed; top: calc(max(8px, env(safe-area-inset-top)) + 56px); left: 12px; display: flex; gap: 12px; color: #fff; font-size: 13px; text-shadow: 0 1px 2px #000; pointer-events: none; }
#stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3); display: none; pointer-events: none; }
#knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.5); }
#reset { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 10px; width: 36px; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.45); color: #fff; font-size: 18px; }
#levelup { position: fixed; inset: 0; display: none; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 16px; background: rgba(0,0,0,.72); color: #fff; z-index: 10; }
#levelup h2 { margin: 0; font-size: 22px; color: #ffd24a; text-align: center; }
#cards { display: flex; flex-direction: column; gap: 12px; width: min(100%, 360px); }
.card { display: flex; align-items: center; gap: 14px; padding: 14px; text-align: left; font: 15px system-ui, sans-serif; color: #fff; background: #232a33; border: 2px solid #4a5666; border-radius: 12px; touch-action: manipulation; }
.card:active { background: #34404e; border-color: #ffd24a; }
.card .ic { font-size: 30px; }
.card i { color: #ffd24a; font-style: normal; font-size: 12px; }
#bag-btn { position: fixed; right: 10px; bottom: max(14px, env(safe-area-inset-bottom)); height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.55); color: #fff; font-size: 16px; z-index: 5; touch-action: manipulation; }
#inventory { position: fixed; inset: 0; display: none; justify-content: center; align-items: flex-start; background: rgba(0,0,0,.78); z-index: 11; overflow-y: auto; }
#inventory .panel { width: min(100%, 400px); box-sizing: border-box; padding: 14px; color: #fff; font: 14px system-ui, sans-serif; }
#inventory .row { display: flex; justify-content: space-between; align-items: center; }
#inventory h2 { margin: 0; font-size: 20px; color: #ffd24a; }
#inv-close { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #4a5666; background: #232a33; color: #fff; font-size: 18px; }
#inv-stats { margin: 8px 0; font-size: 12px; color: #aab4c0; }
#inv-equipped { display: flex; gap: 10px; margin-bottom: 10px; }
#inv-count { font-size: 12px; color: #aab4c0; margin-bottom: 6px; }
#inv-bag { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tile { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; border: 2px solid #3a4452; background: #1c222a; color: #fff; padding: 0; position: relative; touch-action: manipulation; }
#inv-equipped .tile { width: 64px; }
.tile.sel { box-shadow: 0 0 0 2px #fff; }
.tile .ic { font-size: 24px; }
.tile small { font-size: 10px; color: #aab4c0; }
.tile small.empty { font-size: 22px; opacity: .35; }
#inv-detail { margin-top: 14px; padding: 12px; background: #1c222a; border-radius: 12px; min-height: 60px; }
#inv-detail h3 { margin: 0 0 2px; font-size: 17px; }
#inv-detail .sub { color: #aab4c0; font-size: 12px; margin-bottom: 8px; }
#inv-detail ul { margin: 0 0 10px; padding-left: 18px; }
#inv-detail .hint { margin: 0; color: #7d8895; }
#inv-detail em { font-style: normal; font-size: 12px; }
em.up { color: #5fd16a; } em.down { color: #ff6b6b; } .lost { color: #ff6b6b; }
.btns { display: flex; gap: 10px; }
.btns button { flex: 1; padding: 12px; border-radius: 10px; border: 0; background: #3b82f6; color: #fff; font-size: 15px; touch-action: manipulation; }
.btns button.danger { background: #7a2e2e; }
#interact { position: fixed; left: 50%; bottom: max(70px, calc(env(safe-area-inset-bottom) + 56px)); transform: translateX(-50%); display: none; padding: 12px 22px; border-radius: 26px; border: 2px solid #ffd24a; background: rgba(20,24,30,.9); color: #fff; font-size: 17px; z-index: 6; touch-action: manipulation; }
#dialog { position: fixed; inset: 0; display: none; justify-content: center; align-items: flex-start; background: rgba(0,0,0,.78); z-index: 12; overflow-y: auto; }
#dialog .panel { width: min(100%, 400px); box-sizing: border-box; padding: 14px; color: #fff; font: 14px system-ui, sans-serif; }
#dialog .row { display: flex; justify-content: space-between; align-items: center; }
#dialog h2 { margin: 0; font-size: 20px; color: #ffd24a; }
#dlg-close { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #4a5666; background: #232a33; color: #fff; font-size: 18px; }
#dlg-body h4 { margin: 16px 0 6px; color: #aab4c0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
#dlg-body .gold { margin-top: 8px; color: #ffd24a; font-weight: bold; }
#dlg-body .line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 8px; background: #1c222a; border-radius: 10px; }
#dlg-body .line small { color: #aab4c0; }
#dlg-body .line button { min-width: 64px; padding: 10px 12px; border: 0; border-radius: 8px; background: #3b82f6; color: #fff; font-size: 14px; touch-action: manipulation; }
#dlg-body .line button.go { background: #2f9e55; }
#dlg-body .line button:disabled { background: #333b46; color: #7d8895; }
