/* ============================================================
   UGLab Day 2 — Lab CSS
   Matches UGLabs brand: index.html + opsec1.html tokens
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@400;600;700&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:          #050607;
  --bg-soft:     #0d1114;
  --surface:     #141b1f;
  --surface-alt: #1a2429;
  --teal:        #1ec6b5;
  --teal-soft:   #8be3db;
  --teal-dim:    rgba(30, 198, 181, 0.12);
  --teal-glow:   rgba(30, 198, 181, 0.22);
  --text:        #f5f8fa;
  --text-muted:  #b5c2c9;
  --line:        #2a383f;
  --success:     #2bd38f;
  --warn:        #f2be57;
  --danger:      #ff6f6f;
  --radius:      14px;
  --shadow:      0 20px 52px rgba(0, 0, 0, 0.5);

  /* Terminal-specific */
  --term-bg:     #08111a;
  --term-text:   #b4f0c8;
  --term-cmd:    #8be3db;
  --term-error:  #ff6f6f;
  --term-teach:  #4a6070;
  --term-hint:   #f2be57;
  --term-flag:   #2bd38f;

  --font-ui:     'IBM Plex Sans', 'Segoe UI', sans-serif;
  --font-head:   'Oxanium', 'Franklin Gothic Medium', sans-serif;
  --font-mono:   'IBM Plex Mono', 'Consolas', monospace;
  --font-term:   'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Base body + scanline ────────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%,  rgba(16, 49, 57, 0.4)  0%, transparent 30%),
    radial-gradient(circle at 86% 4%,  rgba(14, 43, 50, 0.32) 0%, transparent 24%),
    linear-gradient(170deg, #050607 0%, #06090b 55%, #050607 100%);
  overflow-x: hidden;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.018),
    rgba(255,255,255,0.018) 1px,
    transparent 1px,
    transparent 5px
  );
  opacity: 0.25;
  z-index: 1;
}

/* ════════════════════════════════════════════════════════════════════════════
   ENTRY PAGE (index.php)
   ════════════════════════════════════════════════════════════════════════════ */

.page-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.entry-stage {
  z-index: 2;
  width: 100%;
  max-width: 480px;
}

.entry-card {
  background: linear-gradient(165deg, rgba(18, 24, 28, 0.96), rgba(9, 14, 17, 0.92));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal) 40%, var(--teal-soft) 60%, transparent);
  opacity: 0.7;
}

.entry-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.entry-logo {
  width: 50px; height: 50px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(139, 227, 219, 0.32);
  box-shadow: 0 0 18px rgba(30, 198, 181, 0.24);
  background: rgba(10, 22, 26, 0.9);
  display: flex; align-items: center; justify-content: center;
  padding: 7px;
}
.entry-logo svg { width: 100%; height: 100%; }

.entry-brand-text { display: grid; gap: 0.1rem; }

.entry-brand-name {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--teal-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entry-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-module-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--teal-dim);
  border: 1px solid rgba(30, 198, 181, 0.28);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-soft);
}
.entry-module-day  { color: var(--teal); font-weight: 500; }
.entry-module-sep  { opacity: 0.5; }
.entry-module-title{ color: var(--text-muted); }

