/* ===== Base: layout, RTL-safe (logical properties), components ===== */
:root {
  --bg: #050a08; --fg: #c8ffe0; --muted: #6f9c86; --accent: #00ff9c; --accent2: #00c3ff;
  --panel: rgba(4, 20, 14, 0.82); --border: rgba(0, 255, 156, 0.35); --danger: #ff3b5c; --ok: #24e08a; --warn: #ffb020;
  --font-ui: "Rubik", "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, Consolas, "Courier New", monospace;
  --radius: 10px; --glow: 0 0 18px rgba(0, 255, 156, 0.25);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 16px; line-height: 1.6;
  overflow-x: hidden; transition: background-color .6s, color .6s;
}
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
pre.ltr, div.ltr, code.ltr, input.ltr, table .ltr { display: block; text-align: left; }
input.ltr { display: inline-block; }
code, pre, .mono { font-family: var(--font-mono); }

#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bg-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ----- HUD ----- */
#hud {
  position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 8px 16px; padding-inline-end: 190px; background: var(--panel); border-block-end: 1px solid var(--border);
  backdrop-filter: blur(6px); font-size: 14px; transition: opacity .3s;
}
.hud-brand { font-weight: 700; letter-spacing: .06em; display: flex; gap: 8px; align-items: center; color: var(--accent); }
.hud-logo { font-size: 20px; }
.hud-agent { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hud-label { color: var(--muted); }
.hud-sep { color: var(--muted); }
.hud-op { color: var(--accent2); }
.hud-stats { display: flex; gap: 8px; margin-inline-start: auto; }
.hud-actions { display: flex; gap: 8px; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.pill-score { color: var(--accent); }

#corner-controls { position: fixed; top: 8px; inset-inline-end: 12px; z-index: 60; display: flex; gap: 6px; }
.icon-btn {
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px;
  cursor: pointer; font-family: var(--font-ui); font-size: 14px;
}
.icon-btn:hover { border-color: var(--accent); }

#sfx-indicator {
  position: fixed; bottom: 14px; inset-inline-start: 14px; z-index: 300; background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; opacity: 0; transform: translateY(8px); transition: .25s; pointer-events: none;
}
#sfx-indicator.show { opacity: 1; transform: none; }

/* ----- main ----- */
#app { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 28px 16px 80px; }
#app.enter { animation: stageIn .55s ease; }
@keyframes stageIn { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.boot-msg { text-align: center; padding: 80px 0; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-block-end: 18px;
  box-shadow: var(--glow); position: relative;
}
.panel h2, .panel h3 { margin-block: 0 10px; color: var(--accent); }
.story-panel h2 { font-size: 22px; }
.story-text { font-size: 17px; white-space: pre-wrap; }
.story-text.typing::after { content: "▌"; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1s steps(1) infinite; }

.btn {
  font-family: var(--font-ui); font-size: 15px; cursor: pointer; border-radius: 8px; padding: 8px 16px;
  background: transparent; color: var(--fg); border: 1px solid var(--border); transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-big { padding: 12px 26px; font-size: 18px; }
.btn-link { border: none; text-decoration: underline; color: var(--muted); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-block-start: 14px; }
.row-actions.center { justify-content: center; }

.input {
  font-family: var(--font-mono); font-size: 16px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0, 0, 0, .35); color: var(--fg); min-width: 0; flex: 1;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-block-start: 10px; }
.inline-form .input { min-width: 180px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-block: 10px; }
.field span { color: var(--muted); font-size: 14px; }

.code-box { background: rgba(0, 0, 0, .45); border: 1px dashed var(--border); border-radius: 8px; padding: 12px; margin-block: 10px; word-break: break-all; font-size: 15px; }

/* ----- login & briefing ----- */
.login-panel { max-width: 440px; margin: 6vh auto 0; text-align: center; }
.login-panel .field { text-align: start; }
.login-emblem { font-size: 56px; color: var(--accent); text-shadow: 0 0 24px var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.94); } }
.subtitle { color: var(--muted); }
.login-status { min-height: 26px; margin-block-start: 12px; font-family: var(--font-mono); color: var(--accent); }
.glitch { position: relative; font-size: 30px; letter-spacing: .04em; margin: 4px 0; }
.glitch-in { animation: glitchIn .7s ease; }
@keyframes glitchIn { 0% { opacity: 0; transform: skewX(20deg); filter: hue-rotate(90deg); } 40% { opacity: 1; transform: skewX(-8deg); } 100% { transform: none; filter: none; } }
.briefing-panel { max-width: 760px; margin: 0 auto; }
.stamp { position: absolute; top: 14px; inset-inline-end: 18px; border: 2px solid var(--danger); color: var(--danger); padding: 2px 10px; transform: rotate(-8deg); font-weight: 700; letter-spacing: .12em; }
.dossier { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-block: 12px 18px; }
.dossier-row { display: flex; flex-direction: column; background: rgba(0, 0, 0, .3); border-inline-start: 3px solid var(--accent); padding: 6px 10px; border-radius: 6px; }
.dossier-row span { color: var(--muted); font-size: 13px; }
.dossier-row.danger { border-color: var(--danger); }

