:root {
  --bg: #0a0f1e;
  --bg-sidebar: #0d1326;
  --bg-surface: #121a30;
  --bg-elevated: #19233f;
  --border: #232c4a;
  --text-primary: #e7edf7;
  --text-muted: #8894b3;
  --text-faint: #5b6688;

  --accent-blue: #4d9fff;
  --accent-cyan: #5eead4;
  --accent-amber: #ffb86b;
  --accent-green: #6ee7a8;
  --accent-red: #ff6b6b;
  --accent-violet: #c792ea;

  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;

  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

button, input, textarea {
  font-family: inherit;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 640px;
}

/* ---------- Title bar ---------- */
.titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tb-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 15;
}
.sidebar-backdrop.open { display: block; }
.tb-dots { display: flex; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }
.tb-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}
.tb-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  min-width: 64px;
  text-align: right;
}

/* ---------- IDE layout ---------- */
.ide {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  overflow-y: auto;
}
.sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 4px 8px;
}
.sidebar-section-title-spaced { margin-top: 22px; }
.tree-root {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 6px 8px 10px;
}
.file-tree { display: flex; flex-direction: column; gap: 1px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 10px 6px 20px;
  border-radius: 4px;
  cursor: pointer;
}
.file-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.file-item.active {
  background: var(--bg-elevated);
  color: var(--accent-blue);
}
.file-icon {
  width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0;
}
.icon-tsx { background: var(--accent-blue); }
.icon-md { background: var(--accent-cyan); }
.icon-json { background: var(--accent-amber); }
.icon-folder { background: var(--accent-violet); }
.icon-js { background: #f1e05a; }

.sidebar-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meta-key { color: var(--accent-violet); }
.meta-val { color: var(--accent-cyan); }

/* ---------- Editor / tabs ---------- */
.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.tabs {
  display: flex;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  cursor: default;
  white-space: nowrap;
}
.tab.active {
  color: var(--text-primary);
  background: var(--bg);
  border-top: 2px solid var(--accent-blue);
}
.tab-close { color: var(--text-faint); font-size: 14px; cursor: pointer; }
.tab-close:hover { color: var(--accent-red); }

.panes {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 60px;
}
.pane { display: none; max-width: 900px; margin: 0 auto; }
.pane.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ph-icon { width: 9px; height: 9px; border-radius: 2px; }

/* ---------- Code block ---------- */
.code-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  overflow-x: auto;
}
.code-block pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.c-comment { color: var(--text-faint); }
.c-keyword { color: var(--accent-violet); }
.c-var { color: var(--text-primary); }
.c-op { color: var(--text-muted); }
.c-brace { color: var(--text-muted); }
.c-prop { color: var(--accent-blue); }
.c-string { color: var(--accent-cyan); }
.c-func { color: var(--accent-amber); }
.caret { color: var(--accent-blue); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Hero ---------- */
.hero-code { margin-top: 8px; }
.hero-tagline {
  font-size: 17px;
  color: var(--text-muted);
  margin: 22px 2px 28px;
}
.hero-actions { display: flex; gap: 14px; margin-bottom: 40px; }
.btn {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-blue); color: #06101f; }
.btn-primary:hover { background: #6bafff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-primary); }
.btn-ghost:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-num { font-family: var(--font-mono); font-size: 30px; font-weight: 700; color: var(--accent-cyan); }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

/* ---------- About ---------- */
.about-wrap { display: flex; gap: 30px; align-items: flex-start; }
.avatar {
  width: 110px; height: 110px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 34px; font-weight: 800; color: #06101f;
  flex-shrink: 0;
}
.about-text h2 { margin: 0 0 12px; font-size: 24px; }
.about-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--accent-cyan);
  padding: 5px 10px;
  border-radius: 20px;
}
.about-bio { color: var(--text-muted); line-height: 1.8; font-size: 15px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.skill-category {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.skill-category h3 {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-amber);
  margin: 0 0 16px;
  text-transform: lowercase;
}
.skill-row { margin-bottom: 14px; }
.skill-row:last-child { margin-bottom: 0; }
.skill-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; color: var(--text-primary); }
.skill-bar-track { height: 6px; border-radius: 4px; background: var(--bg-elevated); overflow: hidden; }
.skill-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.project-thumb { height: 90px; }
.project-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.project-body h3 { margin: 0 0 8px; font-size: 16px; }
.project-body p { margin: 0 0 14px; color: var(--text-muted); font-size: 13.5px; line-height: 1.6; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-elevated);
  color: var(--accent-cyan);
  padding: 3px 8px;
  border-radius: 4px;
}

/* ---------- Blog ---------- */
.blog-list { display: flex; flex-direction: column; gap: 16px; }
.blog-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
}
.blog-item h3 { margin: 0 0 6px; font-size: 16px; }
.blog-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-amber); margin-bottom: 10px; display: block; }
.blog-excerpt { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0; }
.blog-content { color: var(--text-primary); font-size: 14px; line-height: 1.7; margin-top: 12px; display: none; }
.blog-item.open .blog-content { display: block; }

/* ---------- Contact ---------- */
.contact-code { margin-bottom: 26px; }
.contact-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-violet);
}
.field input, .field textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.contact-form .btn { align-self: flex-start; }
.contact-form .btn:disabled { opacity: .6; cursor: not-allowed; }

.terminal {
  background: #000814;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 26px;
}
.terminal-header {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.terminal-body {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 14px;
  color: var(--accent-green);
  min-height: 20px;
}
.term-prompt { color: var(--accent-blue); margin-right: 8px; }
.terminal-body.err { color: var(--accent-red); }

.contact-links { display: flex; gap: 12px; flex-wrap: wrap; }
.contact-links a {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
}
.contact-links a:hover { color: var(--accent-blue); border-color: var(--accent-blue); }

.loading { color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; }

/* ---------- Status bar ---------- */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 26px;
  padding: 0 14px;
  background: var(--accent-blue);
  flex-shrink: 0;
}
.sb-left, .sb-right { display: flex; gap: 16px; }
.sb-item {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #06101f;
  font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .tb-menu-btn { display: block; }
  .sidebar { position: fixed; top: 40px; left: 0; z-index: 20; height: calc(100vh - 40px - 26px); transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .panes { padding: 24px 18px 60px; }
  .about-wrap { flex-direction: column; align-items: center; text-align: center; }
  .hero-stats { grid-template-columns: 1fr; }
  .tb-title { font-size: 11px; }
}
