/* Cairn Quest: dusk highland survey. Scoped to .cq so the site frame is untouched. */
.cq{--ink:#e9e2d0;--mut:#a7b0a2;--gold:#f2bf62;--bg:#17211b;--bg2:#1f2c25;--edge:#3a4b40;--bad:#ff8466;
  color:var(--ink);font:500 15px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;padding-bottom:env(safe-area-inset-bottom);
  -webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
.cq *{box-sizing:border-box}
.cq button{font:inherit;color:var(--ink);background:var(--bg2);border:2px solid var(--edge);border-bottom-width:4px;border-radius:10px;
  min-height:48px;min-width:48px;padding:0 14px;cursor:pointer;touch-action:manipulation}
.cq button:active{transform:translateY(2px);border-bottom-width:2px}
.cq button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.cq button[disabled]{opacity:.45;cursor:default}
.cq-top{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.cq-name{flex:1;min-width:0;text-align:center;font-weight:800;font-size:1.05rem;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cq-stat{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:8px}
.cq-stat span{background:var(--bg);border:1px solid var(--edge);border-radius:8px;padding:6px 4px;text-align:center;font-size:.8rem;color:var(--mut);white-space:nowrap}
.cq-stat b{display:block;color:var(--ink);font-size:1rem}
.cq-field{position:relative;min-height:300px;display:flex;justify-content:center;align-items:flex-start;background:var(--bg);border:2px solid var(--edge);border-radius:12px;padding:6px;overflow:hidden}
#cq-canvas{display:block;touch-action:none;border-radius:8px;cursor:pointer;max-width:100%}
.cq-ovl{position:absolute;inset:0;z-index:3;display:none;flex-direction:column;align-items:center;gap:10px;padding:18px 14px;overflow-y:auto;
  background:rgba(16,24,19,.94);text-align:center;overscroll-behavior:contain}
.cq-ovl.on{display:flex}
.cq-ovl h2{font-size:1.9rem;font-weight:900;letter-spacing:.04em;color:var(--gold);line-height:1.1;margin:4px 0 0}
.cq-ovl h3{font-size:1.2rem;font-weight:800;color:var(--ink)}
.cq-ovl p{color:var(--mut);max-width:30em}
.cq-ovl .row{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;width:100%}
.cq-ovl .big{flex:1 1 100%;min-height:56px;font-weight:800;font-size:1.1rem;background:var(--gold);color:#1a1d14;border-color:#a47a2c}
.cq-ovl .row button{flex:1 1 40%}
.cq-hint{min-height:2.8em;margin:8px 2px;color:var(--mut);font-size:.9rem}
.cq-hint.warn{color:var(--bad)}
.cq-bar{display:grid;grid-template-columns:1fr 1.6fr 1fr 1fr;gap:6px}
.cq-bar button{padding:0 6px}
.cq-bar #cq-run[aria-pressed=true]{border-color:var(--gold);color:var(--gold)}
.cq-bar .go{background:var(--gold);color:#1a1d14;border-color:#a47a2c;font-weight:900;font-size:1.15rem;letter-spacing:.06em;min-height:60px}
.cq-tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;width:100%}
.cq-tabs button{padding:0 4px;font-size:.8rem;min-height:48px}
.cq-tabs button[aria-selected=true]{border-color:var(--gold);color:var(--gold)}
.cq-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;width:100%}
.cq-grid button{padding:2px;min-height:54px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-weight:700}
.cq-pips{display:flex;gap:2px;height:6px}
.cq-pips i{width:6px;height:6px;border-radius:50%;background:#34443a}
.cq-pips i.on{background:var(--gold)}
.cq-big-stars{display:flex;gap:10px;justify-content:center;margin:2px 0}
.cq-big-stars i{width:30px;height:30px;background:#34443a;clip-path:polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%)}
.cq-big-stars i.on{background:var(--gold)}
.cq-note{color:var(--gold)!important;font-weight:700}
.cq-lore{margin-top:18px;color:#c3cbbf}
.cq-lore h2{font-size:1.2rem;margin:14px 0 6px}
.cq-lore p{margin:0 0 10px;font-size:.92rem}
@media (prefers-reduced-motion:reduce){.cq *{transition:none!important;animation:none!important}.cq button:active{transform:none}}
/* Full screen: the stage becomes a flex column; the board takes what is left. */
html.pip-immersive .game-wrap.pip-stage,html.pip-native .game-wrap.pip-stage,.game-wrap.pip-stage:fullscreen{display:flex;flex-direction:column;padding:6px 8px calc(6px + env(safe-area-inset-bottom));overflow:hidden}
html.pip-immersive .pip-stage>.cq,html.pip-native .pip-stage>.cq,.pip-stage:fullscreen>.cq{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;padding-bottom:0}
html.pip-immersive .cq-field,html.pip-native .cq-field,.pip-stage:fullscreen .cq-field{flex:1 1 0;min-height:0;align-items:center}
html.pip-immersive .cq-lore,html.pip-native .cq-lore,.pip-stage:fullscreen .cq-lore{display:none}
html.pip-immersive .cq-hint,html.pip-native .cq-hint{margin:4px 0;min-height:0}
html.pip-immersive .game-wrap.pip-stage~.ad-well,html.pip-immersive .game-header+.ad-well{display:none}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .pip-stage>.cq,html.pip-native .pip-stage>.cq{display:grid;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:auto auto 1fr auto;column-gap:10px}
  html.pip-immersive .cq-field,html.pip-native .cq-field{grid-column:1;grid-row:1/5}
  html.pip-immersive .cq-top,html.pip-immersive .cq-stat,html.pip-immersive .cq-hint,html.pip-immersive .cq-bar,
  html.pip-native .cq-top,html.pip-native .cq-stat,html.pip-native .cq-hint,html.pip-native .cq-bar{grid-column:2}
  html.pip-immersive .cq-stat,html.pip-native .cq-stat{grid-template-columns:repeat(2,1fr)}
  html.pip-immersive .cq-bar,html.pip-native .cq-bar{grid-template-columns:1fr 1fr}
  html.pip-immersive .cq-bar .go,html.pip-native .cq-bar .go{grid-column:1/3}
}
