[hidden] { display: none !important; }

:root {
  --bg: #2b2118;
  --panel: #f3e6c8;
  --card: #fff8e6;
  --line: #c9a978;
  --ink: #3b2a1a;
  --muted: #8a6f4d;
  --gold: #ffcf4a;
  --red: #c8423b;
  --green: #4f9a3a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { margin: 0; height: 100%; background: #1a140e; color: var(--ink); overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

.app { max-width: 480px; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }

.ico { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; font-size: 16px; vertical-align: middle; }
.ico img { width: 100%; height: 100%; object-fit: contain; }

/* HUD */
.hud { padding: 8px 12px 6px; background: linear-gradient(#4a3522, #2b2118); color: #fff; }
.hud-main { display: flex; align-items: center; gap: 6px; font-size: 24px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 0 #6b4a00; }
.hud-main .ico { width: 30px; height: 30px; }
.gps { margin-left: auto; font-size: 13px; color: #f3e6c8; font-weight: 600; text-shadow: none; }
.gps b { color: #fff; }
.hud-sub { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 4px; border-radius: 12px; background: rgba(0,0,0,.35); font-size: 12px; }
.chip b { color: var(--gold); }

/* Scene */
.scene { position: relative; flex: 0 0 auto; }
canvas { display: block; width: 100%; aspect-ratio: 420 / 360; touch-action: manipulation; }

/* Tabs */
.tabs { display: flex; background: #4a3522; }
.tabs button { flex: 1; padding: 6px 0 7px; color: #d8c3a0; font-size: 12px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 1px; border-bottom: 3px solid transparent; }
.tabs button .ico { width: 26px; height: 26px; }
.tabs button.on { color: #fff; background: #5d4429; border-bottom-color: var(--gold); }

.panel { flex: 1; overflow-y: auto; background: var(--panel); padding: 8px 10px 20px; }
.buy-mode { display: flex; gap: 6px; margin-bottom: 8px; }
.buy-mode button { flex: 1; padding: 6px 0; border-radius: 10px; background: #e3cfa5; color: var(--muted); font-weight: 800; font-size: 13px; }
.buy-mode button.on { background: var(--ink); color: var(--gold); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.item.locked { opacity: .5; }
.item.done { background: #e8f3d9; border-color: #a9c98a; }
.thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: #ead7b0; display: grid; place-items: center; font-size: 28px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 900; font-size: 15px; }
.item-name small { color: var(--muted); font-weight: 700; margin-left: 3px; font-size: 12px; }
.item-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.item-desc .up { color: var(--green); font-weight: 800; }
.buy { flex-shrink: 0; min-width: 88px; padding: 7px 8px; border-radius: 10px; background: linear-gradient(#ffd96a, #f0aa1e); color: #4a2c00; font-weight: 900; font-size: 13px; line-height: 1.2; box-shadow: 0 3px 0 #a86c00; }
.buy small { display: block; font-size: 11px; font-weight: 800; }
.buy:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #a86c00; }
.buy:disabled { background: #d9c7a3; color: #9b8665; box-shadow: 0 3px 0 #b9a47f; cursor: default; }
.buy.purple { background: linear-gradient(#c9a2ff, #8e5be0); color: #fff; box-shadow: 0 3px 0 #5b3699; }

.rebirth-box { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; line-height: 1.6; margin-bottom: 8px; }
.rebirth-box .big { font-size: 22px; font-weight: 900; color: #7c4bd0; }
.rebirth-box .buy { width: 100%; margin-top: 8px; padding: 11px; font-size: 15px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 10; padding: 16px; }
.modal-card { background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 18px; max-width: 340px; width: 100%; text-align: center; line-height: 1.6; }
.modal-card img.hero { width: 120px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions button { flex: 1; padding: 10px; border-radius: 10px; background: #e3cfa5; font-weight: 800; }
.modal-actions button.primary { background: var(--ink); color: var(--gold); }

.toast { position: fixed; left: 50%; top: 120px; transform: translateX(-50%); background: rgba(43,33,24,.95); color: #fff; border: 2px solid var(--line); padding: 8px 14px; border-radius: 12px; font-weight: 800; z-index: 11; max-width: calc(100% - 32px); text-align: center; }