.entry-title {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.entry-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.entry-form { display: grid; gap: 0.65rem; }

.entry-field-label {
  color: var(--teal-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.input-wrap { position: relative; }
.input-wrap::before {
  content: '>_';
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal);
  opacity: 0.5;
  pointer-events: none;
}

.input-wrap input {
  appearance: none;
  border: 1px solid #31424a;
  border-radius: 10px;
  background: #0c1216;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.7rem 0.8rem 0.7rem 2.2rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.input-wrap input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(30, 198, 181, 0.2);
}

.entry-error {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  min-height: 1.2em;
}

.btn-enter {
  border: 1px solid rgba(30, 198, 181, 0.55);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: linear-gradient(120deg, #0f8f82, #1ec6b5);
  color: #031415;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.btn-enter:hover   { filter: brightness(1.07); }
.btn-enter:active  { transform: scale(0.98); }
.btn-enter:disabled{ opacity: 0.6; cursor: not-allowed; filter: none; }

.entry-notice {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.entry-notice strong { color: var(--teal-soft); }

.entry-stats {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.entry-stat-sep { opacity: 0.4; }

/* ════════════════════════════════════════════════════════════════════════════
   LAB PAGE (lab.php)
   ════════════════════════════════════════════════════════════════════════════ */

.page-lab {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.lab-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem clamp(0.75rem, 1.5vw, 1.25rem);
  background: rgba(9, 14, 17, 0.97);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.lab-topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal) 30%, var(--teal-soft) 60%, transparent);
  opacity: 0.25;
}

.topbar-left  { display: flex; align-items: center; gap: 0.6rem; }
.topbar-center{ display: flex; align-items: center; gap: 0.5rem; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.topbar-logo { width: 32px; height: 32px; flex-shrink: 0; }
.topbar-logo svg { width: 100%; height: 100%; }

.topbar-brand-name {
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.topbar-brand-sep { color: var(--text-muted); opacity: 0.4; margin: 0 0.2rem; }
.topbar-module    { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.topbar-intern-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.2rem 0.55rem;
  background: rgba(20, 27, 31, 0.8);
}
.topbar-score-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.topbar-score {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--teal);
  min-width: 3ch;
}

.topbar-link {
  text-decoration: none;
  color: var(--teal-soft);
  border: 1px solid rgba(139, 227, 219, 0.25);
  border-radius: 8px;
  padding: 0.28rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 0.2s, background 0.2s;
}
.topbar-link:hover { border-color: rgba(139, 227, 219, 0.55); background: var(--teal-dim); color: #eafffd; }
.topbar-link--exit { color: var(--text-muted); }

/* ── Main 3-panel ────────────────────────────────────────────────────────── */
.lab-main {
  display: grid;
  grid-template-columns: 260px 1fr 220px;
  flex: 1;
  overflow: hidden;
  z-index: 2;
}

/* ── Task panel (left) ───────────────────────────────────────────────────── */
.lab-tasks {
  border-right: 1px solid var(--line);
  background: rgba(12, 17, 20, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.85rem 0.5rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tasks-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  opacity: 0.7;
}
.tasks-progress {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--teal-soft);
  font-weight: 500;
}

.tasks-level-label {
  padding: 0.55rem 0.85rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  opacity: 0.65;
  flex-shrink: 0;
}
.tasks-level-label--locked { opacity: 0.3; }

.tasks-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.tasks-list--locked { opacity: 0.3; pointer-events: none; }

.task-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  border-left: 2px solid transparent;
  cursor: default;
  transition: background 0.15s;
}
.task-item:hover { background: rgba(30, 198, 181, 0.04); }

.task-item--active {
  border-left-color: var(--teal);
  background: rgba(30, 198, 181, 0.07);
}
.task-item--done { opacity: 0.45; }
.task-item--locked { opacity: 0.35; }

.task-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 1.4rem;
}
.task-name {
  font-size: 0.76rem;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.task-item--active .task-name { color: var(--text); }
.task-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  color: var(--text-muted);
}
.task-item--active .task-status { color: var(--teal); }
.task-item--done   .task-status { color: var(--success); }

/* ── Terminal panel (center) ─────────────────────────────────────────────── */
.lab-terminal-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--term-bg);
  position: relative;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  background: rgba(6, 10, 13, 0.95);
  border-bottom: 1px solid rgba(42, 56, 63, 0.8);
  flex-shrink: 0;
}
.terminal-dots { display: flex; gap: 0.38rem; }
.terminal-dots span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--line);
  opacity: 0.7;
}
.terminal-dots span:nth-child(1) { background: #ff5f57; }
.terminal-dots span:nth-child(2) { background: #ffbd2e; }
.terminal-dots span:nth-child(3) { background: #28c840; }
.terminal-chrome-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.06em;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  font-family: var(--font-term);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--term-text);
  scrollbar-width: thin;
  scrollbar-color: #1a2a34 transparent;
  word-break: break-word;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(42, 56, 63, 0.6);
  background: rgba(6, 10, 14, 0.9);
  flex-shrink: 0;
}
.terminal-prompt {
  font-family: var(--font-term);
  font-size: 0.82rem;
  color: var(--teal);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-term);
  font-size: 0.82rem;
  color: var(--term-text);
  caret-color: var(--teal);
}

