/* Dracula palette. */

:root {
  --bg: #282a36;
  --surface: #2d2f3d;
  --surface-alt: #383a4c;
  --surface-warm: #353749;
  --surface-recess: #21222c;
  --border: rgba(98, 114, 164, 0.28);
  --border-strong: rgba(98, 114, 164, 0.55);
  --text: #f8f8f2;
  --text-muted: #c5c8d6;
  --text-subtle: #6272a4;
  --accent: #bd93f9;
  --accent-soft: #44475a;
  --accent-deep: #ff79c6;

  --good: #50fa7b;
  --good-bg: #1f3329;
  --warn: #ffb86c;
  --warn-bg: #3a2e1e;
  --bad: #ff5555;
  --bad-bg: #3a1e1e;
  --info: #8be9fd;
  --info-bg: #1c2e34;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 4px 22px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --radius-lg: 14px;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 56px 1fr; height: 100vh; height: 100dvh; }
.topbar {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 40;
}
.topbar h1 { font-size: 15px; font-weight: 700; color: var(--accent); }
.topbar .k8s-logo { font-size: 20px; color: var(--accent); }
.topbar .score-badge {
  margin-left: auto;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.topbar .score-badge span { color: var(--good); font-weight: 700; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-size: 16px;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-warm); border-color: var(--border-strong); }
.menu-btn { display: none; }

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
}
.sidebar-section { padding: 6px 16px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-muted); text-transform: uppercase; }
.topic-btn {
  display: flex; align-items: center;
  width: 100%;
  padding: 8px 16px;
  border: none; background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit; font-size: 13px;
  text-align: left;
  gap: 8px;
  transition: background .15s, color .15s;
}
.topic-btn:hover { background: var(--surface-warm); color: var(--text); }
.topic-btn.active { background: var(--accent-soft); color: var(--accent); border-right: 2px solid var(--accent); }
.topic-btn .count { margin-left: auto; font-size: 11px; background: var(--surface-alt); border-radius: 10px; padding: 1px 7px; }
.topic-btn.active .count { background: var(--surface); color: var(--accent); }
.progress-mini { height: 3px; background: var(--surface-alt); border-radius: 2px; margin: 0 16px 8px; overflow: hidden; }
.progress-mini-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 56px 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 30;
}
.sidebar-backdrop.show { display: block; }

/* Main */
.main { overflow-y: auto; overflow-x: hidden; padding: 24px; min-width: 0; }
.topic-header { margin-bottom: 20px; }
.topic-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }

/* Docs Nav panel */
.docs-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.docs-nav h3 { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.docs-nav-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.docs-item {
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.docs-item .path { font-size: 10px; color: var(--text-muted); margin-bottom: 3px; }
.docs-item a { font-size: 12px; color: var(--accent); text-decoration: none; word-break: break-word; }
.docs-item a:hover { text-decoration: underline; }
.docs-item .search-tip { font-size: 10px; color: var(--text-muted); margin-top: 3px; font-style: italic; }

/* Question cards */
.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.q-card.failed { border-left: 3px solid var(--bad); }
.q-card.known { border-left: 3px solid var(--good); opacity: .65; }
.q-header { padding: 14px 16px; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.q-num { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface-alt); border-radius: 4px; padding: 2px 7px; flex-shrink: 0; margin-top: 1px; }
.q-title { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.4; min-width: 0; }
.q-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 600; }
.tag-fail { background: var(--bad-bg); color: var(--bad); }
.tag-hard { background: var(--warn-bg); color: var(--warn); }
.tag-med  { background: var(--info-bg); color: var(--info); }
.tag-easy { background: var(--good-bg); color: var(--good); }
.chevron { color: var(--text-muted); transition: transform .2s; font-size: 12px; padding-top: 2px; }
.q-card.open .chevron { transform: rotate(90deg); }
.q-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--border); }
.q-card.open .q-body { display: block; }
.q-scenario { font-size: 13px; color: var(--text); line-height: 1.65; padding: 12px 0 10px; }
.q-scenario code { background: var(--surface-recess); border: 1px solid var(--border); padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: 12px; color: var(--info); }

/* Hint panel */
.hint-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
  transition: background .15s;
}
.hint-btn:hover { background: var(--accent-soft); }
.hint-panel {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: none;
}
.hint-panel.show { display: block; }
.hint-panel h4 { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 8px; }
.hint-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; font-size: 12px; }
.hint-label { color: var(--text-muted); min-width: 70px; flex-shrink: 0; }
.hint-row a { color: var(--accent); text-decoration: none; word-break: break-all; }
.hint-row a:hover { text-decoration: underline; }
.hint-search { font-style: italic; color: var(--accent-deep); }

