/* ===== shared by all challenge pages: header badges, answer box, Field Kit ===== */
.ch-head .ch-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 8px; font-size: 13px; }
.lvl { border-radius: 999px; padding: 2px 10px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.lvl-basics.lvl { color: #5ab8ff; } .lvl-easy.lvl { color: #2ee88a; } .lvl-medium.lvl { color: #ffd23f; } .lvl-hard.lvl { color: #ff5a5a; } .lvl-psyduck.lvl { color: #ffcf33; } .lvl-psycho.lvl { color: #c77dff; text-shadow: 0 0 10px #c77dff; }

/* mission map on the briefing */
.mission-map { margin-block-start: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: rgba(0, 0, 0, .25); }
.mission-map ol { margin: 8px 0 0; padding-inline-start: 22px; display: grid; gap: 4px; }
.mission-map li { display: flex; gap: 8px; align-items: center; }
.mm-icon { width: 24px; text-align: center; }
.mm-lvl { margin-inline-start: auto; }

.answer-box { align-items: stretch; }
.warn-text { color: var(--warn); }

/* ===== Field Kit (mobile DevTools) ===== */
.fk-toggle {
  position: fixed; inset-inline-end: 14px; bottom: 14px; z-index: 960; width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--panel); font-size: 26px; cursor: pointer; box-shadow: var(--glow);
}
.fk-toggle.open { display: none; }
.fk-toggle.pulse { animation: pulse 1.2s infinite; }
.fieldkit {
  position: fixed; inset-inline: 0; bottom: 0; height: 56vh; z-index: 950; display: flex; flex-direction: column;
  background: #0b0d10; color: #d7e0ea; border-block-start: 2px solid var(--accent); font-family: Consolas, ui-monospace, monospace;
  font-size: 13px; box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); text-align: left;
}
.fieldkit.full { height: calc(100vh - 20px); }
.fk-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #15191f; flex-wrap: nowrap; }
.fk-head strong { white-space: nowrap; color: var(--accent); font-family: var(--font-ui); }
.fk-tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.fk-tab { background: none; border: none; color: #9aa7b6; padding: 8px 10px; font: inherit; cursor: pointer; border-block-end: 2px solid transparent; white-space: nowrap; }
.fk-tab.on { color: #fff; border-color: var(--accent); }
.fk-btn { background: #222831; color: #d7e0ea; border: 1px solid #333c48; border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer; flex: none; }
.fk-head .fk-btn:last-child { background: #7a1f1f; border-color: #ff8080; color: #fff; font-weight: 700; min-width: 40px; min-height: 36px; }
.fk-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 6px; gap: 6px; overflow: hidden; }
.fk-out { flex: 1; overflow-y: auto; }
.fk-line { margin: 0; padding: 3px 4px; border-block-end: 1px solid #1c2129; white-space: pre-wrap; word-break: break-word; font: inherit; }
.fk-warn { color: #ffd479; background: #2a2410; } .fk-error { color: #ff8a8a; background: #2a1212; }
.fk-input { color: #8ab4ff; } .fk-result { color: #b5f5c9; }
.fk-prompt { display: flex; gap: 6px; align-items: stretch; }
textarea.fk-input, .fk-field { flex: 1; min-width: 0; background: #11151a; color: #e8eef5; border: 1px solid #333c48; border-radius: 6px; padding: 8px; font: inherit; font-size: 16px; }
.fk-small { flex: 0 1 120px; }
.fk-run { background: var(--accent); color: #000; border: none; border-radius: 6px; padding: 0 16px; font-size: 18px; cursor: pointer; }
.fk-row { display: flex; gap: 6px; align-items: center; }
.fk-code { flex: 1; min-height: 60px; overflow: auto; margin: 0; background: #11151a; border-radius: 6px; padding: 8px; white-space: pre; font: inherit; }
.fk-style { flex: 0 0 auto; max-height: 120px; }
.fk-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.fk-scroll h4 { margin: 6px 0 0; color: var(--accent); }
.fk-kv { border: 1px solid #262d37; border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.fk-kv code { color: #ffd479; word-break: break-all; }
.fk-req { display: flex; gap: 10px; text-align: left; background: #11151a; color: #d7e0ea; border: 1px solid #262d37; border-radius: 6px; padding: 8px; font: inherit; cursor: pointer; }
.fk-st { color: var(--ok); min-width: 32px; }
.fk-muted { color: #7b8794; margin: 0; }
body.fk-open #app { padding-bottom: 60vh; }


@media (max-width: 720px) {
  .inline-form .input { min-width: 0; flex: 1 1 100%; }
  .inline-form .btn { flex: 1 1 auto; }
}

/* layering: modals & toasts above the Field Kit, live attack below it (the console must stay usable) */
.modal-overlay { z-index: 970; }
#toast-root { z-index: 975; }


/* psyduck: the true story after solving */
.real-story { border-color: #ffcf33; box-shadow: 0 0 24px rgba(255, 207, 51, .25); }
.real-story h3 { color: #ffcf33; margin-block-start: 0; }

/* quest map */
.quest-map { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.quest-map li { display: flex; gap: 8px; align-items: center; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 10px; color: var(--muted); }
.quest-map li.done { border-style: solid; border-color: var(--ok); color: var(--fg); }
.quest-icon { font-size: 20px; }
.quest-progress { font-weight: 700; color: var(--accent); }
.relic-box { text-align: center; }
.relic-code { display: inline-block; font-size: 18px; border: 1px dashed var(--ok); border-radius: 8px; padding: 6px 12px; user-select: all; }

/* project explorer (Android challenges) */
.file-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 8px; }
.file-tab { background: transparent; border: 1px solid var(--border); border-radius: 8px; color: inherit; padding: 5px 10px; cursor: pointer; font-family: "Share Tech Mono", monospace; font-size: .85rem; }
.file-tab.on { background: rgba(127, 127, 127, .25); }

/* several answers in one form */
.answer-form { display: flex; flex-direction: column; gap: 10px; }
.answer-field { display: flex; flex-direction: column; gap: 4px; }

/* study mode + "learn first" links */
.study-banner { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; padding: 8px 14px; background: rgba(0, 255, 156, .12); border-bottom: 1px solid rgba(0, 255, 156, .4); font-size: 14px; }
.study-banner a { color: var(--accent2, #00ff9c); font-weight: 600; }
.prep-box { margin: 14px 0; padding: 12px 14px; border: 1px dashed rgba(0, 255, 156, .45); border-radius: 12px; background: rgba(0, 255, 156, .05); text-align: start; }
.prep-box p { margin: 4px 0 8px; font-size: 14px; }
.prep-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.prep-link { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; border: 1px solid rgba(0, 255, 156, .45); color: inherit; text-decoration: none; font-size: 14px; }
.prep-link:hover { background: rgba(0, 255, 156, .14); }
.prep-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 14px; opacity: .9; }
.lobby-overlay .prep-box { max-width: 520px; margin-inline: auto; }

/* picture challenges: a canvas you can zoom into */
.vis-wrap { overflow: hidden; border-radius: 12px; line-height: 0; box-shadow: 0 4px 22px rgba(0, 0, 0, .45); }
.vis-canvas { width: 100%; height: auto; display: block; cursor: zoom-in; transition: transform .25s ease; touch-action: manipulation; }
.vis-wrap.zoomed .vis-canvas { transform: scale(2.5); cursor: zoom-out; }
.vis-tip { font-size: 13px; margin: 6px 0 0; }