/* ── Terminal text styles ────────────────────────────────────────────────── */
.t-line      { line-height: 1.5; }
.t-cmd       { display: flex; gap: 0.35rem; align-items: baseline; opacity: 0.7; margin-bottom: 0.12rem; }
.t-prompt    { color: var(--teal); font-size: 0.78rem; flex-shrink: 0; }
.t-input-echo{ color: var(--term-cmd); }
.t-error     { color: var(--term-error); }
.t-success   { color: var(--success); }
.t-flag      { color: var(--success); font-weight: 600; padding: 0.15rem 0; border-left: 2px solid var(--success); padding-left: 0.5rem; }
.t-pts       { color: var(--teal-soft); padding: 0.1rem 0; }
.t-bonus     { color: var(--warn); font-weight: 600; }
.t-muted     { color: var(--term-teach); }
.t-teal      { color: var(--teal); }
.t-tip       { color: var(--warn); opacity: 0.85; font-style: italic; }
.t-curl      { color: #c8f5d0; }

.teach-note {
  color: var(--term-teach);
  font-style: italic;
  font-size: 0.78rem;
  opacity: 0.75;
  padding: 0.05rem 0;
}

.t-hint {
  color: var(--warn);
  border: 1px solid rgba(242, 190, 87, 0.28);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin: 0.35rem 0;
  line-height: 1.5;
  background: rgba(242, 190, 87, 0.05);
}
.t-hint-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--warn);
  opacity: 0.7;
  margin-bottom: 0.3rem;
}

