/* ============================================================
   ARC-1 Boot Camp — styles.css
   Palette per PRODUCT.md
   ============================================================ */

:root {
  --bg-terminal: #0c0c0c;
  --bg-panel: #1a1a2e;
  --bg-panel-2: #20203a;
  --bg-elev: #25254a;
  --term-text: #33ff33;
  --accent: #00d4ff;
  --success: #00ff00;
  --error: #ff4444;
  --hint: #ffaa00;
  --text: #e0e0e0;
  --text-dim: #9a9ab8;
  --heading: #ffffff;
  --border: #2e2e55;

  --c-green:  #33ff33;
  --c-blue:   #3a8bff;
  --c-yellow: #f5d300;
  --c-orange: #ff8c1a;
  --c-red:    #ff3b3b;

  --font-term: 'Cousine', 'Courier New', monospace;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  overflow: hidden;
}

code { font-family: var(--font-term); background: rgba(0,0,0,0.35); padding: 0 4px; border-radius: 3px; }

/* ===================== HUD ===================== */
.hud {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #20204a 0%, var(--bg-panel) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 18px rgba(0,0,0,0.45);
  flex: 0 0 auto;
}
.hud-brand { display: flex; align-items: baseline; gap: 8px; margin-right: 6px; }
.hud-logo { font-weight: 800; color: var(--accent); letter-spacing: 1px; font-size: 18px; }
.hud-sub { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }

.hud-stat { display: flex; flex-direction: column; line-height: 1.15; }
.hud-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); }
.hud-value { font-family: var(--font-term); color: var(--heading); font-size: 15px; }

.hud-progress { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 320px; }
.progress-track { flex: 1; height: 10px; background: #0c0c20; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--c-green), var(--accent)); transition: width .5s ease; box-shadow: 0 0 10px var(--accent); }

.hud-badges { display: flex; gap: 6px; font-size: 20px; }
.badge-slot { filter: grayscale(1) opacity(0.45); transition: filter .4s ease, transform .4s; }
.badge-slot.unlocked { filter: none; transform: scale(1.12); }
.badge-slot.unlocked[data-badge="green"]  { text-shadow: 0 0 12px var(--c-green); }
.badge-slot.unlocked[data-badge="blue"]   { text-shadow: 0 0 12px var(--c-blue); }
.badge-slot.unlocked[data-badge="yellow"] { text-shadow: 0 0 12px var(--c-yellow); }
.badge-slot.unlocked[data-badge="orange"] { text-shadow: 0 0 12px var(--c-orange); }
.badge-slot.unlocked[data-badge="red"]     { text-shadow: 0 0 14px var(--c-red); }

.hud-btn { background: transparent; color: var(--text-dim); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: all .2s; }
.hud-btn:hover { color: var(--error); border-color: var(--error); }

/* ===================== LAYOUT ===================== */
.layout {
  display: flex;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 58px);
}

/* reopen tab — sits over the terminal's left edge when the panel is hidden */
.mission-expand {
  position: absolute;
  top: 12px;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-2);
  color: var(--heading);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: background .2s, color .2s;
}
.mission-expand:hover { background: var(--bg-elev); color: var(--accent); }
.mission-expand[hidden] { display: none; }
.mission-expand-label { letter-spacing: .5px; }
.mission-panel {
  width: 30%;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .25s ease;
}
.mission-panel.collapsed { width: 0; min-width: 0; border-right: none; }
.mission-toggle {
  background: var(--bg-panel-2); color: var(--heading); border: none;
  border-bottom: 1px solid var(--border); padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 13px; cursor: pointer; letter-spacing: .5px;
}
#mission-toggle-icon { display: inline-block; transition: transform .2s; }
.mission-panel.collapsed #mission-toggle-icon { transform: rotate(-90deg); }