/* ----- toast ----- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 18px; max-width: 90vw; opacity: 0; transform: translateY(10px); transition: .3s; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-color: var(--ok); color: var(--ok); }
.toast-error { border-color: var(--danger); color: var(--danger); }
.toast-warn { border-color: var(--warn); color: var(--warn); }

/* ----- modal ----- */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: .25s; }
.modal-overlay.show { opacity: 1; }
.modal { background: var(--bg); color: var(--fg); border: 1px solid var(--accent); border-radius: 12px; padding: 22px; width: min(560px, 100%); max-height: 88vh; overflow: auto; position: relative; box-shadow: 0 0 40px rgba(0, 0, 0, .6), var(--glow); }
.modal-title { margin-block: 0 12px; color: var(--accent); padding-inline-end: 30px; }
/* a big close button that stays at the top while the window scrolls */
.modal-x { position: sticky; top: -10px; float: inline-end; z-index: 3; margin: -8px -8px 6px 10px; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid currentColor; background: var(--bg); color: var(--fg); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.modal-x:hover, .modal-x:focus-visible { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-block-start: 16px; flex-wrap: wrap; }
.modal-cheat .modal { border-color: var(--danger); animation: shakeX .5s; }
.modal-cheat .modal-title { color: var(--danger); }
.modal-broadcast .modal { border-color: var(--accent2); }
.broadcast-text { font-size: 19px; white-space: pre-wrap; }
.broadcast-wave { height: 24px; background: repeating-linear-gradient(90deg, var(--accent2) 0 3px, transparent 3px 8px); opacity: .6; animation: wave 1s linear infinite; mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); }
@keyframes wave { to { background-position: 40px 0; } }

.hint-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-block-end: 10px; }
.hint-head { display: flex; justify-content: space-between; gap: 10px; }
.hint-cost { color: var(--warn); font-size: 13px; }
.hint-item.open { border-color: var(--accent); }
.morse-table { border-collapse: collapse; margin-block-start: 8px; width: 100%; direction: ltr; }
.morse-table td { border: 1px solid var(--border); padding: 2px 8px; font-family: var(--font-mono); }
.morse-code { letter-spacing: .25em; font-size: 18px; }
.vault-list { list-style: none; padding: 0; margin-block: 14px 0; }
.vault-list li { padding: 4px 0; color: var(--muted); }
.vault-list li.done { color: var(--ok); }

.shake { animation: shakeX .45s; }
@keyframes shakeX { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ----- confetti ----- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 500; overflow: hidden; }
.confetti-layer i { position: absolute; top: -12px; width: 8px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg) translateX(40px); } }

/* ----- freeze ----- */
.freeze-overlay { position: fixed; inset: 0; z-index: 1000; background: radial-gradient(circle, #0b1a2e, #000); color: #cfe8ff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; animation: flicker 3s infinite; }
.freeze-icon { font-size: 90px; animation: pulse 1.6s infinite; }
.freeze-overlay h1 { font-size: 36px; margin: 10px 0; }
@keyframes flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .5; } 98% { opacity: .9; } 99% { opacity: .4; } }