/* Task prompt box */
.t-task-prompt {
  border-left: 3px solid var(--teal);
  background: rgba(30, 198, 181, 0.04);
  border-radius: 0 8px 8px 0;
  padding: 0.7rem 0.85rem;
  margin: 0.5rem 0;
  line-height: 1.55;
}
.t-task-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.t-task-id  { font-family: var(--font-mono); font-size: 0.62rem; color: var(--teal); text-transform: uppercase; letter-spacing: 0.1em; }
.t-task-lvl { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-muted); background: var(--surface); border-radius: 4px; padding: 0.05rem 0.3rem; }
.t-task-pts { font-family: var(--font-mono); font-size: 0.6rem; color: var(--warn); margin-left: auto; }
.t-task-title    { font-family: var(--font-head); font-size: 0.95rem; color: var(--text); font-weight: 600; margin-bottom: 0.2rem; }
.t-task-scenario { font-size: 0.78rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.35rem; }
.t-task-objective{ font-size: 0.82rem; color: var(--term-text); margin-bottom: 0.35rem; }
.t-task-cmds     { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.t-task-cmds code{ color: var(--teal-soft); background: rgba(30, 198, 181, 0.1); border-radius: 4px; padding: 0.05rem 0.25rem; margin: 0 0.1rem; }

/* Welcome banner */
.t-banner {
  border: 1px solid rgba(30, 198, 181, 0.2);
  border-radius: 10px;
  background: rgba(30, 198, 181, 0.05);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
.t-banner-title { font-family: var(--font-head); font-size: 0.78rem; color: var(--teal); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.t-banner-sub   { font-size: 0.88rem; color: var(--text-muted); }
.t-banner-sub strong{ color: var(--text); }
.t-banner-tip   { font-family: var(--font-mono); font-size: 0.72rem; color: var(--term-teach); margin-top: 0.3rem; }
.t-banner-tip code{ color: var(--teal-soft); }

/* Man page */
.t-man { margin: 0.3rem 0; }
.t-man-head  { font-family: var(--font-head); font-size: 0.78rem; color: var(--teal-soft); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.35rem; }
.t-man-label { color: var(--teal); font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; display: inline-block; width: 5.5rem; }

/* Help */
.t-help-header { font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal); margin-bottom: 0.35rem; }
.t-help-row    { display: flex; gap: 0.5rem; }
.t-help-cmd    { font-family: var(--font-mono); font-size: 0.78rem; color: var(--teal-soft); min-width: 7rem; flex-shrink: 0; }

/* Tasks list */
.t-tasks-list  { margin: 0.3rem 0; }
.t-tasks-header{ font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--teal); margin-bottom: 0.35rem; }
.t-task-row    { display: flex; gap: 0.65rem; align-items: center; padding: 0.12rem 0; font-family: var(--font-mono); font-size: 0.76rem; }
.t-task-icon   { width: 1rem; text-align: center; flex-shrink: 0; }
.t-task-lbl    { color: var(--text-muted); font-size: 0.68rem; flex-shrink: 0; width: 5.5rem; }
.t-task-name   { flex: 1; }
.t-task-pts    { color: var(--warn); font-size: 0.7rem; flex-shrink: 0; }
.t-task-done   { opacity: 0.45; }
.t-task-done .t-task-icon { color: var(--success); }
.t-task-current{ color: var(--text); }
.t-task-current .t-task-icon { color: var(--teal); }
.t-task-locked { opacity: 0.3; }
.t-task-pending{ opacity: 0.65; }

/* ── Level transition overlay ────────────────────────────────────────────── */
.level-transition {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 7, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(3px);
}
.level-transition[hidden] { display: none; }

.level-transition-inner {
  max-width: 540px;
  width: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
}
.lt-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal) 30%, var(--teal-soft) 70%, transparent);
  margin: 1.25rem 0;
  opacity: 0.5;
}
.lt-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--teal);
  margin-bottom: 0.4rem;
}
.lt-score {
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 0.5rem;
}
.lt-title {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 1rem;
}
.lt-body { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 0.5rem; }
.lt-cmds {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--teal-soft);
  background: var(--teal-dim);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
  line-height: 1.8;
}
.lt-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}
.lt-note code { color: var(--teal-soft); }
.lt-btn {
  border: 1px solid rgba(30, 198, 181, 0.55);
  border-radius: 10px;
  padding: 0.75rem 2rem;
  background: linear-gradient(120deg, #0f8f82, #1ec6b5);
  color: #031415;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: filter 0.15s;
}
.lt-btn:hover { filter: brightness(1.08); }

/* ── Completion overlay ──────────────────────────────────────────────────── */
.completion-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 7, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
}
.completion-overlay[hidden] { display: none; }

.completion-inner { text-align: center; padding: 2rem 1.5rem; max-width: 480px; }
.comp-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--success);
  margin-bottom: 0.75rem;
}
.comp-title {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.1;
}
.comp-score {
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.3rem;
}
.comp-tasks { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.comp-btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid rgba(30, 198, 181, 0.55);
  border-radius: 10px;
  padding: 0.75rem 2rem;
  background: linear-gradient(120deg, #0f8f82, #1ec6b5);
  color: #031415;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  transition: filter 0.15s;
}
.comp-btn:hover { filter: brightness(1.08); }

/* ── Mini-scoreboard (right) ─────────────────────────────────────────────── */
.lab-scoreboard-panel {
  border-left: 1px solid var(--line);
  background: rgba(10, 14, 18, 0.92);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mini-sb-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.mini-sb-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
  opacity: 0.7;
  flex: 1;
}
.mini-sb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(43, 211, 143, 0.8);
  animation: pulse 1.8s ease-in-out infinite;
}

