/* =========================================================
   KIMCHI HERO — styles
   Pixel UI over a full-screen canvas. Red / cream / navy palette
   with a small kimchi-green accent.
   ========================================================= */
:root {
  --ink: #17142a; --ink2: #221e3d; --ink3: #2d2852; --line: #0b0a14;
  --cream: #f6e9cc; --cream2: #e8d6ae; --red: #d23c45; --red2: #8e1f2b; --navy: #22305a;
  --green: #46b04f; --gold: #f2b541; --text: #fff7e8; --muted: #c8bfd8; --sol: #9945ff;
  --pix: 'Press Start 2P', ui-monospace, monospace;
  --sans: 'Pixelify Sans', ui-rounded, system-ui, sans-serif;
  --tb: 56px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --card: rgba(23, 20, 42, .9);
  --frame: 0 0 0 2px var(--line), inset 0 0 0 2px rgba(246, 233, 204, .14), 4px 4px 0 2px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font: 16px/1.35 var(--sans); }
body { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: 8px/1 var(--pix); padding: 3px 4px; background: var(--ink); color: var(--cream); box-shadow: 0 0 0 1px rgba(246,233,204,.35); border-radius: 0; vertical-align: middle; }
.pix, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#game { position: fixed; inset: 0; display: block; width: 100vw; height: 100vh; outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + var(--sat)) 14px 8px;
  background: linear-gradient(180deg, rgba(23,20,42,.97), rgba(23,20,42,.9));
  box-shadow: 0 2px 0 var(--line), 0 4px 0 var(--red2), 0 6px 0 rgba(0,0,0,.2);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
#brandIcon { width: 34px; height: 34px; background: var(--red2); box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--red); padding: 2px; }
.brand-t { display: flex; flex-direction: column; gap: 4px; }
.brand-t b { font: 12px/1 var(--pix); color: var(--cream); letter-spacing: .5px; text-shadow: 2px 2px 0 var(--red2); }
.tick { font: 9px/1 var(--pix); color: var(--ink); background: var(--green); padding: 3px 5px; align-self: flex-start; box-shadow: 0 0 0 2px var(--line); }
.ca { display: flex; align-items: center; gap: 8px; margin: 0 auto; min-width: 0; background: var(--line); padding: 4px 4px 4px 10px; box-shadow: inset 0 0 0 2px rgba(246,233,204,.12); }
.ca-l { font: 8px/1 var(--pix); color: var(--gold); }
.ca code { font: 9px/1.4 var(--pix); color: var(--cream); min-width: 0; word-break: break-all; -webkit-user-select: text; user-select: text; }
.acts { display: flex; align-items: center; gap: 8px; flex: none; }
.ibtn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; padding: 0; background: var(--ink3); text-decoration: none; box-shadow: 0 0 0 2px var(--line), inset 0 -3px 0 rgba(0,0,0,.3); transition: transform .08s; }
.ibtn svg { width: 16px; height: 16px; fill: var(--cream); }
.ibtn:hover { background: var(--navy); }
.ibtn:active { transform: translateY(2px); }
.ibtn.off { opacity: .45; cursor: help; }
.ibtn.off:hover { background: var(--ink3); }
.ca .ibtn { width: 28px; height: 28px; background: var(--red); }
.ca .ibtn.off { background: var(--ink3); opacity: .7; }
.ca .ibtn.copied { background: var(--green); animation: pop .4s; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 0;
  font: 10px/1 var(--pix); color: var(--text); text-decoration: none; background: var(--red);
  box-shadow: 0 0 0 2px var(--line), inset 0 -4px 0 var(--red2), inset 0 2px 0 rgba(255,255,255,.2); white-space: nowrap; transition: transform .08s, filter .1s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(2px); }
