/* =========================================================
   Bug Detectives: styles
   ========================================================= */

/* ---------- fonts ---------- */
@font-face { font-family: "PS2P"; src: url("../fonts/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "HJ"; font-weight: 700; src: url("../fonts/handjet-700.woff2") format("woff2"); }

/* ---------- colours ---------- */
:root {
  --bg:        #040806;   /* page background        */
  --panel:     #0a140d;   /* cards and panels       */
  --line:      #1c5a31;   /* outlines               */
  --dim:       #5fae7a;   /* secondary text         */
  --text:      #c9ffd8;   /* main text              */
  --face:      #0d1f13;   /* button / tile face     */
  --lip:       #1c5a31;   /* button / tile lip      */
  --ink:       #020403;   /* darkest                */
  --green:     #39ff7a;   /* main accent            */
  --green-dk:  #16a346;
  --amber:     #ffb300;   /* highlights, star       */
  --red:       #ff4d6d;   /* crashes, bugs          */
  --cyan:      #5ff3ff;
  --glow:      0 0 14px rgba(57, 255, 122, .35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: "PS2P", monospace; user-select: none;
}
#bg       { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 0; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#scan     { position: fixed; inset: 0; pointer-events: none; z-index: 7;
            background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.18) 2px 4px); }

/* the whole game is a fixed 1280x720 stage, scaled to fit the window */
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: center; z-index: 1; }

