﻿/* ============================================================
   Dawid Tomczyk: Career Quest â€” STYLES
   Visual chrome ported from the UI kit (tokens-driven) + the
   production world ground / lake / dock / building layers.
   All colours come from colors_and_type.css â€” never hardcode hex.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Pixelify+Sans:wght@400;500;600;700&family=Silkscreen:wght@400;700&display=swap');
@import url('colors_and_type.css');

*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:#0c0c0b;overflow:hidden;font-family:var(--font-ui);-webkit-font-smoothing:none;color:var(--ink)}
#game{height:100vh;width:100vw}
img,.pix{image-rendering:pixelated}
button{font-family:inherit}

/* ============ STAGE / SCALING ============ */
.cq-stage{position:absolute;inset:0;background:#0c0c0b;overflow:hidden}
/* Scaler = viewport-sized container; world layer inside it is larger and panned by camera */
.cq-scaler{position:absolute;inset:0;overflow:hidden}
/* World canvas â€” width+height set by JS from C.WORLD dimensions; panned via transform */
.cq-world{position:absolute;top:0;left:0;overflow:hidden;will-change:transform;
  box-shadow:0 0 0 4px var(--panel-ink),0 0 0 6px var(--gold-dark)}

/* ---- Ground: pixel-art grass texture ---- */
.cq-ground{position:absolute;inset:0;z-index:0;
  background:url('assets/grass-background.jpg') repeat;
  image-rendering:pixelated}
/* Provisional SVG dirt paths connecting locations â€” generated by buildPaths() in game.js */
.cq-paths-svg{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;pointer-events:none}

/* ---- Lake of Growth â€” tiled water base + animated wave overlays ----
   Structure (built in game.js buildWorld): .cq-lake holds two drifting wave
   layers and the label. overflow:hidden keeps the waves inside the lake; the
   dock/boat are separate world elements (z-index:7) so they stay above. */
.cq-lake{position:absolute;left:0;right:0;bottom:0;height:20%;overflow:hidden;
  background:url('assets/water-base.jpg') repeat;background-size:512px auto;
  border-top:3px solid #6fb3bf;box-shadow:inset 0 6px 18px rgba(0,0,0,.35)}
/* Two gentle wave overlays â€” CSS-only horizontal drift, different speed/dir/opacity.
   Each loops seamlessly because the keyframe shift equals one tile width. */
.cq-lake__waves{position:absolute;inset:0;pointer-events:none;
  background-image:url('assets/water-waves-overlay.png');background-repeat:repeat-x;
  will-change:background-position}
.cq-lake__waves--1{background-size:640px 100%;opacity:.40;
  animation:cqwave1 30s linear infinite}
.cq-lake__waves--2{background-size:880px 60%;background-position:0 100%;opacity:.22;
  animation:cqwave2 48s linear infinite}
@keyframes cqwave1{from{background-position:0 0}      to{background-position:-640px 0}}
@keyframes cqwave2{from{background-position:0 100%}   to{background-position:880px 100%}}
.cq-lake__label{position:absolute;left:18px;bottom:10px;z-index:1;font-family:var(--font-mono);font-size:12px;
  letter-spacing:3px;color:#cdeef2;text-transform:uppercase;opacity:.8}
/* Dock container â€” static, never animated (transform must not be overwritten) */
.cq-dock{position:absolute;transform:translate(-50%,-30%);z-index:7;
  display:flex;flex-direction:column;align-items:center}
/* Static pier/jetty image */
.cq-dock__img{display:block;width:200px;height:auto;image-rendering:pixelated;
  pointer-events:none;user-select:none}
/* Boat image â€” floats to the RIGHT of the pier, in the water; bobs when ready.
   Absolutely positioned (relative to the .cq-dock container) so it sits beside the
   pier instead of stacking below it. left/top anchor it; the bob animation uses
   transform only, so it never fights these offsets. */
.cq-boat__img{position:absolute;left:74%;top:28%;width:135px;height:auto;
  image-rendering:pixelated;pointer-events:none;user-select:none}
.cq-dock.locked{filter:grayscale(.5) brightness(.8)}
.cq-dock.ready{cursor:pointer}
/* Bob only the boat img â€” pier never moves */
.cq-dock.ready .cq-boat__img{animation:cqdockbob 1.6s ease-in-out infinite}
/* Simple vertical bob â€” no base-translate guard needed since animation is on img, not container */
@keyframes cqdockbob{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-4px)}
}
.cq-dock__hint{font-family:var(--font-mono);font-size:10px;color:#fff;background:rgba(18,12,8,.7);
  padding:4px 9px;border:1px solid var(--gold-dark);white-space:normal;max-width:200px;text-align:center;word-wrap:break-word}

/* ============ FRAMES / PANELS ============ */
.cq-panel{position:relative;background:var(--panel-bg);border:3px solid var(--gold);
  box-shadow:inset 0 0 0 3px var(--panel-ink),inset 0 0 0 5px var(--gold-dark),var(--drop-pixel)}
.cq-corner{position:absolute;width:9px;height:9px;background:var(--gold-light);box-shadow:0 0 0 2px var(--gold-deep);z-index:3}
.cq-corner.tl{top:-2px;left:-2px}.cq-corner.tr{top:-2px;right:-2px}
.cq-corner.bl{bottom:-2px;left:-2px}.cq-corner.br{bottom:-2px;right:-2px}

/* ============ BUTTONS ============ */
.cq-btn{font-family:var(--font-display);font-size:13px;color:var(--ink);letter-spacing:.5px;
  padding:15px 26px;border:2px solid var(--gold-dark);cursor:pointer;display:inline-flex;
  align-items:center;justify-content:center;gap:10px;text-shadow:1px 1px 0 rgba(0,0,0,.55);
  background:linear-gradient(var(--bronze-hi),var(--bronze-mid) 55%,var(--bronze-lo));
  box-shadow:inset 0 2px 0 rgba(255,255,255,.30),inset 0 -3px 0 rgba(0,0,0,.38),var(--drop-pixel-sm);
  transition:transform .07s,box-shadow .07s,background .07s;user-select:none}
.cq-btn:hover{background:linear-gradient(#e0ab5c,#b07c39 55%,#80522a);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.40),inset 0 -3px 0 rgba(0,0,0,.38),0 0 0 2px var(--gold),0 0 12px rgba(232,194,90,.4)}
.cq-btn:active{background:linear-gradient(var(--bronze-lo),var(--bronze-mid) 55%,var(--bronze-hi));
  transform:translateY(2px);box-shadow:inset 0 3px 0 rgba(0,0,0,.4)}
.cq-btn--ghost{background:transparent;border-color:var(--gold-dark);color:var(--ink-soft);box-shadow:none}
.cq-btn--ghost:hover{background:rgba(232,194,90,.10);color:var(--gold-light);box-shadow:0 0 0 1px var(--gold-dark)}

/* ============ HUD ============ */
.cq-hud{position:absolute;top:18px;left:18px;display:flex;align-items:center;gap:14px;
  padding:10px 14px;background:var(--panel-bg);border:3px solid var(--gold);
  box-shadow:inset 0 0 0 2px var(--gold-dark),var(--drop-pixel);z-index:20}
.cq-hud__face{width:54px;height:54px;border:2px solid var(--gold);box-shadow:inset 0 0 0 2px var(--gold-dark);overflow:hidden;flex:none;background:var(--panel-ink)}
.cq-hud__face .pcrop{width:100%;height:100%;background-repeat:no-repeat;background-size:392px 294px;background-position:-49px -14px;image-rendering:pixelated}
.cq-hud__bars{display:flex;flex-direction:column;gap:5px;min-width:150px}
.cq-hud__row{display:flex;align-items:center;gap:7px}
.cq-hud__lab{font-family:var(--font-mono);font-size:10px;width:24px;color:var(--ink-soft)}
.cq-track{flex:1;height:13px;background:var(--panel-ink);border:2px solid var(--gold-dark);position:relative;overflow:hidden}
.cq-fill{height:100%;position:relative}
.cq-fill::after{content:"";position:absolute;inset:0 0 auto 0;height:4px;background:rgba(255,255,255,.28)}
.cq-hud__gold{display:flex;align-items:center;gap:7px;padding-left:6px;border-left:2px solid var(--panel-ink)}
.cq-coin{width:18px;height:18px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe89a,var(--coin) 60%,#c8932a);box-shadow:0 0 0 1px #7a5a16}
.cq-hud__gnum{font-family:var(--font-mono);font-size:16px;color:var(--coin);text-shadow:1px 1px 0 rgba(0,0,0,.6)}
.cq-menubtn{position:absolute;top:18px;right:18px;z-index:20;display:flex;gap:10px}
.cq-menubtn .cq-btn{background:var(--panel-bg);box-shadow:inset 0 0 0 2px var(--gold-dark),var(--drop-pixel-sm);border-color:var(--gold)}
.cq-menubtn .cq-btn:hover{color:var(--gold-light)}

/* ============ INTERACT PROMPT ============ */
.cq-prompt{position:absolute;transform:translate(-50%,-100%);z-index:15;display:flex;flex-direction:column;align-items:center;gap:4px;pointer-events:none;
  filter:drop-shadow(0 3px 4px rgba(0,0,0,.5))}
.cq-prompt__key{font-family:var(--font-display);font-size:11px;color:var(--panel-ink);background:var(--gold-light);
  border:2px solid var(--gold-deep);padding:5px 8px;animation:cqbob 1s ease-in-out infinite}
.cq-prompt__lab{font-family:var(--font-ui);font-size:14px;color:#fff;background:rgba(18,12,8,.82);padding:3px 10px;border:1px solid var(--gold-dark);white-space:nowrap}
@keyframes cqbob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}

/* ============ BUILDINGS ============ */
.cq-building{position:absolute;transform:translate(-50%,-78%);z-index:6;cursor:pointer;
  filter:drop-shadow(0 10px 8px rgba(18,12,8,.4));transition:filter .1s,transform .1s}
.cq-building img{display:block;width:100%;height:auto}
.cq-building:hover{filter:drop-shadow(0 0 0 var(--gold)) drop-shadow(0 10px 8px rgba(18,12,8,.5)) brightness(1.05)}
.cq-building.near{filter:drop-shadow(0 0 2px var(--gold-light)) drop-shadow(0 10px 8px rgba(18,12,8,.5))}
/* Completed chapters â€” persistent golden glow + always-visible label with checkmark badge */
.cq-building--done{filter:drop-shadow(0 0 8px rgba(232,194,90,.55)) drop-shadow(0 10px 8px rgba(18,12,8,.4))}
.cq-building--done:hover,
.cq-building--done.near{filter:drop-shadow(0 0 0 var(--gold)) drop-shadow(0 10px 8px rgba(18,12,8,.5)) brightness(1.05)}
.cq-building--done .cq-building__tag::before{content:'âœ“ ';color:var(--gold-light)}
/* Tag is always visible (not just hover/near) for completed buildings */
.cq-building--done .cq-building__tag{opacity:1}
/* Small gold check badge â€” top-right corner of the building art */
.cq-building--done::after{
  content:'âœ“';position:absolute;top:4px;right:4px;
  width:20px;height:20px;line-height:20px;text-align:center;
  background:radial-gradient(circle at 38% 32%,#ffe9a6,var(--gold) 55%,var(--gold-dark));
  color:var(--panel-ink);font-family:var(--font-display);font-size:9px;
  border-radius:50%;border:2px solid var(--gold-deep);
  box-shadow:0 2px 5px rgba(0,0,0,.55);pointer-events:none;z-index:1}
.cq-building__tag{position:absolute;left:50%;top:-6px;transform:translate(-50%,-100%);
  font-family:var(--font-mono);font-size:10px;letter-spacing:1px;color:var(--gold-light);
  background:rgba(18,12,8,.78);border:1px solid var(--gold-dark);padding:3px 8px;white-space:nowrap;
  opacity:0;transition:opacity .12s;pointer-events:none}
.cq-building.near .cq-building__tag,.cq-building:hover .cq-building__tag{opacity:1}

/* ============ ACTORS (player / npc / cat) ============ */
.cq-actor{position:absolute;transform:translate(-50%,-90%);z-index:10;pointer-events:none;
  filter:drop-shadow(0 6px 5px rgba(18,12,8,.45))}
.cq-actor__sprite{background-repeat:no-repeat;background-size:400% 400%}
.cq-actor__shadow{position:absolute;left:50%;bottom:-4px;transform:translateX(-50%);
  width:60%;height:14px;background:radial-gradient(ellipse,rgba(18,12,8,.45),transparent 70%);z-index:-1}
.cq-cat{cursor:pointer;pointer-events:auto}

/* ============ DIALOGUE ============ */
.cq-dlg-wrap{position:absolute;inset:0;z-index:30;display:flex;align-items:flex-end;
  justify-content:center;padding:0 4% 4%;background:rgba(12,8,6,.40)}
.cq-dlg{position:relative;width:min(860px,92%);display:flex;align-items:flex-end}
.cq-dlg__port{width:108px;height:108px;flex:none;background:var(--panel-ink);border:3px solid var(--gold);
  box-shadow:inset 0 0 0 2px var(--gold-dark);overflow:hidden;z-index:2;margin-right:-6px}
.cq-dlg__port img{width:100%;height:100%;object-fit:cover;object-position:top}
.cq-dlg__box{flex:1;min-height:118px;background:var(--panel-maroon);border:3px solid var(--gold);
  box-shadow:inset 0 0 0 2px var(--gold-dark),var(--drop-pixel);padding:16px 22px 18px;position:relative}
.cq-dlg__name{font-family:var(--font-display);font-size:13px;color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep);margin-bottom:11px}
.cq-dlg__name .sub{font-family:var(--font-mono);font-size:10px;color:var(--ink-muted);text-shadow:none;margin-left:6px}
.cq-dlg__txt{font-family:var(--font-ui);font-size:20px;line-height:1.5;color:var(--ink);min-height:30px;cursor:pointer}
.cq-cursor{display:inline-block;width:10px;height:17px;background:var(--gold);margin-left:4px;vertical-align:-2px;animation:cqbl 1s steps(1) infinite}
@keyframes cqbl{50%{opacity:0}}
.cq-opts{display:flex;flex-direction:column;gap:7px;margin-top:12px}
.cq-opt{font-family:var(--font-ui);font-size:17px;color:var(--ink-soft);text-align:left;cursor:pointer;
  padding:8px 12px;background:rgba(0,0,0,.18);border:1px solid var(--gold-deep);display:flex;align-items:center;gap:10px;
  transition:background .08s,color .08s}
.cq-opt:hover{background:rgba(232,194,90,.12);color:var(--gold-light);border-color:var(--gold-dark)}
.cq-opt.asked{opacity:.5}
.cq-opt__b{font-family:var(--font-mono);font-size:11px;color:var(--gold);min-width:14px}
.cq-opt--leave{color:var(--ink-muted);border-style:dashed}
.cq-opt--leave:hover{color:var(--hp);border-color:var(--hp)}

/* ============ TITLE SCREEN ============ */
.cq-title{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  background:radial-gradient(120% 90% at 50% 18%,#34281c 0%,#1a120c 60%,#0c0907 100%);z-index:40;overflow:hidden}
.cq-title__sky{position:absolute;inset:0;opacity:.16;object-fit:cover;width:100%;height:100%;filter:saturate(.7)}
.cq-title__sub{font-family:var(--font-mono);font-size:13px;letter-spacing:4px;color:var(--ink-muted);text-transform:uppercase;z-index:2}
.cq-title__word{font-family:var(--font-display);font-size:clamp(28px,6vw,58px);color:var(--gold-light);letter-spacing:2px;z-index:2;
  text-shadow:4px 4px 0 var(--gold-deep),7px 7px 0 rgba(0,0,0,.6)}
.cq-title__word .q{color:var(--tech-cyan);text-shadow:4px 4px 0 var(--tech-cyan-deep),7px 7px 0 rgba(0,0,0,.6)}
.cq-title__tag{font-family:var(--font-ui);font-size:17px;color:var(--ink-soft);margin-top:8px;z-index:2;text-align:center;padding:0 20px}
.cq-title__menu{display:flex;flex-direction:column;gap:14px;margin-top:34px;width:280px;z-index:2}
.cq-title__menu .cq-btn{width:100%}
.cq-title__foot{position:absolute;bottom:20px;font-family:var(--font-mono);font-size:10px;color:var(--ink-muted);letter-spacing:1px;z-index:2;text-align:center;padding:0 16px}
.cq-title__alpha{position:absolute;bottom:40px;left:0;right:0;font-family:var(--font-mono);font-size:9px;color:var(--tech-cyan);letter-spacing:1px;opacity:.6;z-index:2;text-align:center;padding:0 16px}

/* ============ LANGUAGE SELECTOR (title + pause) ============ */
.cq-lang{position:absolute;top:14px;right:16px;display:flex;gap:6px;z-index:6}
.cq-lang__opt{font-family:var(--font-mono);font-size:10px;letter-spacing:1px;cursor:pointer;
  padding:5px 10px;color:var(--ink-muted);background:rgba(10,7,5,.55);
  border:1px solid var(--gold-dark);border-radius:3px;transition:color .12s,border-color .12s}
.cq-lang__opt:hover{color:var(--gold-light)}
.cq-lang__opt.active{color:var(--panel-ink);background:var(--gold-light);border-color:var(--gold-light)}
/* Inside the pause panel the selector sits in normal flow, centered */
.cq-pause__panel .cq-lang{position:static;justify-content:center;margin-top:12px}

/* ============ RUNTIME LOADING OVERLAY ============ */
/* Shown above title/setup/world only while runtime assets preload. CSS-only. */
.cq-loading{position:absolute;inset:0;z-index:9999;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:16px;padding:24px;text-align:center;
  background:radial-gradient(120% 90% at 50% 28%,#1a1206 0%,#0c0c0b 75%);
  opacity:0;visibility:hidden;transition:opacity .2s ease}
.cq-loading.show{opacity:1;visibility:visible}
.cq-loading__title{font-family:var(--font-display);font-size:18px;letter-spacing:1px;
  color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep)}
.cq-loading__bar{width:min(360px,72vw);height:16px;background:var(--panel-ink);
  border:2px solid var(--gold-dark);box-shadow:inset 0 0 0 1px #000;overflow:hidden}
.cq-loading__fill{height:100%;width:0;background:linear-gradient(var(--bronze-hi),var(--bronze-lo));
  transition:width .15s ease}
.cq-loading__pct{font-family:var(--font-mono);font-size:12px;letter-spacing:1px;color:var(--ink-soft)}
.cq-loading__sub{font-family:var(--font-ui);font-size:13px;line-height:1.4;color:var(--ink-soft);max-width:340px}
@media (prefers-reduced-motion: reduce){
  .cq-loading{transition:none}.cq-loading__fill{transition:none}
}

/* ============ MOBILE TOUCH CONTROLS ============ */
/* Full-screen overlay that itself ignores pointers (so building taps pass
   through); only the joystick + action button capture input. Toggled by
   syncControls() in game.js — z below modals/dialogs (35+), above HUD/world. */
.cq-mob{position:absolute;inset:0;z-index:30;pointer-events:none;display:none}
.cq-mob.show{display:block}
.cq-joy{position:absolute;
  left:calc(18px + env(safe-area-inset-left,0px));
  bottom:calc(20px + env(safe-area-inset-bottom,0px));
  width:120px;height:120px;border-radius:50%;
  background:rgba(10,7,5,.40);border:2px solid var(--gold-dark);
  box-shadow:inset 0 0 0 2px rgba(0,0,0,.30),inset 0 2px 10px rgba(0,0,0,.35);
  display:flex;align-items:center;justify-content:center;
  pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none}
.cq-joy__knob{width:52px;height:52px;border-radius:50%;
  background:radial-gradient(circle at 38% 32%,var(--gold-light),var(--gold) 60%,var(--gold-deep));
  border:2px solid var(--gold-deep);box-shadow:0 2px 6px rgba(0,0,0,.55);
  will-change:transform;pointer-events:none}
.cq-actbtn{position:absolute;
  right:calc(22px + env(safe-area-inset-right,0px));
  bottom:calc(30px + env(safe-area-inset-bottom,0px));
  width:86px;height:86px;border-radius:50%;
  font-family:var(--font-display);font-size:12px;letter-spacing:1px;color:var(--ink);
  text-shadow:1px 1px 0 rgba(0,0,0,.5);
  background:linear-gradient(var(--bronze-hi),var(--bronze-mid) 55%,var(--bronze-lo));
  border:2px solid var(--gold-dark);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.30),inset 0 -3px 0 rgba(0,0,0,.38),var(--drop-pixel-sm);
  pointer-events:auto;touch-action:none;cursor:pointer;user-select:none;-webkit-user-select:none}
.cq-actbtn:active{transform:translateY(2px);box-shadow:inset 0 3px 0 rgba(0,0,0,.4)}

/* ============ MOBILE LAYOUT POLISH ============
   Gated by body.cq-mobile (toggled in game.js syncControls() = the same
   touch/coarse/narrow detection used by the joystick). Desktop is untouched. */

/* TASK 1 — hide the keyboard controls hint on mobile (it overlapped the joystick). */
body.cq-mobile .cq-help{display:none}

/* TASK 2 — compact HUD: keep only gold + badges; drop face/HP/MP/XP/level. */
body.cq-mobile .cq-hud{top:8px;left:8px;gap:7px;padding:4px 9px;border-width:2px;
  box-shadow:inset 0 0 0 1px var(--gold-dark),var(--drop-pixel-sm)}
body.cq-mobile .cq-hud__face,
body.cq-mobile .cq-hud__bars,
body.cq-mobile .cq-hud__lvl{display:none}
body.cq-mobile .cq-hud__gold{padding-left:5px;gap:5px}
body.cq-mobile .cq-hud__gold:first-of-type{border-left:none;padding-left:0}
body.cq-mobile .cq-hud__gnum{font-size:13px}
body.cq-mobile .cq-coin{width:14px;height:14px}
body.cq-mobile .cq-hud__badges .cq-hud__lab{font-size:11px}

/* TASK 3 — smaller Fast Track / Menu so they don't crowd the compact HUD. */
body.cq-mobile .cq-menubtn{top:8px;right:8px;gap:6px}
body.cq-mobile .cq-menubtn .cq-btn{padding:7px 9px;font-size:9px;gap:5px;letter-spacing:0;border-width:1px}

/* TASK 4 — responsive dialogue: fit viewport, scroll inside, smaller portrait/text. */
body.cq-mobile .cq-dlg-wrap{padding:0 8px calc(8px + env(safe-area-inset-bottom,0px));align-items:flex-end}
body.cq-mobile .cq-dlg{width:calc(100vw - 16px);align-items:stretch;
  max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px)}
body.cq-mobile .cq-dlg__port{width:60px;height:60px;align-self:flex-start;margin-right:-4px;border-width:2px}
body.cq-mobile .cq-dlg__box{min-height:0;padding:11px 13px 13px;border-width:2px;
  overflow-y:auto;-webkit-overflow-scrolling:touch;
  max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px)}
body.cq-mobile .cq-dlg__name{font-size:12px;margin-bottom:8px}
body.cq-mobile .cq-dlg__txt{font-size:15px;line-height:1.4;min-height:0}
body.cq-mobile .cq-opts{gap:6px;margin-top:10px}
body.cq-mobile .cq-opt{font-size:14px;padding:9px 11px}

/* TASK 5 — keep the other overlays inside the viewport (width + internal scroll). */
body.cq-mobile .cq-ft__panel{width:calc(100vw - 16px);padding:16px 16px 14px;
  max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px)}
body.cq-mobile .cq-ft__sub{font-size:11px}
body.cq-mobile .cq-pause__panel{width:min(320px,calc(100vw - 24px));padding:18px}
body.cq-mobile .cq-nqi__dlg{width:calc(100vw - 16px)}
body.cq-mobile .cq-nqi__port{width:68px;height:68px}
body.cq-mobile .cq-nqi__box{padding:12px 14px;min-height:0}
body.cq-mobile .cq-nqi__txt{font-size:15px;line-height:1.4}
body.cq-mobile .cq-nqi__title{margin-bottom:16px}
body.cq-mobile .cq-catm{width:calc(100vw - 24px)}

/* ============ PAUSE MENU ============ */
.cq-pause{position:absolute;inset:0;z-index:35;display:flex;align-items:center;justify-content:center;background:rgba(10,7,5,.55)}
.cq-pause__panel{width:320px;padding:22px}
.cq-pause__hdr{font-family:var(--font-display);font-size:13px;color:var(--gold-light);text-align:center;
  text-shadow:2px 2px 0 var(--gold-deep);margin-bottom:18px;letter-spacing:1px}
.cq-pause__list{display:flex;flex-direction:column;gap:9px}
.cq-row{font-family:var(--font-ui);font-size:19px;color:var(--ink-soft);padding:10px 16px;display:flex;align-items:center;gap:10px;cursor:pointer;border:1px solid transparent}
.cq-row:hover,.cq-row.sel{color:var(--gold-light);background:rgba(232,194,90,.10);border-color:var(--gold-dark)}
.cq-row::before{content:"";width:13px;font-size:12px;color:var(--gold)}
.cq-row:hover::before,.cq-row.sel::before{content:"\25B6"}

/* ============ QUEST TOAST ============ */
.cq-toast{position:absolute;top:96px;left:50%;transform:translateX(-50%);z-index:25;
  background:var(--panel-bg);border:2px solid var(--gold);box-shadow:inset 0 0 0 2px var(--gold-dark),var(--drop-pixel);
  padding:10px 18px;display:flex;align-items:center;gap:12px;animation:cqdrop .4s ease both;
  max-width:min(620px,88%)}
.cq-toast__star{font-family:var(--font-display);color:var(--gold-light);font-size:14px}
.cq-toast__txt{display:flex;flex-direction:column}
.cq-toast__k{font-family:var(--font-mono);font-size:9px;color:var(--ink-muted);letter-spacing:1px;text-transform:uppercase}
.cq-toast__v{font-family:var(--font-ui);font-size:16px;color:var(--ink);white-space:normal;line-height:1.4}
@keyframes cqdrop{from{opacity:0;transform:translate(-50%,-12px)}to{opacity:1;transform:translate(-50%,0)}}

.cq-help{position:absolute;bottom:16px;left:50%;transform:translateX(-50%);z-index:18;
  font-family:var(--font-mono);font-size:11px;color:#fff;background:rgba(18,12,8,.6);padding:6px 14px;border:1px solid var(--gold-dark);letter-spacing:.5px;text-align:center;max-width:92%}

/* ============ FAST TRACK PANEL ============ */
.cq-ft{position:absolute;inset:0;z-index:34;display:flex;align-items:center;justify-content:center;background:rgba(10,7,5,.55)}
.cq-ft__panel{width:min(560px,92%);padding:24px 26px 22px;max-height:90%;overflow:auto}
.cq-ft__hdr{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:6px}
.cq-ft__title{font-family:var(--font-display);font-size:15px;color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep)}
.cq-ft__count{font-family:var(--font-mono);font-size:11px;color:var(--gold)}
.cq-ft__sub{font-family:var(--font-ui);font-size:15px;color:var(--ink-muted);margin-bottom:16px}
.cq-ft__list{display:flex;flex-direction:column;gap:8px}
.cq-ft__row{display:flex;align-items:center;gap:12px;padding:11px 13px;background:var(--panel-bg-2);
  border:1px solid var(--panel-ink);cursor:pointer;transition:border-color .1s,background .1s}
.cq-ft__row:hover{border-color:var(--gold-dark);background:rgba(232,194,90,.08)}
.cq-ft__tick{width:26px;height:26px;flex:none;border:2px solid var(--gold-dark);display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display);font-size:11px;color:var(--panel-ink);background:var(--panel-ink)}
.cq-ft__tick.done{background:linear-gradient(var(--gold-light),var(--gold-dark));color:var(--panel-ink)}
.cq-ft__rowtxt{flex:1;display:flex;flex-direction:column}
.cq-ft__rt{font-family:var(--font-ui);font-size:18px;color:var(--ink)}
.cq-ft__rs{font-family:var(--font-mono);font-size:10px;color:var(--ink-muted);text-transform:uppercase;letter-spacing:.5px}
.cq-ft__jump{font-family:var(--font-mono);font-size:10px;color:var(--gold);text-transform:uppercase;letter-spacing:1px}
.cq-ft__foot{display:flex;gap:12px;margin-top:18px}
.cq-ft__foot .cq-btn{flex:1}

/* ============ BADGE POPUP ============ */
.cq-badge-wrap{position:absolute;inset:0;z-index:38;display:flex;align-items:center;justify-content:center;background:rgba(8,6,4,.6)}
.cq-badge{position:relative;padding:30px 38px 26px;text-align:center;animation:cqpop .35s cubic-bezier(.2,1.3,.5,1) both}
.cq-badge__rays{position:absolute;inset:-40%;z-index:-1;background:conic-gradient(from 0deg,rgba(232,194,90,.16) 0 8deg,transparent 8deg 22deg);animation:cqspin 14s linear infinite}
.cq-badge__seal{width:108px;height:108px;margin:0 auto 14px;position:relative;display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at 38% 32%,#ffe9a6,var(--gold) 55%,var(--gold-dark));
  clip-path:polygon(50% 0,79% 9%,97% 35%,97% 65%,79% 91%,50% 100%,21% 91%,3% 65%,3% 35%,21% 9%);
  box-shadow:0 0 0 4px var(--gold-deep),0 0 22px rgba(232,194,90,.5)}
.cq-badge__mono{font-family:var(--font-display);font-size:18px;color:var(--panel-ink);text-shadow:1px 1px 0 rgba(255,255,255,.4)}
.cq-badge__k{font-family:var(--font-mono);font-size:11px;color:var(--gold);letter-spacing:2px;text-transform:uppercase}
.cq-badge__l{font-family:var(--font-display);font-size:16px;color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep);margin:8px 0 4px}
.cq-badge__c{font-family:var(--font-ui);font-size:15px;color:var(--ink-soft)}
@keyframes cqpop{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}
@keyframes cqspin{to{transform:rotate(360deg)}}

/* ============ CAT MODAL ============ */
.cq-cat-wrap{position:absolute;inset:0;z-index:37;display:flex;align-items:center;justify-content:center;background:rgba(8,6,4,.5)}
.cq-catm{width:min(380px,90%);padding:22px;text-align:center}
.cq-catm__stage{height:150px;display:flex;align-items:center;justify-content:center;background:linear-gradient(#3a4a3a,#2a3a2c);border:2px solid var(--gold-dark);margin-bottom:14px;overflow:hidden}
.cq-catm__stage img{height:128px;image-rendering:pixelated;object-fit:contain;animation:cqcatbob 1.4s ease-in-out infinite}
@keyframes cqcatbob{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
.cq-catm__name{font-family:var(--font-display);font-size:14px;color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep);margin-bottom:8px}
.cq-catm__line{font-family:var(--font-ui);font-size:17px;color:var(--ink);line-height:1.5;margin-bottom:14px;min-height:50px}
.cq-catm__hearts{font-family:var(--font-mono);font-size:16px;color:var(--hp);letter-spacing:3px;min-height:22px;margin-bottom:12px}
.cq-catm__row{display:flex;gap:10px}.cq-catm__row .cq-btn{flex:1}

/* ============ NEXT QUEST ISLAND ============ */
.cq-nqi{position:absolute;inset:0;z-index:42;display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:radial-gradient(120% 90% at 50% 10%,#1f2d3a 0%,#15202b 55%,#0c1218 100%);overflow:hidden}
.cq-nqi__ref{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.22;filter:saturate(.8)}
.cq-nqi__stars{position:absolute;inset:0;z-index:0;opacity:.5;
  background-image:radial-gradient(1px 1px at 20% 30%,#fff,transparent),radial-gradient(1px 1px at 70% 20%,#cfe,transparent),radial-gradient(1px 1px at 45% 60%,#fff,transparent),radial-gradient(1px 1px at 85% 70%,#fff,transparent),radial-gradient(1px 1px at 12% 80%,#bdf,transparent);background-repeat:no-repeat}
.cq-nqi__banner{position:relative;z-index:2;font-family:var(--font-mono);font-size:12px;letter-spacing:4px;color:var(--tech-cyan);text-transform:uppercase;margin-bottom:8px}
.cq-nqi__title{position:relative;z-index:2;font-family:var(--font-display);font-size:clamp(20px,4vw,34px);color:var(--gold-light);text-shadow:3px 3px 0 var(--gold-deep);margin-bottom:26px;text-align:center;padding:0 20px}
.cq-nqi__dlg{position:relative;z-index:2;display:flex;align-items:flex-end;width:min(820px,92%);cursor:pointer}
.cq-nqi__port{width:132px;height:132px;flex:none;background:var(--panel-ink);border:3px solid var(--gold);box-shadow:inset 0 0 0 2px var(--gold-dark);overflow:hidden;margin-right:-6px;z-index:2}
.cq-nqi__port img{width:100%;height:100%;object-fit:cover;object-position:top}
.cq-nqi__box{flex:1;background:var(--panel-maroon);border:3px solid var(--gold);box-shadow:inset 0 0 0 2px var(--gold-dark),var(--drop-pixel);padding:18px 22px;min-height:120px}
.cq-nqi__name{font-family:var(--font-display);font-size:13px;color:var(--gold-light);text-shadow:2px 2px 0 var(--gold-deep);margin-bottom:10px}
.cq-nqi__name .sub{font-family:var(--font-mono);font-size:10px;color:var(--ink-muted);text-shadow:none;margin-left:6px}
.cq-nqi__txt{font-family:var(--font-ui);font-size:20px;line-height:1.5;color:var(--ink)}
.cq-nqi__cta{position:relative;z-index:2;display:flex;gap:14px;margin-top:26px;flex-wrap:wrap;justify-content:center}
.cq-nqi__back{position:absolute;top:18px;left:18px;z-index:3}

/* ============ SETUP SCREEN ============ */
.cq-setup{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
  background:radial-gradient(120% 90% at 50% 18%,#34281c 0%,#1a120c 60%,#0c0907 100%);z-index:40;overflow:hidden}
.cq-setup__panel{width:min(680px,92%);padding:28px 32px 24px;z-index:2;position:relative}
.cq-setup__section{margin-bottom:22px}
.cq-setup__label{font-family:var(--font-mono);font-size:11px;letter-spacing:2px;color:var(--gold);
  text-transform:uppercase;margin-bottom:10px}
.cq-setup__input{width:100%;font-family:var(--font-ui);font-size:20px;color:var(--ink);
  background:var(--panel-ink);border:2px solid var(--gold-dark);padding:10px 14px;
  outline:none;-webkit-font-smoothing:none}
.cq-setup__input:focus{border-color:var(--gold);box-shadow:0 0 0 1px var(--gold-dark)}
.cq-setup__input::placeholder{color:var(--ink-muted)}
.cq-setup__archs{display:flex;gap:14px}
.cq-setup__arch{flex:1;padding:16px 12px 14px;background:var(--panel-bg-2);border:2px solid var(--panel-ink);
  cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:8px;
  transition:border-color .1s,background .1s}
.cq-setup__arch:hover{border-color:var(--gold-dark);background:rgba(232,194,90,.06)}
.cq-setup__arch.sel{border-color:var(--gold);background:rgba(232,194,90,.12);
  box-shadow:0 0 0 1px var(--gold-dark)}
/* Sprite preview: 60Ã—90 viewport showing the first frame (0% 0%) of the 4-colÃ—2-row sheet */
/* Setup role preview: ONE static idle frame (row 1, col 1) of the 4x4 fixed sheet.
   Square box matches the square sheet cell so the sprite isn't distorted; no animation. */
.cq-setup__arch-sprite{width:92px;height:92px;margin:0 auto 4px;background-repeat:no-repeat;
  background-size:400% 400%;background-position:0% 0%;image-rendering:pixelated}
.cq-setup__arch-name{font-family:var(--font-display);font-size:10px;color:var(--gold-light);
  text-shadow:1px 1px 0 var(--gold-deep);text-align:center;line-height:1.5}
.cq-setup__arch-desc{font-family:var(--font-ui);font-size:13px;color:var(--ink-muted);
  text-align:center;line-height:1.5}
.cq-setup__foot{display:flex;justify-content:center;margin-top:6px}
.cq-setup__foot .cq-btn{min-width:220px}

/* ============ PLAYER WALK BOB (fallback â€” no walk-cycle frames yet) ============ */
/* Only animates when the engine adds .cq-actor--walk; idle has no animation. */
.cq-actor--walk .cq-actor__sprite{position:relative;animation:cqwalkbob 0.22s linear infinite alternate}
@keyframes cqwalkbob{from{margin-top:0}to{margin-top:-3px}}

/* ============ CAT HEART (petCat feedback) ============ */
.cq-cat-heart{position:absolute;left:50%;bottom:100%;transform:translateX(-50%);
  font-family:var(--font-mono);font-size:14px;color:var(--hp);letter-spacing:2px;
  pointer-events:none;z-index:15;white-space:nowrap;
  animation:cqheartrise 1.4s ease-out both}
@keyframes cqheartrise{
  0%  {opacity:1;transform:translateX(-50%) translateY(0)}
  100%{opacity:0;transform:translateX(-50%) translateY(-34px)}
}

/* ============ COLLISION DEBUG OVERLAY (toggle with C key â€” dev only) ============ */
.cq-dbg{position:absolute;inset:0;pointer-events:none;z-index:13}
.cq-dbg__rect{position:absolute;background:rgba(255,60,40,0.25);border:1px solid rgba(255,90,40,0.85);box-sizing:border-box}
.cq-dbg__entry{position:absolute;border-radius:50%;background:rgba(0,220,200,0.18);border:2px solid rgba(0,220,200,0.85);box-sizing:border-box;transform:translate(-50%,-50%)}
.cq-dbg__player{position:absolute;width:8px;height:8px;border-radius:50%;background:#fff;border:2px solid #000;box-sizing:border-box;transform:translate(-50%,-50%);z-index:14}
.cq-dbg__label{position:absolute;font-family:var(--font-mono);font-size:9px;color:rgba(255,220,100,0.9);transform:translate(-50%,-100%);white-space:nowrap;text-shadow:1px 1px 0 #000;pointer-events:none}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .cq-prompt__key,.cq-dock.ready .cq-boat__img,.cq-catm__stage img,.cq-badge__rays,
  .cq-actor--walk .cq-actor__sprite,.cq-cat-heart,.cq-lake__waves{animation:none}
}