.mini-scoreboard {
  overflow-y: auto;
  flex: 1;
  padding: 0.3rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  transition: background 0.15s;
  cursor: default;
}
.mini-row:hover { background: rgba(30, 198, 181, 0.04); }
.mini-row--current { background: rgba(30, 198, 181, 0.08); border-left: 2px solid var(--teal); }

.mini-rank {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  width: 1.2rem;
  flex-shrink: 0;
}
.mini-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-row--current .mini-name { color: var(--text); }
.mini-score {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal-soft);
  flex-shrink: 0;
  font-weight: 500;
}
.mini-active-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 1.8s ease-in-out infinite;
}

/* ── Hint modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: linear-gradient(165deg, #141b1f, #0d1317);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
  max-width: 400px;
  width: 100%;
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--warn) 40%, var(--teal-soft) 60%, transparent);
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.6;
}
.modal-title { font-family: var(--font-head); font-size: 1.1rem; color: var(--text); margin-bottom: 0.6rem; }
.modal-body  { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.modal-btn {
  flex: 1;
  border-radius: 9px;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: filter 0.15s;
  border: 1px solid transparent;
  min-width: 120px;
}
.modal-btn--confirm {
  background: linear-gradient(120deg, #7a5200, #f2be57);
  color: #1a0f00;
  font-weight: 600;
  border-color: rgba(242, 190, 87, 0.5);
}
.modal-btn--cancel {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--line);
}
.modal-btn:hover { filter: brightness(1.08); }

/* ════════════════════════════════════════════════════════════════════════════
   SCOREBOARD PAGE (scoreboard.php)
   ════════════════════════════════════════════════════════════════════════════ */

.page-scoreboard {
  min-height: 100vh;
  padding: 0 0 2rem;
}

.sb-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  position: relative;
  z-index: 2;
}

.sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0.75rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.sb-brand { display: flex; align-items: center; gap: 0.75rem; }
.sb-logo  { width: 40px; height: 40px; flex-shrink: 0; }
.sb-logo svg { width: 100%; height: 100%; }

.sb-brand-text  { display: grid; gap: 0.1rem; }
.sb-title       { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--teal-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.sb-subtitle    { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

.sb-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.sb-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(43, 211, 143, 0.8);
  animation: pulse 1.8s ease-in-out infinite;
}
.sb-live-label { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sb-back-link  { font-family: var(--font-mono); font-size: 0.68rem; color: var(--teal-soft); text-decoration: none; border: 1px solid rgba(139,227,219,0.25); border-radius: 7px; padding: 0.2rem 0.55rem; transition: border-color 0.2s, background 0.2s; }
.sb-back-link:hover { border-color: rgba(139,227,219,0.55); background: var(--teal-dim); }

.sb-table-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(12, 17, 20, 0.85);
}

.sb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.sb-table thead tr {
  border-bottom: 1px solid var(--line);
  background: rgba(20, 27, 31, 0.9);
}
.sb-table th {
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}
.sb-table th[data-sort] { cursor: pointer; }
.sb-table th[data-sort]:hover { color: var(--teal-soft); }
.sb-table th.sort-active { color: var(--teal); }

.sb-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(42, 56, 63, 0.5);
  color: var(--text-muted);
  font-size: 0.82rem;
  vertical-align: middle;
}
.sb-table tr:last-child td { border-bottom: none; }
.sb-table tr:hover td { background: rgba(30, 198, 181, 0.03); }

.row--current td { color: var(--text); background: rgba(30, 198, 181, 0.05); }
.row--current td:first-child { border-left: 3px solid var(--teal); }
.row--active  td:first-child { }

.badge-active { color: var(--success); font-size: 0.7rem; margin-left: 0.3rem; }