/* ----- live attack ----- */
.attack-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(30, 0, 0, .94); display: flex; align-items: center; justify-content: center; padding: 16px; animation: redPulse 1s infinite; }
@keyframes redPulse { 50% { background: rgba(70, 0, 0, .95); } }
.attack-overlay.defended { animation: none; background: rgba(0, 30, 10, .95); }
.attack-overlay.lost { animation: none; }
.attack-box { width: min(760px, 100%); border: 2px solid #ff3030; border-radius: 12px; background: #0a0000; color: #ffd0d0; padding: 22px; box-shadow: 0 0 60px rgba(255, 0, 0, .5); }
.defended .attack-box { border-color: var(--ok); box-shadow: 0 0 60px rgba(0, 255, 120, .4); }
.attack-header { display: flex; align-items: center; gap: 12px; color: #ff4040; }
.attack-header h1 { margin: 0; font-size: 30px; letter-spacing: .05em; }
.attack-header .blink { font-size: 38px; }
.attack-instr { color: #ffb3b3; }
.attack-status { font-family: var(--font-mono); color: #ff8080; }
.attack-bar { position: relative; height: 22px; border: 1px solid #ff3030; border-radius: 6px; overflow: hidden; background: #200; }
.attack-bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: repeating-linear-gradient(45deg, #ff2020 0 10px, #b00000 10px 20px); transition: width .9s linear; }
.attack-pct { position: absolute; inset-inline-end: 8px; top: 0; font-family: var(--font-mono); color: #fff; }
.attack-term { background: #000; color: #ff5050; height: 220px; overflow: hidden; padding: 10px; border-radius: 6px; margin-block: 12px; font-size: 13px; }
.attack-banner { display: block; width: 100%; margin-block-start: 14px; background: #3a0000; color: #ffdddd; border: 2px solid #ff2a2a; border-radius: 8px; padding: 12px; font-size: 15px; cursor: pointer; font-family: var(--font-ui); animation: bannerBlink 1s infinite; }
@keyframes bannerBlink { 50% { background: #8a0000; box-shadow: 0 0 20px #f00; } }

.interstitial p { font-size: 18px; }

/* ----- shared code / log viewers ----- */
.log-view { background: #000; color: #b5f5c9; max-height: 340px; overflow: auto; padding: 10px; border-radius: 8px; font-size: 13px; line-height: 1.5; border: 1px solid var(--border); white-space: pre; }
.code-view { background: #0b0f14; color: #9cdcfe; padding: 14px; border-radius: 8px; font-size: 14px; border: 1px solid var(--border); overflow: auto; }

/* ----- certificate ----- */
.certificate { position: relative; background: linear-gradient(135deg, #0b1320, #101a2b); color: #e8f0ff; border: 3px double #d4af37; border-radius: 14px; padding: 34px 28px; text-align: center; box-shadow: 0 0 40px rgba(212, 175, 55, .25); margin-block-end: 18px; }
.cert-seal { font-size: 60px; color: #d4af37; text-shadow: 0 0 20px #d4af37; }
.cert-top { letter-spacing: .25em; text-transform: uppercase; color: #d4af37; }
.cert-name { font-size: 38px; margin: 10px 0; }
.cert-rank { display: inline-block; font-size: 22px; font-weight: 700; padding: 4px 18px; border-radius: 999px; border: 2px solid; margin-block-end: 8px; }
.rank-junior { color: #7fd0ff; } .rank-specialist { color: #b48bff; } .rank-shadow { color: #ffd54a; text-shadow: 0 0 12px #ffd54a; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-block: 20px; }
.cert-grid div { display: flex; flex-direction: column; background: rgba(255, 255, 255, .05); border-radius: 8px; padding: 8px; }
.cert-grid span { font-size: 13px; color: #9fb0cc; }
.cert-grid strong { font-size: 20px; }
.cert-footer { display: flex; justify-content: space-between; color: #9fb0cc; border-block-start: 1px solid rgba(212, 175, 55, .4); padding-block-start: 10px; }

.error-panel pre { white-space: pre-wrap; }

/* Hebrew: monospace cyber fonts have no Hebrew glyphs - use the UI font */
html[lang="he"] body { font-family: var(--font-ui); }

@media (max-width: 720px) {
  #hud { padding: 46px 10px 8px; gap: 6px 10px; font-size: 13px; }
  .hud-brand > :not(.hud-menu-btn) { display: none; }
  .hud-stats { margin-inline-start: 0; flex-wrap: wrap; }
  .hud-actions { width: 100%; }
  .hud-actions .btn { flex: 1; }
  #app { padding: 14px 10px 90px; }
  .panel { padding: 14px; }
  .story-text { font-size: 16px; }
  .story-panel h2 { font-size: 19px; }
  .modal { padding: 16px; max-height: 92vh; }
  .modal-actions .btn { flex: 1; }
  .glitch { font-size: 24px; }
  .login-panel { margin-top: 2vh; }
  .log-view { font-size: 11px; }
  .code-view { font-size: 12px; }
  .lobby-count, .timeup-score { font-size: 44px; }
  .freeze-overlay h1 { font-size: 26px; }
  .attack-box { padding: 14px; }
  .attack-header h1 { font-size: 20px; }
  .attack-term { height: 150px; font-size: 11px; }
  .cert-name { font-size: 28px; }
  .certificate { padding: 24px 14px; }
  #sfx-indicator { bottom: 78px; }
  .row-actions .btn-big { width: 100%; }
}

@media print {
  body { background: #fff !important; }
  #hud, #corner-controls, #bg-canvas, #bg-fx, #toast-root, #sfx-indicator, .no-print, .confetti-layer { display: none !important; }
  #app { padding: 0; max-width: none; }
  .certificate { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; margin-top: 30px; }
}

/* ===== events / timer / debrief ===== */
.pill-timer { color: var(--accent2); font-family: var(--font-mono); }
.pill-timer.urgent { color: var(--danger); border-color: var(--danger); animation: blink 1s steps(1) infinite; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-size: 22px; text-align: center !important; }
.orders { margin-block-start: 16px; border: 1px dashed var(--accent2); border-radius: 8px; padding: 10px 14px; background: rgba(0, 0, 0, .25); }
.orders strong { color: var(--accent2); }
.orders p { margin: 6px 0 0; white-space: pre-wrap; }
.lobby-overlay { background: radial-gradient(circle, #06202e, #000); animation: none; }
.lobby-count, .timeup-score { font-family: var(--font-mono); font-size: 64px; color: var(--accent, #00e5ff); text-shadow: 0 0 24px currentColor; }
.timeup-overlay { background: radial-gradient(circle, #2a1600, #000); animation: none; }
.timeup-score { color: #ffd54a; }
.debrief h2 { margin-block-end: 4px; }
.muted-text { color: var(--muted); margin-block-start: 0; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-block: 12px; }
.skill { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: rgba(0, 0, 0, .2); }
.skill p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.skill.locked { opacity: .5; }
.skill.ok { border-color: var(--ok); }
.skill-icon { font-size: 20px; }
.ethics { border-inline-start: 3px solid var(--warn); padding-inline-start: 10px; color: var(--fg); font-size: 14px; }

/* Google sign-in + personal hub */
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-block: 16px 10px; font-size: 14px; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-block-start: 1px solid var(--border); }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #1f1f1f; border-color: #dadce0; font-weight: 500; padding: 10px 16px; }
.btn-google:hover:not(:disabled) { background: #f6f8fc; border-color: #c4c7c5; box-shadow: none; }
.google-panel { max-width: 580px; text-align: start; padding-block: 22px 14px; }
.g-head { display: flex; align-items: center; gap: 14px; }
.g-avatar { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; color: var(--bg); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: var(--glow); }
.g-who { min-width: 0; }
.g-hi { font-size: 24px; margin: 0; line-height: 1.2; }
.g-via { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-block-start: 4px; overflow-wrap: anywhere; }
.g-via svg { width: 14px; height: 14px; flex: none; }
.g-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block: 16px 4px; }
.g-stat { display: flex; flex-direction: column; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0, 0, 0, .3); }
.g-stat strong { font-size: 26px; color: var(--accent); line-height: 1.2; }
.g-stat span { font-size: 13px; color: var(--muted); }
.g-section { margin-block-start: 14px; padding-block-start: 14px; border-block-start: 1px dashed var(--border); }
.g-section h3 { margin: 0; color: var(--accent); font-size: 18px; }
.g-sub { margin: 2px 0 10px; color: var(--muted); font-size: 14px; }
.g-join .inline-form { margin: 0; flex-wrap: nowrap; }
.g-join .code-input { flex: 1; min-width: 0; font-size: 18px; letter-spacing: .2em; text-transform: uppercase; }
.g-join .code-input::placeholder { letter-spacing: normal; text-transform: none; font-family: var(--font-ui); font-size: 15px; }
.g-join .btn { flex: none; }
.g-tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.g-track { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, .35); color: var(--fg); cursor: pointer; font: inherit; transition: border-color .2s, box-shadow .2s, transform .2s; }
.g-track:hover { border-color: var(--accent); box-shadow: var(--glow); transform: translateY(-2px); }
.g-track-icon { font-size: 30px; line-height: 1.1; }
.g-track strong { color: var(--accent); font-size: 17px; }
.g-track-desc { color: var(--muted); line-height: 1.45; flex: 1; }
.g-track-meta { color: var(--accent2); }
.g-track-progress { display: flex; flex-direction: column; gap: 4px; width: 100%; font-size: 13px; }
.g-track-progress > span { direction: ltr; unicode-bidi: isolate; align-self: flex-start; }
.g-track-progress b { display: block; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.g-track-progress i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .5s; }
.g-track-go { align-self: stretch; margin-block-start: 6px; text-align: center; padding: 6px; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 700; font-size: 14px; }
.google-panel .login-status:empty { display: none; }
.g-foot { display: flex; justify-content: center; align-items: center; gap: 4px; flex-wrap: wrap; margin-block-start: 16px; }
.g-foot .btn-link { font-size: 14px; padding: 4px 6px; }
.g-dot { color: var(--muted); }
@media (max-width: 480px) {
  .google-panel { padding-inline: 14px; margin-block-start: 52px; }
  .g-hi { font-size: 21px; }
  .g-avatar { width: 46px; height: 46px; font-size: 22px; }
}
/* classes in the personal hub */
.g-classes h4 { margin: 12px 0 6px; color: var(--muted); font-size: 14px; }
.g-class-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 8px; }
.g-class-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent2); color: var(--accent2); border-radius: 999px; padding: 3px 6px 3px 12px; font-weight: 500; }
[dir="rtl"] .g-class-chip { padding: 3px 12px 3px 6px; }
.g-class-x { border: none; background: rgba(255, 255, 255, .08); color: var(--muted); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; }
.g-class-x:hover { background: var(--danger); color: #fff; }
.g-missions { display: flex; flex-direction: column; gap: 8px; }
.g-mission { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--fg); cursor: pointer; font: inherit; transition: box-shadow .2s; }
.g-mission:hover { box-shadow: var(--glow); }
.g-mission-icon { font-size: 20px; }
.g-mission-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.g-mission-body small { color: var(--muted); }
.g-mission-go { flex: none; padding: 5px 12px; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 700; font-size: 14px; }
/* small link to the teacher dashboard under the login form */
.teacher-link { display: block; text-align: center; margin-block-start: 10px; font-size: 13px; color: var(--muted); opacity: .75; }
.teacher-link:hover { opacity: 1; color: var(--accent); }
.duel-link { display: block; text-align: center; margin-block-start: 12px; font-weight: 700; color: var(--accent); }

/* page note for automated assistants: part of the page text, not visible, not read aloud */
.sr-note { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* logo */
.login-logo { display: block; margin: 0 auto 6px; filter: drop-shadow(0 0 14px rgba(0, 255, 156, .35)); }

/* First Quest wordmark */
.brand-word { font-family: Rubik, 'Segoe UI', Arial, sans-serif; font-weight: 800; letter-spacing: .2em; font-size: 22px; text-align: center; color: #e6ebf5; direction: ltr; }
.brand-word span { background: linear-gradient(90deg, #00ff9c, #3ea6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-word.small { font-size: 15px; letter-spacing: .14em; margin-inline-end: 6px; }
.login-panel .brand-word { display: block; width: 100%; text-align: center !important; margin: 2px 0 4px; }

/* ransomware / flood attacks */
.attack-body .inline-form { margin-block-end: 8px; }
.attack-body .attack-term { white-space: pre; overflow: auto; }
.attack-files { height: auto; max-height: 150px; }

/* attack screens: leave at any time (no bonus) */
.attack-box { position: relative; max-height: 92vh; overflow: auto; }
.attack-exit { position: sticky; top: -12px; float: inline-end; z-index: 3; margin: -6px -6px 6px 10px; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid #ffd0d0; background: #2a0000; color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.attack-exit:hover, .attack-exit:focus-visible { background: #ffd0d0; color: #2a0000; }
@media (max-width: 520px) { .modal-x, .attack-exit { min-height: 44px; font-size: 16px; } }

/* ☰ menu: switch tracks / back to the main screen */
.hud-menu-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 4px 12px; border-radius: 10px; border: 2px solid var(--accent); background: rgba(0,0,0,.35); color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; letter-spacing: 0; }
.hud-menu-btn:hover, .hud-menu-btn:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
.menu-body { display: flex; flex-direction: column; gap: 10px; }
.menu-body h4 { margin: 8px 0 0; }
.menu-body .muted { margin: 0; color: var(--muted); font-size: 14px; }
.menu-home { width: 100%; font-size: 17px; }
.menu-tracks { display: grid; gap: 8px; }
.menu-track { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0,0,0,.35); color: var(--fg); font: inherit; font-size: 16px; text-align: start; cursor: pointer; }
.menu-track:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.menu-track.current { border-color: var(--accent); cursor: default; opacity: .9; }
.menu-track-icon { font-size: 22px; }
.menu-track-name { flex: 1; font-weight: 700; }
.menu-here { color: var(--accent); }
.menu-library { text-align: center; text-decoration: none; }
@media (max-width: 520px) { .hud-menu-btn { min-height: 40px; } }

/* ----- credit line and the message form (js/contact.js) ----- */
/* the automatic hint offer (js/nudge.js): a small card in the corner, never over the answer box */
.hint-nudge { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 900; width: min(320px, calc(100vw - 32px)); padding: 14px 16px; border: 1px solid var(--accent, #3ddc84); border-radius: 12px; background: var(--panel, #0d1512); color: var(--text, #e8f5ee); box-shadow: 0 8px 28px rgba(0, 0, 0, .45); animation: nudge-in .35s ease-out; }
.hint-nudge strong { display: block; margin-bottom: 4px; }
.hint-nudge p { margin: 0 0 10px; font-size: 14px; }
.hint-nudge .row-actions { margin: 0; justify-content: flex-start; gap: 8px; }
@keyframes nudge-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hint-nudge { animation: none; } }
.credit-line { text-align: center; font-size: 12px; color: var(--muted); opacity: .8; margin: 14px 0 0; }
.contact-form { display: grid; gap: 10px; }
.contact-form p { margin: 0; }
.contact-form textarea { resize: vertical; font: inherit; }
.contact-extra { position: absolute; inset-inline-start: -9999px; inline-size: 1px; block-size: 1px; opacity: 0; }
/* what the certificate offers next (js/stages/endgame.js) */
.next-panel { text-align: center; border-color: var(--accent, #3ddc84); }
.next-panel .next-grade { font-weight: 700; font-size: 18px; }
/* the organiser's closing message on the final screen */
.end-note { border-color: var(--accent, #3ddc84); }
.end-note-text { white-space: pre-wrap; font-size: 17px; line-height: 1.7; margin: 0; }
.endnote-live { display: grid; gap: 6px; margin-top: 10px; }
.endnote-live .btn { justify-self: start; }
/* the door to the Hanukkah challenge on the login screen */
.hk-promo { display: block; text-align: center; margin: 16px auto 0; padding: 10px 14px; max-width: 420px; border: 1px solid #e0a83a; border-radius: 10px; color: #ffd27a; background: rgba(224, 168, 58, .1); text-decoration: none; font-weight: 700; }
.hk-promo:hover { background: rgba(224, 168, 58, .2); }
