/* style.css — Packet Quest: TCP/IP Network Simulator */

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #0a0e17;
  color: #e8eaf0;
  touch-action: manipulation;
}

html[data-theme="light"] {
  background: #f0f2f5;
  color: #1a1d23;
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#ui-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#ui-layer > * {
  pointer-events: auto;
}

/* ── Click-through for canvas-interactive screens ─────── */
#ui-layer > .handshake-screen,
#ui-layer > .routing-screen,
#ui-layer > .full-screen,
#ui-layer > .dns-screen,
#ui-layer > .http-screen {
  pointer-events: none;
}

#ui-layer > .handshake-screen .hs-panel,
#ui-layer > .routing-screen .routing-panel,
#ui-layer > .full-screen .full-panel,
#ui-layer > .dns-screen .dns-panel,
#ui-layer > .http-screen .http-panel {
  pointer-events: auto;
}

/* ── Top Bar ──────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(100, 140, 200, 0.1);
  z-index: 100;
}

html[data-theme="light"] .top-bar {
  background: rgba(240, 242, 245, 0.85);
  border-bottom-color: rgba(100, 140, 200, 0.15);
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-weight: 700;
  font-size: 15px;
  color: #00e5ff;
  letter-spacing: 0.05em;
}

.level-badge {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  padding: 3px 10px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 12px;
  color: #00e5ff;
}

.score-display {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  color: #76ff03;
  font-weight: 600;
}

/* ── Panel Back Link ──────────────────────────────────── */
.panel-back {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(0, 229, 255, 0.6);
  cursor: pointer;
  margin-bottom: 12px;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  transition: color 0.2s ease;
}

.panel-back:hover {
  color: #00e5ff;
}

/* ── Click Hint (in-panel) ────────────────────────────── */
.hs-click-hint {
  font-size: 12px;
  color: rgba(0, 229, 255, 0.7);
  text-align: center;
  padding: 8px 12px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 8px;
  margin-top: 12px;
  line-height: 1.5;
}

.hs-click-hint strong {
  color: #00e5ff;
  font-weight: 700;
}

/* ── Intro Screen ─────────────────────────────────────── */
.intro-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.intro-content {
  text-align: center;
  max-width: 520px;
  padding: 40px 24px;
}

.intro-icon {
  font-size: 56px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.4));
}

.intro-title {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

html[data-theme="light"] .intro-title { color: #1a1d23; }

.intro-subtitle {
  font-size: 16px;
  color: rgba(200, 210, 230, 0.6);
  margin-bottom: 24px;
  font-weight: 500;
}

html[data-theme="light"] .intro-subtitle { color: rgba(60, 70, 90, 0.6); }

.intro-desc {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(200, 210, 230, 0.7);
  margin-bottom: 32px;
}

html[data-theme="light"] .intro-desc { color: rgba(60, 70, 90, 0.7); }

.intro-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 36px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 20px;
  font-size: 12px;
  color: rgba(200, 210, 230, 0.8);
  font-weight: 500;
}

html[data-theme="light"] .feature {
  background: rgba(0, 100, 200, 0.06);
  border-color: rgba(0, 100, 200, 0.12);
  color: rgba(60, 70, 90, 0.8);
}

.feat-icon { font-size: 14px; }

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #00e5ff, #00b8d4);
  color: #0a0e17;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.btn-start:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 229, 255, 0.3); }
.btn-start:active { transform: translateY(0); }

/* ── Level Select ─────────────────────────────────────── */
.level-select-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 20px 20px;
  overflow-y: auto;
}

.ls-header { text-align: center; margin-bottom: 28px; }

.ls-header h2 {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 6px;
}

html[data-theme="light"] .ls-header h2 { color: #1a1d23; }

.ls-header p { font-size: 13px; color: rgba(200, 210, 230, 0.5); }
html[data-theme="light"] .ls-header p { color: rgba(60, 70, 90, 0.5); }

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  max-width: 700px;
  width: 100%;
  margin-bottom: 20px;
}

.level-card {
  padding: 16px;
  background: rgba(20, 26, 40, 0.6);
  border: 1px solid rgba(100, 140, 200, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

html[data-theme="light"] .level-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(100, 140, 200, 0.15);
}

.level-card:hover:not(.locked) {
  border-color: rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.1);
}

.level-card.current { border-color: rgba(0, 229, 255, 0.4); background: rgba(0, 229, 255, 0.06); }
.level-card.done { border-color: rgba(118, 255, 3, 0.2); }
.level-card.locked { opacity: 0.4; cursor: default; }

.lc-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.1);
  color: #00e5ff;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.level-card.done .lc-num { background: rgba(118, 255, 3, 0.15); color: #76ff03; }