.col-rank  { width: 3.5rem; text-align: center; }
.col-score { width: 5.5rem; text-align: right; color: var(--text-muted); }
.col-total { width: 6rem; text-align: right; font-weight: 700; color: var(--teal-soft); font-family: var(--font-mono); }
.col-hints { width: 4.5rem; text-align: center; }
.col-time  { width: 6.5rem; font-family: var(--font-mono); font-size: 0.75rem; }
.col-date  { width: 8rem; font-family: var(--font-mono); font-size: 0.74rem; }

.sb-loading { text-align: center; padding: 2rem; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem; }
.sb-empty   { text-align: center; padding: 2.5rem; color: var(--text-muted); font-size: 0.85rem; }

.sb-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.sb-footer-text  { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.6; }
.sb-footer-score-label { font-family: var(--font-mono); font-size: 0.66rem; color: var(--teal); opacity: 0.7; }

/* ════════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════════════════════ */

@keyframes pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.65; }
  50%       { transform: scale(1.1);  opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .mini-sb-dot,
  .mini-active-dot,
  .sb-live-dot { animation: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 960px) {
  .lab-main {
    grid-template-columns: 220px 1fr;
  }
  .lab-scoreboard-panel { display: none; }
}

@media (max-width: 700px) {
  .lab-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .lab-tasks { display: none; }

  .topbar-module { display: none; }

  .sb-table th.col-time,
  .sb-table td.col-time,
  .sb-table th.col-date,
  .sb-table td.col-date { display: none; }
}

@media (max-width: 480px) {
  .entry-card { padding: 1.25rem; }
  .entry-title { font-size: 1.3rem; }

  .sb-table th.col-hints,
  .sb-table td.col-hints { display: none; }
}

/* code element base */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(30, 198, 181, 0.1);
  border-radius: 4px;
  padding: 0.05em 0.3em;
  color: var(--teal-soft);
}

/* ════════════════════════════════════════════════════════════════════════════
   MODE SELECTOR (index.php)
   ════════════════════════════════════════════════════════════════════════════ */

.mode-selector { margin-top: 1.5rem; }

.mode-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 0.875rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mode-card:hover {
  border-color: var(--teal);
  background: var(--surface-alt);
}

.mode-card--active {
  border-color: var(--warn);
  background: rgba(242, 190, 87, 0.06);
}

.mode-card-icon { font-size: 1.25rem; }

.mode-card-title {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.mode-card--active .mode-card-title { color: var(--warn); }

.mode-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ════════════════════════════════════════════════════════════════════════════
   GUIDED PILL (lab.php topbar)
   ════════════════════════════════════════════════════════════════════════════ */

.topbar-guided-pill {
  display: inline-block;
  background: rgba(242, 190, 87, 0.15);
  border: 1px solid rgba(242, 190, 87, 0.4);
  color: var(--warn);
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ════════════════════════════════════════════════════════════════════════════
   CONCEPT BOX (Guided mode — before task prompt)
   ════════════════════════════════════════════════════════════════════════════ */

.t-concept {
  border-left: 3px solid var(--teal);
  background: rgba(30, 198, 181, 0.06);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--teal-soft);
}

.t-concept-label {
  display: block;
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--teal);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.t-concept-hint {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(30, 198, 181, 0.18);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.t-concept-hint-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--teal);
  margin-right: 0.4rem;
}

/* ════════════════════════════════════════════════════════════════════════════
   EXPLANATION PANEL (Guided mode — after task success)
   ════════════════════════════════════════════════════════════════════════════ */

.t-explain {
  border-left: 3px solid var(--warn);
  background: rgba(242, 190, 87, 0.06);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #d9aa4a;
}

.t-explain-label {
  display: block;
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--warn);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════════════════
   GUIDED BADGE (scoreboards)
   ════════════════════════════════════════════════════════════════════════════ */

.badge-guided {
  display: inline-block;
  background: rgba(242, 190, 87, 0.12);
  border: 1px solid rgba(242, 190, 87, 0.35);
  color: var(--warn);
  font-family: var(--font-head);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}