/* Answer panel */
.answer-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--good-bg);
  border: 1px solid var(--good);
  color: var(--good);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  margin-left: 8px;
  font-family: inherit;
  transition: opacity .15s;
}
.answer-btn:hover { opacity: .85; }
.answer-panel {
  background: var(--surface-recess);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  display: none;
}
.answer-panel.show { display: block; }
.answer-panel h4 { font-size: 11px; font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.answer-panel .explanation { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.answer-panel .explanation .highlight { color: var(--warn); font-weight: 700; }
.answer-panel .explanation code { background: var(--surface-alt); border: 1px solid var(--border); padding: 1px 4px; border-radius: 3px; font-family: var(--font-mono); font-size: 11.5px; color: var(--info); }
pre { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; color: var(--text); overflow-x: auto; white-space: pre; }

/* Mark buttons */
.mark-row { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.mark-known { background: var(--good-bg); border: 1px solid var(--good); color: var(--good); border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.mark-known:hover { opacity: .85; }
.mark-review { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn); border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.mark-review:hover { opacity: .85; }
.mark-status { font-size: 11px; color: var(--text-muted); margin-left: auto; align-self: center; }

/* Home: focus cards */
.focus-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.focus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
  min-width: 0;
  box-shadow: var(--shadow-card);
}
.focus-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.focus-card .fc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.focus-card .fc-head .ph { font-size: 18px; color: var(--accent); flex-shrink: 0; }
.focus-card h3 { font-size: 14px; font-weight: 700; flex: 1; min-width: 0; }
.focus-card .fc-count { font-size: 11px; color: var(--text-muted); background: var(--surface-alt); border-radius: 10px; padding: 1px 8px; flex-shrink: 0; }
.focus-card .fc-titles { list-style: none; padding: 0; margin: 0; flex: 1; }
.focus-card .fc-titles li {
  font-size: 12px; line-height: 1.45;
  color: var(--text-muted);
  padding: 3px 0 3px 10px;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-card .fc-titles li::before {
  content: '';
  position: absolute;
  left: 0; top: 10px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-subtle);
}
.focus-card .fc-titles li.priority::before { background: var(--bad); }
.focus-card .fc-titles li.known { color: var(--text-subtle); text-decoration: line-through; }
.focus-card .fc-titles li.known::before { background: var(--good); }
.focus-card .fc-titles li.more { color: var(--text-muted); font-style: italic; padding-left: 0; }
.focus-card .fc-titles li.more::before { display: none; }
.focus-card .fc-empty { font-size: 12px; color: var(--text-muted); font-style: italic; flex: 1; padding: 4px 0 8px; }
.focus-card .fc-progress { height: 3px; background: var(--surface-alt); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.focus-card .fc-fill { height: 100%; background: var(--accent); transition: width .3s; }

/* Focus + KodeKloud panels (bottom of topic page) */
.gotchas-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.gotchas-panel.kk-panel { border-left-color: var(--info); }
.gotchas-panel h3 { font-size: 12px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px; }
.gotchas-panel.kk-panel h3 { color: var(--info); }
.gotchas-panel h3 .ph { font-size: 14px; margin-right: 6px; vertical-align: -0.18em; }
.gotchas-items { display: flex; flex-direction: column; gap: 14px; }
.gotchas-item { padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.gotchas-item:last-child { border-bottom: none; padding-bottom: 0; }
.gotchas-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.gotchas-note { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin-bottom: 8px; }
.gotchas-cmd {
  background: var(--surface-recess);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
}
.kk-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kk-list li { display: flex; align-items: baseline; gap: 10px; font-size: 13px; padding: 4px 0; }
.kk-list li::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--info);
  flex-shrink: 0;
  margin-top: 2px;
}
.kk-lab { color: var(--text); font-weight: 600; }
.kk-module { color: var(--text-muted); font-size: 11px; font-style: italic; }
.kk-module::before { content: '· '; }

/* Misc */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.filter-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Phosphor icons, unified */
.ph { vertical-align: -0.12em; line-height: 1; flex-shrink: 0; }
.topic-btn .ph { font-size: 16px; color: inherit; }
.topic-header h2 .ph { font-size: 22px; color: var(--accent); margin-right: 6px; vertical-align: -0.18em; }
.docs-nav h3 .ph { font-size: 14px; margin-right: 4px; }
.docs-item .ph { font-size: 12px; vertical-align: -0.1em; }
.hint-btn .ph, .answer-btn .ph, .mark-known .ph, .mark-review .ph { font-size: 14px; margin-right: 2px; }
.chevron.ph { font-size: 14px; }
.empty-state .ph { font-size: 40px; color: var(--good); margin-bottom: 12px; }
.mark-status .ph { font-size: 12px; margin-right: 3px; }

/* Responsive */
@media (max-width: 1100px) {
  .focus-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 56px; left: 0;
    width: min(280px, 80vw);
    height: calc(100dvh - 56px);
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 35;
    box-shadow: var(--shadow-lift);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px; grid-column: 1 / -1; }
  .topbar { padding: 0 12px; }
  .topbar h1 { font-size: 14px; }
  .topbar .score-badge { padding: 3px 10px; font-size: 11px; }
  .focus-hero { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .docs-nav-grid { grid-template-columns: minmax(0, 1fr); }
  .topic-header h2 { font-size: 18px; }
  .q-header { flex-wrap: wrap; }
  .q-meta { width: 100%; padding-left: 36px; }
}
@media (max-width: 420px) {
  .topbar h1 { display: none; }
}