.screen    { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; }
.screen.on { display: flex; animation: screenIn .45s cubic-bezier(.2,.8,.2,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.row { display: flex; gap: 14px; align-items: center; }

/* pixel-cut corners */
.px {
  clip-path: polygon(0 6px,6px 6px,6px 0,calc(100% - 6px) 0,calc(100% - 6px) 6px,100% 6px,100% calc(100% - 6px),
    calc(100% - 6px) calc(100% - 6px),calc(100% - 6px) 100%,6px 100%,6px calc(100% - 6px),0 calc(100% - 6px));
}

/* ---------- headings ---------- */
/* filter: drop-shadow is used instead of text-shadow so the shadow
   doesn't show hairline seams on macOS */
.title {
  font-family: "HJ"; font-weight: 700; font-size: 132px; letter-spacing: 4px; line-height: 1;
  color: var(--green); -webkit-font-smoothing: antialiased;
  filter: drop-shadow(6px 6px 0 #0c2a16) drop-shadow(0 0 14px rgba(57,255,122,.35));
}
.title .amber      { color: var(--amber); }
.title:has(.amber) { filter: drop-shadow(6px 6px 0 #3a2a00) drop-shadow(0 0 14px rgba(255,179,0,.35)); }
.h2 {
  font-family: "HJ"; font-weight: 700; font-size: 56px; letter-spacing: 2px; line-height: 1;
  color: var(--green); -webkit-font-smoothing: antialiased;
  filter: drop-shadow(4px 4px 0 #0c2a16) drop-shadow(0 0 10px rgba(57,255,122,.3));
}
.sub { font-size: 15px; color: var(--dim); margin-top: 34px; letter-spacing: 2px; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-size: 15px; line-height: 1; cursor: pointer; border: none;
  height: 58px; padding: 0 18px 6px;                       /* bottom padding = the 6px lip */
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--green); background: var(--face);
  box-shadow: inset 0 -6px 0 var(--lip), inset 0 0 0 3px var(--line);
  clip-path: polygon(0 4px,4px 4px,4px 0,calc(100% - 4px) 0,calc(100% - 4px) 4px,100% 4px,100% calc(100% - 4px),
    calc(100% - 4px) calc(100% - 4px),calc(100% - 4px) 100%,4px 100%,4px calc(100% - 4px),0 calc(100% - 4px));
  transition: background-color .18s ease, box-shadow .22s ease, color .18s ease,
              transform .18s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
.btn span { display: block; padding-top: 3px; }
.btn svg  { width: 16px; height: 16px; display: block; flex: none; }
.btn:hover                 { background: #133120; box-shadow: inset 0 -6px 0 var(--lip), inset 0 0 0 3px var(--green), var(--glow); }
.btn:hover:not(:disabled)  { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(2px); transition-duration: .06s; }
.btn:disabled              { opacity: .4; cursor: default; }

.btn.big     { font-size: 20px; height: 76px; padding: 0 38px 6px; gap: 16px; }
.btn.big svg { width: 20px; height: 20px; }

.btn.go       { background: var(--green); color: var(--ink); box-shadow: inset 0 -6px 0 var(--green-dk), inset 0 0 0 3px var(--ink); }
.btn.go:hover { background: #7dffa6; box-shadow: inset 0 -6px 0 var(--green-dk), var(--glow); }

.mute { position: fixed; right: 16px; bottom: 14px; z-index: 6; font-size: 10px; height: 40px; padding: 0 14px 6px; }
.keys { position: fixed; left: 16px; bottom: 18px; z-index: 6; font-size: 9px; color: #2f5c3d; }

/* ---------- intro + method screens ---------- */
.bubble {
  background: var(--panel); color: var(--text); padding: 34px 40px; margin-top: 40px; max-width: 960px;
  font-size: 18px; line-height: 2; text-align: center; outline: 3px solid var(--line); outline-offset: -3px;
}
.hl-amber { color: var(--amber); }
.hl-green { color: var(--green); }

.bigsteps { display: flex; gap: 28px; margin-top: 46px; }
.bigstep {
  width: 300px; padding: 30px 20px 32px; text-align: center;
  background: var(--panel); outline: 3px solid var(--line); outline-offset: -3px;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), outline-color .25s ease;
}
.bigstep:hover { transform: translateY(-4px); outline-color: var(--green); }
.bigstep .num {
  width: 64px; height: 64px; margin: 0 auto 20px; padding-top: 4px; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: var(--ink);
}
.bigstep:nth-child(2) .num { background: var(--amber); }
.bigstep:nth-child(3) .num { background: var(--cyan); }
.bigstep b { font-size: 20px; display: block; margin-bottom: 14px; }
.bigstep p { font-size: 12px; line-height: 1.8; color: var(--dim); }
.question  { font-size: 18px; margin-top: 40px; color: var(--amber); line-height: 1.8; text-align: center; }

/* ---------- game screen ---------- */
#game   { justify-content: flex-start; padding-top: 30px; }
.topbar { width: 1180px; display: flex; justify-content: space-between; align-items: center; }
.pill   { font-size: 13px; line-height: 1; padding: 12px 16px 10px; color: var(--ink); background: var(--green); }
.pill b { color: #b0002a; }
.main   { display: flex; gap: 40px; margin-top: 24px; width: 1180px; align-items: flex-start; }
.side   { flex: 1; display: flex; flex-direction: column; gap: 20px; }

/* board */
.boardwrap {
  background: var(--panel); padding: 10px;
  outline: 3px solid var(--line); outline-offset: -3px; box-shadow: 8px 8px 0 rgba(0,0,0,.35);
}
.board { width: 440px; height: 440px; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); position: relative; }
.cell        { position: relative; transition: background .35s ease, box-shadow .35s ease; }
.cell.a      { background: #08140c; }
.cell.b      { background: #0b1a10; }
.cell.trail  { background: #123c20 !important; box-shadow: inset 0 0 0 1px #1f7a3e; }
.cell.rock::after {
  content: ""; position: absolute; inset: 10px; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23020403' d='M2 1h4v1h1v1h1v4h-1v1H1v-1H0V3h1V2h1z'/%3E%3Cpath fill='%23355c42' d='M2 2h4v1h1v3H6v1H2V6H1V3h1z'/%3E%3Cpath fill='%235f9a72' d='M2 3h2v1H3v1H2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* alien + star */
.sprite {
  position: absolute; width: 76px; height: 76px; image-rendering: pixelated; pointer-events: none; z-index: 3;
  transition: left .4s cubic-bezier(.34,1.35,.64,1), top .4s cubic-bezier(.34,1.35,.64,1);
}
.sprite svg { width: 100%; height: 100%; display: block; }
#alien { filter: drop-shadow(0 0 6px rgba(57,255,122,.45)); }
#star  { z-index: 2; animation: bob 1.6s ease-in-out infinite alternate; filter: drop-shadow(0 0 8px rgba(255,179,0,.6)); }
@keyframes bob   { from { transform: translateY(2px); } to { transform: translateY(-6px); } }
.shake           { animation: shake .4s ease-in-out 2; }
@keyframes shake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(-6px,0); } 75% { transform: translate(6px,0); } }

/* code tiles */
.card  { background: var(--panel); padding: 18px 20px 20px; outline: 3px solid var(--line); outline-offset: -3px; }
.label { font-size: 11px; color: var(--dim); letter-spacing: 1px; margin-bottom: 26px; line-height: 1.4; }
.code  { display: flex; flex-wrap: wrap; gap: 10px; }
.tile {
  width: 70px; height: 70px; position: relative; cursor: pointer; padding-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--face); box-shadow: inset 0 -6px 0 var(--lip), inset 0 0 0 3px var(--line);
  transition: background-color .18s ease, box-shadow .22s ease, transform .22s cubic-bezier(.34,1.56,.64,1);
}
.tile:hover   { transform: translateY(-3px); background: #133120; box-shadow: inset 0 -6px 0 var(--lip), inset 0 0 0 3px var(--green), var(--glow); }
.tile svg     { width: 36px; height: 36px; image-rendering: pixelated; }
.tile .n      { position: absolute; top: -19px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--dim); }
.tile.now     { background: #2a2000; box-shadow: inset 0 -6px 0 #6b4b00, inset 0 0 0 3px var(--amber), 0 0 16px rgba(255,179,0,.45); transform: translateY(-6px); }
.tile.bad     { background: #2a0610; box-shadow: inset 0 -6px 0 #6b0a20, inset 0 0 0 3px var(--red), 0 0 16px rgba(255,77,109,.5); animation: shake .4s ease-in-out 2; }
.tile.hint    { animation: hint .7s ease-in-out 4; }
@keyframes hint { 50% { box-shadow: inset 0 0 0 3px var(--amber), 0 0 18px rgba(255,179,0,.6); } }
.tile.changed::before { content: ""; position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; background: var(--green); }

/* message box */
.msg {
  min-height: 96px; font-size: 14px; line-height: 1.75; padding: 18px 20px;
  color: var(--text); background: var(--panel); border-left: 8px solid var(--line);
  transition: border-color .3s ease, color .3s ease;
}
.msg.pop  { animation: msgIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes msgIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.msg.win  { border-color: var(--green); color: var(--green); }
.msg.oops { border-color: var(--red); }
.msg .btn { margin-top: 14px; }
.icon     { display: inline-block; width: 30px; height: 30px; vertical-align: -8px; margin-right: 12px; animation: pop .5s cubic-bezier(.34,1.56,.64,1); }
.icon svg { width: 100%; height: 100%; display: block; }
.icon.star { filter: drop-shadow(0 0 6px rgba(255,179,0,.6)); }
@keyframes pop { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }

/* predict / test / fix */
.steps { display: flex; gap: 12px; }
.step {
  flex: 1; text-align: center; font-size: 10px; line-height: 1.5; padding: 14px 6px;
  background: var(--panel); color: #3f7a52;
  transition: background .3s ease, color .3s ease, box-shadow .3s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.step b       { display: block; font-size: 15px; color: var(--dim); margin-bottom: 8px; transition: color .3s ease; }
.step.lit     { transform: translateY(-3px); background: var(--green); color: var(--ink); box-shadow: var(--glow); }
.step.lit b   { color: var(--ink); }