.btn.buy.soon { background: var(--ink3); color: var(--muted); box-shadow: 0 0 0 2px var(--line), inset 0 -4px 0 rgba(0,0,0,.3); cursor: help; }
.btn.buy.soon span { color: var(--gold); }
.btn.wallet { background: var(--cream); color: var(--ink); box-shadow: 0 0 0 2px var(--line), inset 0 -4px 0 var(--cream2); }
.btn.wallet.on { background: var(--ink3); color: var(--cream); box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--sol); }
.dot { display: inline-block; width: 8px; height: 8px; background: #14f195; box-shadow: 0 0 0 2px var(--line); margin-right: 2px; }

/* ---------- HUD ---------- */
.tracker {
  position: fixed; z-index: 20; left: 12px; top: calc(var(--tb) + 12px); width: 280px; padding: 10px 12px 12px;
  background: var(--card); box-shadow: var(--frame); cursor: pointer; font-size: 15px;
}
.trk-h { display: flex; justify-content: space-between; align-items: center; font: 8px/1 var(--pix); color: var(--gold); margin-bottom: 7px; }
.trk-x { border: 0; background: var(--ink3); width: 22px; height: 18px; font: 10px/1 var(--pix); color: var(--cream); padding: 0; }
.trk-t { display: block; font-weight: 700; color: var(--cream); font-size: 16px; margin-bottom: 4px; }
.tracker ul, .qcard ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tracker li, .qcard li { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
.tracker li i, .qcard li i { flex: none; width: 10px; height: 10px; margin-top: 4px; box-shadow: 0 0 0 2px var(--muted); }
.tracker li.ok, .qcard li.ok { color: var(--muted); text-decoration: line-through; }
.tracker li.ok i, .qcard li.ok i { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.tracker.min ul, .tracker.min .trk-done { display: none; }
.tracker.min .trk-t { margin: 0; font-size: 14px; }
.tracker.min .trk-x { transform: rotate(90deg); }
.trk-done { margin: 0; color: var(--muted); font-size: 14px; }

.side { position: fixed; z-index: 20; right: 12px; top: calc(var(--tb) + 12px); width: 184px; display: grid; gap: 10px; }
#minimap { width: 184px; height: 138px; display: block; background: var(--line); box-shadow: var(--frame); cursor: zoom-in; }
.stat { background: var(--card); box-shadow: var(--frame); padding: 8px 10px; display: grid; gap: 5px; font-size: 14px; }
.stat .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); }
.stat .row b { font: 9px/1 var(--pix); color: var(--cream); }
.stat .row.pc img { width: 14px; height: 14px; }
.stat .row.pc span { flex: 1; }
.xpbar { height: 8px; background: var(--line); box-shadow: inset 0 0 0 1px rgba(246,233,204,.2); }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(180deg, #ffe08a 0 50%, var(--gold) 50%); transition: width .4s; }
.xpbar.prog i { background: linear-gradient(180deg, #8fd36b 0 50%, var(--green) 50%); }
.xpbar.big { height: 12px; margin-top: 6px; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tools button {
  position: relative; height: 40px; border: 0; padding: 0; background: var(--card); box-shadow: var(--frame);
  display: grid; place-items: center; font-size: 18px; transition: transform .08s;
}
.tools button:hover { background: var(--ink3); }
.tools button:active { transform: translateY(2px); }
.tools kbd { position: absolute; right: 2px; bottom: 2px; font-size: 6px; padding: 2px 3px; }
.tools button > span:first-child { filter: drop-shadow(1px 1px 0 var(--line)); }
#sndBtn .s-off, #sndBtn.muted .s-on { display: none; }
#sndBtn.muted .s-off { display: inline; }
.tools [data-panel="planned"] span { color: var(--gold); font-size: 20px; }

.banner { position: fixed; z-index: 25; left: 50%; top: calc(var(--tb) + 24px); transform: translate(-50%, -10px); opacity: 0; pointer-events: none; text-align: center; transition: opacity .5s, transform .5s; }
.banner b { display: block; font: 18px/1.2 var(--pix); color: var(--cream); text-shadow: 3px 3px 0 var(--red2), 0 0 12px rgba(0,0,0,.6); white-space: nowrap; }
.banner span { display: inline-block; margin-top: 8px; padding: 4px 10px; background: rgba(23,20,42,.75); font-size: 15px; color: var(--muted); }
.banner.show { opacity: 1; transform: translate(-50%, 0); }

.hint {
  position: fixed; z-index: 22; left: 50%; bottom: calc(22px + var(--sab)); transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  padding: 10px 16px; background: var(--card); box-shadow: var(--frame); font-size: 16px; white-space: nowrap; transition: opacity .4s, transform .4s;
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }
.hint b { color: var(--gold); }
.hint .mk { display: inline-block; width: 16px; text-align: center; background: #ffd34d; color: var(--ink); font: 9px/16px var(--pix); box-shadow: 0 0 0 2px var(--line); }
body.talking .hint { opacity: 0; }

.badge-pop {
  position: fixed; z-index: 45; left: 50%; top: 32%; transform: translate(-50%, 20px) scale(.9); opacity: 0; pointer-events: none;
  display: flex; gap: 14px; align-items: center; padding: 14px 20px 14px 14px; background: var(--cream); color: var(--ink);
  box-shadow: 0 0 0 3px var(--line), 0 0 0 6px var(--gold), 8px 8px 0 4px rgba(0,0,0,.35); transition: opacity .35s, transform .35s;
}
.badge-pop.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.badge-pop img { width: 64px; height: 69px; animation: bob 1s ease-in-out infinite; }
.badge-pop small { display: block; font: 8px/1 var(--pix); color: var(--red); margin-bottom: 6px; }
.badge-pop b { display: block; font-size: 20px; }
.badge-pop span { font-size: 14px; color: #5a4e6e; }

/* ---------- Dialogue ---------- */
.dlg {
  position: fixed; z-index: 40; left: 50%; bottom: calc(18px + var(--sab)); transform: translateX(-50%);
  width: min(760px, calc(100% - 24px)); min-height: 112px; display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px 16px 14px;
  background: var(--cream); color: var(--ink); cursor: pointer;
  box-shadow: 0 0 0 3px var(--line), 0 0 0 6px var(--red), 0 0 0 9px var(--line), 8px 8px 0 6px rgba(0,0,0,.3);
}
.dlg.open { animation: rise .18s ease-out; }
.dlg[hidden] { display: none; }
.dlg-p { flex: none; width: 76px; height: 76px; box-shadow: 0 0 0 3px var(--line); }
.dlg-b { flex: 1; min-width: 0; }
.dlg-n { display: inline-block; font: 9px/1 var(--pix); color: var(--cream); background: var(--red2); padding: 5px 8px; margin-bottom: 8px; box-shadow: 0 0 0 2px var(--line); }
.dlg-t { margin: 0; font-size: 19px; line-height: 1.35; min-height: 52px; white-space: pre-line; }
.dlg-c { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.dlg-c button { border: 0; padding: 9px 14px; font: 10px/1 var(--pix); background: var(--cream2); color: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.dlg-c button.sel { background: var(--red); color: var(--text); }
.dlg-c button.sel::before { content: '▶ '; }
.dlg-next { position: absolute; right: 14px; bottom: 8px; font-size: 12px; color: var(--red); opacity: 0; }
.dlg.done .dlg-next { opacity: 1; animation: blink .8s steps(2) infinite; }
.dlg.done:has(.dlg-c button) .dlg-next { opacity: 0; }

/* ---------- Panels ---------- */
.panel { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: calc(var(--tb) + 10px) 12px calc(12px + var(--sab)); background: rgba(10, 8, 20, .55); }
.panel[hidden] { display: none; }
.panel-card {
  position: relative; width: min(680px, 100%); max-height: 100%; overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  background: var(--ink2); box-shadow: 0 0 0 3px var(--line), 0 0 0 6px var(--cream), 0 0 0 9px var(--line), 10px 10px 0 6px rgba(0,0,0,.35);
  padding: 16px 18px 20px; animation: rise .18s ease-out; -webkit-user-select: text; user-select: text;
}
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-h h2 { margin: 0; font: 13px/1.3 var(--pix); color: var(--cream); text-shadow: 2px 2px 0 var(--red2); }
.xbtn { flex: none; width: 34px; height: 34px; border: 0; background: var(--red); font: 12px/1 var(--pix); box-shadow: 0 0 0 2px var(--line), inset 0 -3px 0 var(--red2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -2px 14px; padding: 2px; scrollbar-width: none; }
.tabs button { flex: none; border: 0; padding: 8px 10px; font: 9px/1 var(--pix); background: var(--ink); color: var(--muted); box-shadow: 0 0 0 2px var(--line); }
.tabs button[aria-selected="true"] { background: var(--cream); color: var(--ink); }
.tabs kbd { font-size: 6px; margin-left: 2px; }
.panel-body h3 { font: 9px/1 var(--pix); color: var(--gold); margin: 18px 0 10px; }
.panel-body h3:first-child { margin-top: 0; }
.panel-body p { margin: 0 0 6px; }
.lead { color: var(--text); }
.note { color: var(--muted); font-size: 14px; margin-top: 10px !important; }
.empty { color: var(--muted); }
.tag { display: inline-block; font: 7px/1 var(--pix); padding: 4px 5px; background: var(--ink3); color: var(--muted); vertical-align: middle; }
.tag.main { background: var(--red); color: var(--text); }
.qcard { position: relative; padding: 12px 14px; margin-bottom: 10px; background: var(--ink); box-shadow: 0 0 0 2px var(--line), inset 3px 0 0 var(--ink3); }
.qcard.active { box-shadow: 0 0 0 2px var(--line), inset 3px 0 0 var(--gold); }
.qcard.tracked { box-shadow: 0 0 0 2px var(--gold), inset 3px 0 0 var(--gold); }
.qcard.done { opacity: .75; box-shadow: 0 0 0 2px var(--line), inset 3px 0 0 var(--green); }
.qhead { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 4px; }
.qhead b { font-size: 17px; color: var(--cream); }
.qcard p { color: var(--muted); font-size: 15px; }
.qgiver { color: var(--text) !important; }
.qcard ul { margin-top: 6px; }
.mini-btn { border: 0; margin-top: 8px; padding: 8px 10px; font: 8px/1 var(--pix); background: var(--cream); color: var(--ink); box-shadow: 0 0 0 2px var(--line), inset 0 -3px 0 var(--cream2); }
.mini-btn.danger { background: transparent; color: var(--muted); box-shadow: 0 0 0 2px var(--ink3); margin-top: 18px; }
.tracking { display: inline-block; margin-top: 8px; font: 8px/1 var(--pix); color: var(--gold); }
.bag { display: grid; gap: 8px; }
.slot { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.slot img { width: 42px; height: 42px; flex: none; background: var(--ink3); padding: 4px; }
.slot b { color: var(--cream); }
.slot p { color: var(--muted); font-size: 14px; margin: 2px 0 0 !important; }
.pers { display: flex; flex-wrap: wrap; gap: 8px; }
.pers span { width: 40px; height: 40px; display: grid; place-items: center; background: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.pers img { width: 28px; height: 28px; filter: grayscale(1) brightness(.35); }
.pers .got img { filter: none; animation: bob 1.6s ease-in-out infinite; }
.crit { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ccard { display: flex; gap: 12px; padding: 10px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.ccard img { width: 56px; height: 56px; flex: none; filter: brightness(0) opacity(.6); }
.ccard.got img { filter: none; }
.ccard b { color: var(--cream); }
.ccard p { color: var(--muted); font-size: 14px; margin: 2px 0 4px !important; }
.ccard small { color: var(--gold); font-size: 13px; }
.bigmap { background: var(--line); padding: 4px; box-shadow: 0 0 0 2px var(--line); }
#bigmap { width: 100%; height: auto; display: block; }
.legend { color: var(--muted); font-size: 14px; margin-top: 8px !important; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; box-shadow: 0 0 0 1px var(--line); }
.lg-p { background: var(--red); } .lg-t { background: #ffd34d; } .lg-n { background: var(--cream); margin-left: 6px; }
.lg-t { margin-left: 6px; }
.prof { display: flex; gap: 14px; align-items: center; }
.pbig { width: 80px; height: 80px; box-shadow: 0 0 0 3px var(--line); }
.prof > div { flex: 1; }
.pname { display: block; font: 13px/1.2 var(--pix); color: var(--cream); }
.plv { color: var(--muted); font-size: 15px; }
.wbox { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.wbox .mini-btn { margin: 0; }
.wbox.on { box-shadow: 0 0 0 2px var(--sol); }
.wbox code { font: 9px/1 var(--pix); color: var(--cream); }
.okc { color: #14f195; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.bd { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); text-align: center; font-size: 13px; color: var(--muted); }
.bd img { width: 48px; height: 52px; }
.bd.got { color: var(--cream); box-shadow: 0 0 0 2px var(--gold); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stats span { padding: 8px 10px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); color: var(--muted); display: flex; justify-content: space-between; }
.stats b { color: var(--cream); }
.plan { display: grid; gap: 10px; margin: 12px 0; }
.pcard { display: flex; gap: 12px; padding: 12px; background: var(--ink); box-shadow: 0 0 0 2px var(--line); }
.pi { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; background: var(--ink3); box-shadow: 0 0 0 2px var(--line); }
.pcard b { color: var(--cream); }
.pcard .tag { background: var(--gold); color: var(--ink); margin-left: 4px; }
.pcard p { color: var(--muted); font-size: 15px; margin: 4px 0 0 !important; }

/* ---------- Cooking ---------- */
.cook .panel-card { width: min(480px, 100%); text-align: center; }
.cook-step { font-size: 19px; color: var(--cream); margin: 4px 0 10px !important; }
.cook-meta { display: flex; justify-content: space-between; margin-bottom: 10px; }
.cook-meta i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; box-shadow: 0 0 0 2px var(--line); background: var(--ink3); }
.dots i.ok { background: var(--green); } .dots i.now { background: var(--gold); }
.lives i { background: var(--red); clip-path: polygon(50% 100%, 0 40%, 0 10%, 30% 0, 50% 20%, 70% 0, 100% 10%, 100% 40%); }
.lives i.lost { background: var(--ink3); }
.cook-bar { position: relative; height: 34px; background: var(--line); box-shadow: 0 0 0 3px var(--line), inset 0 0 0 2px rgba(246,233,204,.2); overflow: hidden;
  background-image: repeating-linear-gradient(90deg, transparent 0 19px, rgba(255,255,255,.06) 19px 20px); }
.cook-zone { position: absolute; top: 3px; bottom: 3px; background: linear-gradient(180deg, #8fd36b 0 50%, var(--green) 50%); box-shadow: 0 0 0 2px #1d3a22; }
.cook-needle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--cream); box-shadow: 0 0 0 2px var(--line); }
.cook-msg { min-height: 26px; margin: 10px 0 !important; font: 10px/26px var(--pix); }
.cook-msg.good { color: #8fd36b; animation: pop .3s; } .cook-msg.bad { color: #ff7b7b; animation: shake .3s; }
.btn.big { height: 56px; width: 100%; font-size: 16px; }
.cook-tip { color: var(--muted); font-size: 14px; margin-top: 12px !important; }

/* ---------- Touch controls ---------- */
.touch { display: none; }
@media (pointer: coarse), (hover: none) {
  .touch { display: block; }
  .joy {
    position: fixed; z-index: 35; left: calc(22px + env(safe-area-inset-left, 0px)); bottom: calc(26px + var(--sab)); width: 124px; height: 124px; border-radius: 50%;
    background: radial-gradient(circle, rgba(246,233,204,.12) 0 55%, rgba(246,233,204,.2) 56% 60%, rgba(23,20,42,.45) 61%); box-shadow: 0 0 0 3px rgba(11,10,20,.6); touch-action: none;
  }
  .joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: var(--cream); box-shadow: 0 0 0 3px var(--line), inset 0 -5px 0 var(--cream2); pointer-events: none; }
  .abtn {
    position: fixed; z-index: 35; right: calc(24px + env(safe-area-inset-right, 0px)); bottom: calc(40px + var(--sab)); width: 84px; height: 84px; border-radius: 50%; border: 0;
    font: 20px/1 var(--pix); color: var(--text); background: var(--red); box-shadow: 0 0 0 3px var(--line), inset 0 -7px 0 var(--red2), inset 0 3px 0 rgba(255,255,255,.25); touch-action: none;
  }
  .abtn:active { transform: translateY(3px); box-shadow: 0 0 0 3px var(--line), inset 0 -3px 0 var(--red2); }
  body.talking .joy { opacity: .25; }
  .hint { bottom: calc(170px + var(--sab)); }
  .dlg { bottom: calc(150px + var(--sab)); }
  .tools kbd { display: none; }
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; top: calc(var(--tb) + 86px); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { padding: 10px 14px; background: var(--ink); box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--cream); font-size: 16px; text-align: center; animation: rise .2s ease-out; transition: opacity .4s, transform .4s; }
.toast.good { box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--green); }
.toast.gold { box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--gold); color: #ffe08a; }
.toast.quest { box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--gold); }
.toast.info { box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px #5aa8e0; }
.toast.err { box-shadow: 0 0 0 2px var(--line), inset 0 0 0 2px var(--red); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- Wallet modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 16px; background: rgba(7, 8, 15, .75); }
.modal.open { display: grid; }
.modal-card { position: relative; width: min(430px, 100%); background: var(--ink2); padding: 24px 20px 20px; box-shadow: 0 0 0 3px var(--line), 0 0 0 6px var(--cream), 0 0 0 9px var(--line); }
.modal-card h3 { font: 11px/1.4 var(--pix); color: var(--cream); margin: 0 0 10px; padding-right: 36px; }
.modal-sub { font-size: 15px; color: var(--muted); margin: 0 0 16px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.wlist { display: grid; gap: 8px; }
.wopt { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--ink); color: var(--text); border: 0; text-decoration: none; cursor: pointer; font: 600 16px/1 var(--sans); text-align: left; box-shadow: inset 0 0 0 2px var(--ink3); }
.wopt:hover, .wopt:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.wopt img, .wopt .wi { width: 28px; height: 28px; flex: none; }
.wopt .wi { display: grid; place-items: center; background: var(--cream); color: var(--ink); font: 11px/1 var(--pix); }
.wopt small { margin-left: auto; font: 7px/1 var(--pix); color: #14f195; }
.wopt small.get { color: var(--gold); }
.wfoot { font-size: 14px; color: var(--muted); margin: 14px 0 0; }
.wfoot b { color: var(--cream); }

/* ---------- Loader / fatal ---------- */
.loader { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--ink); transition: opacity .45s; }
.loader.out { opacity: 0; pointer-events: none; }
.ld-box { display: grid; justify-items: center; gap: 14px; }
.ld-box b { font: 14px/1 var(--pix); color: var(--cream); text-shadow: 2px 2px 0 var(--red2); }
.ld-box span { color: var(--muted); }
.ld-jar { width: 40px; height: 44px; background: var(--red2); box-shadow: 0 0 0 3px var(--line), inset 0 -10px 0 #6d3b22, inset 0 10px 0 var(--green); animation: bob .7s ease-in-out infinite; }
.fatal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(7,8,15,.9); }
.fatal[hidden] { display: none; }
.fatal code { display: block; font-size: 12px; color: #ff9b9b; margin: 0 0 14px; word-break: break-word; }

/* ---------- Animations ---------- */
@keyframes rise { from { transform: translate(var(--tx, 0), 10px); opacity: 0; } }
.dlg.open { --tx: -50%; }
@keyframes pop { 50% { transform: scale(1.15); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- Responsive ---------- */
.hide-s { display: inline; }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: calc(6px + var(--sat)) 10px 7px; }
  .acts { display: contents; }
  .brand { order: 1; }
  #buyBtn { order: 2; margin-left: auto; }
  #walletBtn { order: 3; }
  .ca { order: 4; flex: 1 1 calc(100% - 96px); margin: 0; }
  .soc { order: 5; }
}
@media (max-width: 560px) {
  .hide-s { display: none; }
  #brandIcon { width: 28px; height: 28px; }
  .brand-t b { font-size: 10px; }
  .ca { padding-left: 8px; gap: 6px; }
  .ca code { font-size: 6px; letter-spacing: -.2px; }
  .btn { padding: 0 10px; font-size: 9px; height: 32px; }
  .ibtn { width: 32px; height: 32px; }
  .tracker { width: calc(100% - 156px); left: 8px; top: calc(var(--tb) + 8px); padding: 8px 10px; font-size: 13px; }
  .trk-t { font-size: 14px; }
  .side { right: 8px; top: calc(var(--tb) + 8px); width: 132px; gap: 6px; }
  #minimap { width: 132px; height: 99px; }
  .stat { padding: 6px 8px; gap: 4px; font-size: 12px; }
  .stat .row:nth-child(3), .stat .xpbar.prog { display: none; }
  .banner { top: auto; bottom: calc(290px + var(--sab)); }
  .toasts { top: auto; bottom: calc(232px + var(--sab)); }
  .tools button { height: 34px; font-size: 15px; }
  .banner b { font-size: 13px; }
  .banner span { font-size: 13px; }
  .dlg { padding: 10px 12px 14px 10px; gap: 10px; min-height: 96px; }
  .dlg-p { width: 54px; height: 54px; }
  .dlg-t { font-size: 17px; }
  .panel-card { padding: 14px 12px 18px; }
  .badge-pop { width: calc(100% - 32px); }
  .hint { font-size: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .tracker { width: 230px; font-size: 13px; }
  .side { width: 140px; } #minimap { width: 140px; height: 105px; }
  .stat .row.pc, .stat .xpbar.prog, .stat .row:nth-child(3) { display: none; }
  .tools button { height: 30px; }
  .dlg { bottom: calc(10px + var(--sab)); width: min(560px, calc(100% - 260px)); }
  .joy { bottom: 14px; width: 104px; height: 104px; } .abtn { bottom: 20px; width: 70px; height: 70px; }
  .hint { bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