.panel-body { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.card { background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.card-title { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); }
.ach-count { color: var(--accent); font-weight: 700; }

/* mission card */
.mission-card { background: linear-gradient(180deg, var(--bg-elev), var(--bg-panel-2)); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.mission-clearance { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.mission-icon { font-size: 30px; filter: drop-shadow(0 0 8px currentColor); }
.mission-title { font-size: 17px; font-weight: 700; color: var(--heading); }
.mission-clearance-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); }
.mission-narrative { font-size: 13px; line-height: 1.55; color: var(--text); margin: 0 0 12px; }

.mission-task-block { background: rgba(0,0,0,0.25); border-radius: 8px; padding: 10px 12px; }
.mission-task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mission-task-num { font-family: var(--font-term); font-size: 12px; color: var(--accent); }
.mission-dots { font-family: var(--font-term); font-size: 14px; color: var(--text-dim); letter-spacing: 3px; }
.mission-dots .done { color: var(--success); }
.mission-dots .current { color: var(--hint); }
.mission-task-prompt { margin: 0; font-size: 14px; font-weight: 500; color: var(--heading); }

.mission-hint-area { display: flex; gap: 8px; margin-top: 10px; padding: 8px 10px; background: rgba(255,170,0,0.08); border-left: 3px solid var(--hint); border-radius: 4px; animation: hint-in .3s ease; }
.mission-hint-area[hidden] { display: none; }
.mission-hint-text { font-size: 13px; color: var(--hint); line-height: 1.45; }
.hint-pin { font-size: 14px; }
@keyframes hint-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.hint-btn {
  margin-top: 10px; width: 100%; background: #2a2a44; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 7px; padding: 8px; font-size: 13px; cursor: pointer;
  transition: all .2s;
}
.hint-btn:disabled { cursor: not-allowed; }
.hint-btn.ready { color: var(--hint); border-color: var(--hint); animation: hint-pulse 1.4s infinite; }
@keyframes hint-pulse { 0%,100% { box-shadow: 0 0 0 rgba(255,170,0,0); } 50% { box-shadow: 0 0 14px rgba(255,170,0,0.6); } }

/* badge collection list */
.badge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.badge-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.badge-list li .b { font-size: 18px; filter: grayscale(1) opacity(0.4); transition: filter .4s; }
.badge-list li.unlocked .b { filter: none; }
.badge-list li.unlocked { background: rgba(0,212,255,0.06); }
.badge-list li .bl-name { flex: 1; }
.badge-list li .bl-state { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.badge-list li.in-progress .bl-state { color: var(--hint); }
.badge-list li.unlocked .bl-state { color: var(--success); }

/* achievements grid */
.achievement-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ach-slot { font-size: 22px; text-align: center; filter: grayscale(1) opacity(0.25); transition: all .35s; }
.ach-slot.unlocked { filter: none; transform: scale(1.15); text-shadow: 0 0 10px var(--accent); }

/* ===================== TERMINAL ===================== */
.terminal-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-terminal); }
.terminal-chrome {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: #161616; border-bottom: 1px solid #000; flex: 0 0 auto;
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-r { background: #ff5f56; } .dot-y { background: #ffbd2e; } .dot-g { background: #27c93f; }
.chrome-title { font-family: var(--font-term); font-size: 12px; color: #6a6a6a; margin-left: 6px; }
.chrome-spacer { flex: 1; }
.node-indicator { font-family: var(--font-term); font-size: 11px; color: var(--accent); border: 1px solid var(--border); padding: 2px 8px; border-radius: 10px; }

#terminal { flex: 1; padding: 10px 14px; min-height: 0; overflow: hidden; }
.terminal .xterm-viewport::-webkit-scrollbar { width: 10px; }
.terminal .xterm-viewport::-webkit-scrollbar-thumb { background: #333; border-radius: 5px; }

.terminal-foot { flex: 0 0 auto; padding: 8px 14px; background: #111; border-top: 1px solid #000; font-size: 12px; color: #6a6a6a; }
.terminal-foot code { color: var(--accent); }

/* ===================== TOASTS ===================== */
.toast-stack { position: fixed; top: 76px; right: 18px; display: flex; flex-direction: column; gap: 12px; z-index: 50; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 280px; max-width: 340px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6); display: flex; gap: 12px; align-items: flex-start;
  animation: toast-in .45s cubic-bezier(.2,.9,.3,1.3);
}
.toast.leaving { animation: toast-out .35s ease forwards; }
@keyframes toast-in { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }
.toast-icon { font-size: 34px; line-height: 1; animation: pop .5s cubic-bezier(.2,.9,.3,1.6); }
@keyframes pop { 0% { transform: scale(0.2); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.toast-body { flex: 1; }
.toast-title { font-weight: 800; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.toast-sub { font-size: 13px; color: var(--text); margin-top: 2px; }
.toast-msg { font-size: 12px; color: var(--text-dim); margin-top: 4px; font-style: italic; }
.toast-dismiss { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 0 0 0 4px; }
.toast-badge { color: var(--accent); }

/* ===================== CERTIFICATE ===================== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,4,12,0.82); backdrop-filter: blur(4px); }
.certificate {
  position: relative; width: min(680px, 92vw); max-height: 92vh; overflow: auto;
  background: linear-gradient(160deg, #14143a 0%, #1a1a2e 60%, #20204a 100%);
  border: 2px solid var(--accent); border-radius: 16px; padding: 36px 40px;
  text-align: center; box-shadow: 0 0 60px rgba(0,212,255,0.35); color: var(--text);
  animation: cert-in .5s ease;
}
@keyframes cert-in { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.cert-ribbon { font-size: 30px; font-weight: 800; letter-spacing: 6px; color: var(--c-red); text-shadow: 0 0 20px var(--c-red); }
.cert-brand { margin-top: 6px; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-dim); }
.cert-title { margin: 18px 0 4px; font-size: 26px; color: var(--heading); font-weight: 700; }
.cert-awarded { margin: 0; color: var(--text-dim); font-size: 14px; }
.cert-name { font-family: var(--font-term); font-size: 30px; color: var(--accent); margin: 6px 0; word-break: break-word; }
.cert-badges { font-size: 40px; margin: 16px 0; letter-spacing: 10px; }
.cert-stats { display: flex; justify-content: center; gap: 36px; margin: 18px 0; flex-wrap: wrap; }
.cert-stats > div { display: flex; flex-direction: column; }
.cert-stat-val { font-family: var(--font-term); font-size: 18px; color: var(--heading); }
.cert-stat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin-top: 4px; }
.cert-tagline { font-style: italic; color: var(--accent); margin: 14px 0 20px; }
.cert-actions { display: flex; gap: 12px; justify-content: center; }
.cert-btn { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 22px; font-size: 14px; cursor: pointer; transition: all .2s; }
.cert-btn:hover { border-color: var(--accent); color: var(--accent); }
.cert-btn.primary { background: var(--accent); color: #06121a; border-color: var(--accent); font-weight: 600; }
.cert-btn.primary:hover { filter: brightness(1.1); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .layout { flex-direction: column; height: calc(100vh - 58px); }
  .mission-panel { width: 100%; max-width: none; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); max-height: 42vh; }
  .mission-panel.collapsed { max-height: 40px; }
  .mission-expand { display: none !important; } /* in-panel toggle stays visible when stacked */
  .hud { gap: 12px; flex-wrap: wrap; }
  .hud-progress { order: 10; flex-basis: 100%; max-width: none; }
}