.lc-title { font-size: 14px; font-weight: 600; color: #e8eaf0; margin-bottom: 4px; }
html[data-theme="light"] .lc-title { color: #1a1d23; }

.lc-desc { font-size: 12px; color: rgba(200, 210, 230, 0.5); line-height: 1.5; }
html[data-theme="light"] .lc-desc { color: rgba(60, 70, 90, 0.5); }

.lc-lock { position: absolute; top: 12px; right: 12px; font-size: 16px; }

.btn-back {
  padding: 10px 24px;
  background: rgba(100, 140, 200, 0.1);
  border: 1px solid rgba(100, 140, 200, 0.15);
  border-radius: 8px;
  color: rgba(200, 210, 230, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back:hover { background: rgba(100, 140, 200, 0.15); color: #e8eaf0; }

/* ── Shared Panel Styles (bottom-docked) ──────────────── */
.handshake-screen, .dns-screen, .http-screen, .routing-screen, .full-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 56px 16px 16px;
}

.hs-panel, .dns-panel, .http-panel, .routing-panel, .full-panel {
  max-width: 440px;
  width: 100%;
  background: rgba(15, 20, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(100, 140, 200, 0.12);
  border-radius: 16px;
  padding: 20px 22px;
  max-height: 44vh;
  overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .hs-panel,
html[data-theme="light"] .dns-panel,
html[data-theme="light"] .http-panel,
html[data-theme="light"] .routing-panel,
html[data-theme="light"] .full-panel {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(100, 140, 200, 0.15);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.08);
}

.hs-panel h3, .dns-panel h3, .http-panel h3, .routing-panel h3, .full-panel h3 {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.hs-panel h3, .http-panel h3, .full-panel h3 { color: #00e5ff; }
.dns-panel h3, .routing-panel h3 { color: #ffab00; }

.hs-panel > p, .dns-panel > p, .http-panel > p, .routing-panel > p, .full-panel > p {
  font-size: 12px;
  color: rgba(200, 210, 230, 0.5);
  margin-bottom: 14px;
  line-height: 1.5;
}

html[data-theme="light"] .hs-panel > p,
html[data-theme="light"] .dns-panel > p,
html[data-theme="light"] .http-panel > p,
html[data-theme="light"] .routing-panel > p,
html[data-theme="light"] .full-panel > p { color: rgba(60, 70, 90, 0.5); }

/* ── Handshake Steps ──────────────────────────────────── */
.hs-steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.hs-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(20, 26, 40, 0.5);
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

html[data-theme="light"] .hs-step { background: rgba(240, 242, 245, 0.5); }

.hs-step.active { border-left-color: #00e5ff; background: rgba(0, 229, 255, 0.06); }
.hs-step.done { border-left-color: #76ff03; opacity: 0.7; }

.hs-step-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.1);
  color: #00e5ff;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.hs-step.done .hs-step-num { background: rgba(118, 255, 3, 0.15); color: #76ff03; }

.hs-step-label {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 2px;
}

html[data-theme="light"] .hs-step-label { color: #1a1d23; }

.hs-step-desc { font-size: 11px; color: rgba(200, 210, 230, 0.5); line-height: 1.4; }
html[data-theme="light"] .hs-step-desc { color: rgba(60, 70, 90, 0.5); }

/* ── DNS Screen ───────────────────────────────────────── */
.dns-panel code, .http-panel code {
  color: #00e5ff;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

.dns-queries { margin-bottom: 14px; }

.dns-query {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 229, 255, 0.04);
  border: 1px solid rgba(0, 229, 255, 0.1);
  border-radius: 8px;
}

.dq-label { font-size: 11px; color: rgba(200, 210, 230, 0.5); font-weight: 600; }
.dns-query code { font-size: 13px; }

.dns-responses { display: flex; flex-direction: column; gap: 6px; }

.dns-response {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(20, 26, 40, 0.5);
  border: 1px solid rgba(100, 140, 200, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="light"] .dns-response { background: rgba(240, 242, 245, 0.5); }

.dns-response:hover { border-color: rgba(255, 171, 0, 0.3); background: rgba(255, 171, 0, 0.06); }
.dns-response.selected { border-color: rgba(255, 171, 0, 0.4); background: rgba(255, 171, 0, 0.08); }

.dns-res-name { font-size: 13px; font-weight: 600; color: #e8eaf0; }
html[data-theme="light"] .dns-res-name { color: #1a1d23; }

.dns-res-ip {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  color: rgba(200, 210, 230, 0.4);
}

.dns-res-badge {
  font-size: 10px;
  color: #76ff03;
  font-weight: 700;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── HTTP Screen ──────────────────────────────────────── */
.http-form { display: flex; flex-direction: column; gap: 12px; }

.http-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: rgba(200, 210, 230, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

html[data-theme="light"] .http-field label { color: rgba(60, 70, 90, 0.5); }

.http-options { display: flex; flex-wrap: wrap; gap: 6px; }

.http-opt {
  padding: 6px 14px;
  background: rgba(20, 26, 40, 0.5);
  border: 1px solid rgba(100, 140, 200, 0.1);
  border-radius: 6px;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  color: rgba(200, 210, 230, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="light"] .http-opt { background: rgba(240, 242, 245, 0.5); }

.http-opt:hover { border-color: rgba(0, 229, 255, 0.3); color: #00e5ff; }
.http-opt.selected { border-color: #00e5ff; background: rgba(0, 229, 255, 0.1); color: #00e5ff; }

.http-headers, .http-header-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.http-header-line {
  padding: 6px 10px;
  background: rgba(20, 26, 40, 0.3);
  border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  flex-direction: row;
}

html[data-theme="light"] .http-header-line { background: rgba(240, 242, 245, 0.3); }

.hh-key { color: #ffab00; font-weight: 700; }
.hh-val { color: rgba(200, 210, 230, 0.6); }

.btn-send {
  padding: 10px 20px;
  background: linear-gradient(135deg, #00e5ff, #00b8d4);
  color: #0a0e17;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-send:hover:not(.disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 229, 255, 0.3); }
.btn-send.disabled { opacity: 0.3; cursor: default; }

.http-response-box {
  margin-top: 14px;
  background: rgba(118, 255, 3, 0.04);
  border: 1px solid rgba(118, 255, 3, 0.15);
  border-radius: 8px;
  padding: 14px;
}

.hr-status {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #76ff03;
  margin-bottom: 8px;
}

.hr-body { display: flex; flex-direction: column; gap: 4px; }

.hr-header-line {
  padding: 4px 0;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  display: flex;
  gap: 4px;
}

.hr-body-text {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 10px;
  color: rgba(200, 210, 230, 0.4);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(100, 140, 200, 0.08);
}

/* ── Routing Screen ───────────────────────────────────── */
.routing-path { margin-bottom: 12px; }

.rp-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(200, 210, 230, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 6px;
}

html[data-theme="light"] .rp-label { color: rgba(60, 70, 90, 0.5); }

.rp-nodes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.rp-node {
  padding: 4px 10px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 10px;
  color: #00e5ff;
  font-weight: 600;
}

.rp-arrow { color: rgba(200, 210, 230, 0.3); font-size: 10px; }
.rp-empty { font-size: 11px; color: rgba(200, 210, 230, 0.3); font-style: italic; }

.routing-result {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.routing-result.success { background: rgba(118, 255, 3, 0.08); border: 1px solid rgba(118, 255, 3, 0.2); color: #76ff03; }
.routing-result.fail { background: rgba(255, 23, 68, 0.08); border: 1px solid rgba(255, 23, 68, 0.2); color: #ff1744; }

/* ── Full Screen ──────────────────────────────────────── */
.fs-stages { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.fs-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(20, 26, 40, 0.5);
  border-radius: 8px;
  border-left: 3px solid rgba(100, 140, 200, 0.1);
}

html[data-theme="light"] .fs-stage { background: rgba(240, 242, 245, 0.5); }
.fs-stage.done { border-left-color: #76ff03; opacity: 0.7; }

.fs-stage-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.1);
  color: #00e5ff;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.fs-stage.done .fs-stage-num { background: rgba(118, 255, 3, 0.15); color: #76ff03; }

.fs-stage-name { font-size: 13px; font-weight: 600; color: #e8eaf0; }
html[data-theme="light"] .fs-stage-name { color: #1a1d23; }

.full-success {
  margin-top: 14px;
  padding: 14px;
  background: rgba(118, 255, 3, 0.06);
  border: 1px solid rgba(118, 255, 3, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fs-icon { font-size: 24px; }
.fs-text { font-size: 13px; font-weight: 600; color: #76ff03; }

/* ── Complete Screen ──────────────────────────────────── */
.complete-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 20px 20px;
  overflow-y: auto;
}

.complete-content { text-align: center; max-width: 480px; width: 100%; }

.cc-icon { font-size: 56px; margin-bottom: 16px; }

.complete-content h2 {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 24px;
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 8px;
}

html[data-theme="light"] .complete-content h2 { color: #1a1d23; }

.complete-content > p { font-size: 14px; color: rgba(200, 210, 230, 0.6); margin-bottom: 28px; }
html[data-theme="light"] .complete-content > p { color: rgba(60, 70, 90, 0.6); }

.cc-stats { display: flex; gap: 12px; justify-content: center; margin-bottom: 28px; }

.cc-stat {
  flex: 1;
  padding: 14px 10px;
  background: rgba(20, 26, 40, 0.5);
  border: 1px solid rgba(100, 140, 200, 0.1);
  border-radius: 10px;
}

html[data-theme="light"] .cc-stat { background: rgba(240, 242, 245, 0.5); }

.cc-stat-val {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: #00e5ff;
}

.cc-stat-label {
  font-size: 10px;
  color: rgba(200, 210, 230, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

html[data-theme="light"] .cc-stat-label { color: rgba(60, 70, 90, 0.4); }

.cc-summary {
  text-align: left;
  background: rgba(20, 26, 40, 0.4);
  border: 1px solid rgba(100, 140, 200, 0.08);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 24px;
}

html[data-theme="light"] .cc-summary { background: rgba(240, 242, 245, 0.4); }

.cc-summary h4 {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #00e5ff;
  margin-bottom: 10px;
}

.cc-summary ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cc-summary li { font-size: 12px; color: rgba(200, 210, 230, 0.6); line-height: 1.5; }
.cc-summary li strong { color: #e8eaf0; }
html[data-theme="light"] .cc-summary li strong { color: #1a1d23; }

/* ── Tutorial Overlay ─────────────────────────────────── */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  padding: 20px;
}

.tutorial-card {
  max-width: 380px;
  width: 100%;
  background: rgba(20, 26, 40, 0.95);
  border: 1px solid rgba(100, 140, 200, 0.15);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
}

html[data-theme="light"] .tutorial-card { background: rgba(255, 255, 255, 0.95); }

.tutorial-title {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  color: #00e5ff;
  margin-bottom: 10px;
}

.tutorial-body {
  font-size: 13px;
  color: rgba(200, 210, 230, 0.7);
  line-height: 1.6;
  margin-bottom: 20px;
}

html[data-theme="light"] .tutorial-body { color: rgba(60, 70, 90, 0.7); }

.btn-tutorial {
  padding: 10px 24px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 8px;
  color: #00e5ff;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tutorial:hover { background: rgba(0, 229, 255, 0.2); }

/* ── Level Complete Overlay ───────────────────────────── */
.level-complete-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  padding: 20px;
}

.level-complete-card {
  text-align: center;
  background: rgba(20, 26, 40, 0.95);
  border: 1px solid rgba(118, 255, 3, 0.2);
  border-radius: 16px;
  padding: 32px;
  max-width: 340px;
  width: 100%;
}

html[data-theme="light"] .level-complete-card { background: rgba(255, 255, 255, 0.95); }

.lc-icon { font-size: 48px; margin-bottom: 12px; }

.lc-title {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  color: #76ff03;
  margin-bottom: 6px;
}

.lc-score {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  color: rgba(200, 210, 230, 0.6);
  margin-bottom: 20px;
}

.btn-next {
  padding: 12px 28px;
  background: linear-gradient(135deg, #76ff03, #64dd17);
  color: #0a0e17;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-next:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(118, 255, 3, 0.3); }

/* ── Level Fail Overlay ───────────────────────────────── */
.level-fail-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  padding: 20px;
}

.level-fail-card {
  text-align: center;
  background: rgba(20, 26, 40, 0.95);
  border: 1px solid rgba(255, 23, 68, 0.2);
  border-radius: 16px;
  padding: 32px;
  max-width: 340px;
  width: 100%;
}

html[data-theme="light"] .level-fail-card { background: rgba(255, 255, 255, 0.95); }

.lf-icon { font-size: 48px; margin-bottom: 12px; }

.lf-title {
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  color: #ff1744;
  margin-bottom: 10px;
}

.lf-body { font-size: 13px; color: rgba(200, 210, 230, 0.6); line-height: 1.5; margin-bottom: 20px; }
html[data-theme="light"] .lf-body { color: rgba(60, 70, 90, 0.6); }

.btn-retry {
  padding: 12px 28px;
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: 10px;
  color: #ff1744;
  font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-retry:hover { background: rgba(255, 23, 68, 0.2); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  .top-bar { height: 44px; padding: 0 12px; }
  .logo { font-size: 13px; }
  .level-badge { font-size: 10px; padding: 2px 8px; }
  .score-display { font-size: 11px; }

  .handshake-screen, .routing-screen, .full-screen,
  .dns-screen, .http-screen {
    padding: 52px 10px 10px;
  }

  .hs-panel, .dns-panel, .http-panel, .routing-panel, .full-panel {
    max-width: 100% !important;
    max-height: 48vh;
    padding: 16px 14px;
    border-radius: 14px 14px 0 0;
  }

  .level-grid { grid-template-columns: 1fr; }
  .cc-stats { flex-direction: column; }
  .intro-features { flex-direction: column; align-items: center; }
}

@media (min-width: 768px) {
  .level-grid { grid-template-columns: repeat(2, 1fr); }
}
