:root {
  /* Tokyo Night (Default) */
  --bg:           #1a1b26;
  --win-bg:       rgba(26, 27, 38, 0.65);
  --win-border:   rgba(255, 255, 255, 0.08);
  --titlebar-bg:  rgba(22, 22, 30, 0.7);
  --fg:           #a9b1d6;
  --fg-dim:       #787c99;
  --fg-subtle:    #565f89;
  --purple:       #bb9af7;
  --blue:         #7aa2f7;
  --cyan:         #7dcfff;
  --green:        #9ece6a;
  --red:          #f7768e;
  --yellow:       #e0af68;
  --peach:        #ff9e64;

  --titlebar-h:   42px;
  --win-w:        clamp(320px, 96vw, 1500px);
  --win-h:        clamp(450px, 90vh, 1000px);
}

body.theme-cyber {
  --bg:           #0d0d0d;
  --win-bg:       rgba(10, 10, 10, 0.85);
  --win-border:   rgba(255, 0, 60, 0.2);
  --titlebar-bg:  rgba(0, 0, 0, 0.9);
  --fg:           #e0e0e0;
  --fg-dim:       #888888;
  --fg-subtle:    #444444;
  --purple:       #ff003c;
  --blue:         #00f0ff;
  --cyan:         #00ff9f;
  --green:        #39ff14;
  --red:          #ff003c;
  --yellow:       #f3e600;
  --peach:        #ff5c00;
}

body.theme-oceanic {
  --bg:           #0f172a;
  --win-bg:       rgba(15, 23, 42, 0.7);
  --win-border:   rgba(255, 255, 255, 0.05);
  --titlebar-bg:  rgba(2, 6, 23, 0.8);
  --fg:           #cbd5e1;
  --fg-dim:       #64748b;
  --fg-subtle:    #334155;
  --purple:       #818cf8;
  --blue:         #38bdf8;
  --cyan:         #22d3ee;
  --green:        #4ade80;
  --red:          #fb7185;
  --yellow:       #fbbf24;
  --peach:        #fb923c;
}

body.theme-light {
  --bg:           #f1f5f9;
  --win-bg:       rgba(255, 255, 255, 0.85);
  --win-border:   rgba(0, 0, 0, 0.06);
  --titlebar-bg:  rgba(241, 245, 249, 0.9);
  --fg:           #1e293b;
  --fg-dim:       #475569;
  --fg-subtle:    #94a3b8;
  --purple:       #7c3aed;
  --blue:         #2563eb;
  --cyan:         #0891b2;
  --green:        #16a34a;
  --red:          #dc2626;
  --yellow:       #ca8a04;
  --peach:        #ea580c;
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  overflow: hidden;
  transition: background 0.5s ease;
}

/* ── Background Elements ── */
#bg-canvas { position: fixed; inset: 0; z-index: 1; opacity: 0.4; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 2;
  opacity: 0.15;
  pointer-events: none;
}
.orb-1 { width: 400px; height: 400px; background: var(--purple); top: -100px; right: -50px; animation: drift1 20s infinite alternate; }
.orb-2 { width: 350px; height: 350px; background: var(--blue); bottom: -50px; left: -50px; animation: drift2 25s infinite alternate-reverse; }
.orb-3 { width: 300px; height: 300px; background: var(--cyan); top: 40%; left: 10%; animation: drift3 18s infinite alternate; }

@keyframes drift1 { from { transform: translate(0,0); } to { transform: translate(-10%, 10%); } }
@keyframes drift2 { from { transform: translate(0,0); } to { transform: translate(15%, -10%); } }
@keyframes drift3 { from { transform: translate(0,0); } to { transform: translate(-5%, 5%); } }

/* ── Layout ── */
#scene {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#window {
  position: relative;
  width: var(--win-w);
  height: var(--win-h);
  display: flex;
  flex-direction: column;
  background: var(--win-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--win-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  animation: window-appear 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes window-appear {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

#titlebar {
  display: flex;
  align-items: center;
  height: var(--titlebar-h);
  padding: 0 16px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.traffic-lights { display: flex; gap: 8px; margin-right: 20px; }
.tl { width: 12px; height: 12px; border-radius: 50%; }
.tl-red { background: #ff5f56; }
.tl-yellow { background: #ffbd2e; }
.tl-green { background: #27c93f; }

#tab-title { font-size: 12px; color: var(--fg-dim); flex: 1; text-align: center; font-weight: 500; }
.titlebar-right { font-size: 11px; color: var(--fg-subtle); letter-spacing: 1px; text-transform: uppercase; }

.window-content { display: flex; flex: 1; overflow: hidden; }

/* ── Terminal Pane ── */
.pane-terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  position: relative;
}

#terminal { display: flex; flex-direction: column; flex: 1; }
#output { flex: 1; }

/* ── Blog Pane ── */
.pane-blog {
  width: 0;
  overflow: hidden;
  border-left: 1px solid transparent;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), border 0.4s ease;
  background: rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}

body.theme-light .pane-blog { background: rgba(0,0,0,0.02); }
body.theme-cyber .pane-blog { background: rgba(255, 0, 60, 0.03); }

.pane-blog.active {
  width: 750px;
  border-left: 1px solid var(--win-border);
}

.dashboard-header {
  height: var(--titlebar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

body.theme-light .dashboard-header { background: rgba(0,0,0,0.03); border-bottom-color: rgba(0,0,0,0.05); }

.d-title { 
  font-size: 10px; 
  font-weight: 800; 
  color: var(--purple); 
  letter-spacing: 3px; 
  text-transform: uppercase; 
  opacity: 0.8;
}

.d-close {
  background: none;
  border: none;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}
.d-close:hover { background: rgba(255,0,0,0.1); color: var(--red); transform: rotate(90deg); }

.dashboard-body { flex: 1; display: flex; overflow: hidden; }

.dashboard-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
  opacity: 0.3;
  text-align: center;
  padding: 40px;
}
.dashboard-placeholder .p-icon { font-size: 4em; margin-bottom: 20px; }
.dashboard-placeholder .p-text { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; }

/* ── Reader Elements ── */
.blog-reader { display: flex; height: 100%; width: 100%; overflow: hidden; }
.reader-sidebar {
  width: 240px;
  background: rgba(0,0,0,0.05);
  border-right: 1px solid rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
}

body.theme-light .reader-sidebar { background: rgba(0,0,0,0.03); border-right-color: rgba(0,0,0,0.05); }
body.theme-cyber .reader-sidebar { border-right-color: rgba(255,0,60,0.1); }

.reader-item { 
  padding: 14px 24px; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
  border-left: 3px solid transparent; 
  margin-bottom: 4px;
}

.reader-item:hover { 
  background: rgba(255,255,255,0.04); 
  padding-left: 28px;
}

body.theme-light .reader-item:hover { background: rgba(0,0,0,0.03); }

.reader-item.active { 
  background: rgba(187, 154, 247, 0.1); 
  border-left-color: var(--purple); 
  padding-left: 28px;
}

body.theme-light .reader-item.active { background: rgba(124, 58, 237, 0.08); }

.reader-item .item-date { font-size: 9px; color: var(--fg-subtle); margin-bottom: 6px; display: block; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.reader-item .item-title { font-size: 13px; color: var(--fg-dim); font-weight: 500; line-height: 1.4; }
.reader-item.active .item-title { color: var(--fg); font-weight: 700; }

.reader-main { 
  flex: 1; 
  padding: 40px 60px; 
  overflow-y: auto; 
  line-height: 1.8; 
  background: rgba(255,255,255,0.01);
  scroll-behavior: smooth;
}

body.theme-light .reader-main { background: #ffffff; }

/* Headers */
.reader-main h1 { 
  font-size: 2.2em; 
  color: var(--purple); 
  margin-bottom: 0.8em; 
  font-weight: 800; 
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.reader-main h2 { 
  font-size: 1.5em; 
  color: var(--blue); 
  margin: 2em 0 1em; 
  font-weight: 700; 
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-main h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--purple);
  border-radius: 2px;
  opacity: 0.6;
}

.reader-main h3 {
  font-size: 1.2em;
  color: var(--cyan);
  margin: 1.5em 0 0.8em;
  font-weight: 600;
}

/* Text Elements */
.reader-main p { 
  margin-bottom: 1.5em; 
  color: var(--fg-dim); 
  font-size: 16px; 
  opacity: 0.95;
}

.reader-main strong {
  color: var(--fg);
  font-weight: 700;
}

/* Lists */
.reader-main ul, .reader-main ol {
  margin-bottom: 1.5em;
  padding-left: 1.2em;
}

.reader-main li {
  margin-bottom: 0.6em;
  color: var(--fg-dim);
  position: relative;
}

.reader-main ul li::before {
  content: '•';
  color: var(--purple);
  font-weight: bold;
  display: inline-block; 
  width: 1em;
  margin-left: -1em;
}

/* Blockquotes */
.reader-main blockquote {
  margin: 2em 0;
  padding: 1.5em 2em;
  background: rgba(187, 154, 247, 0.05);
  border-left: 4px solid var(--purple);
  border-radius: 0 12px 12px 0;
  font-style: italic;
}

body.theme-light blockquote {
  background: #f8fafc;
}

.reader-main blockquote p {
  margin-bottom: 0;
  color: var(--fg);
}

/* Code & HR */
.reader-main code { 
  background: rgba(255,255,255,0.08); 
  padding: 3px 8px; 
  border-radius: 6px; 
  color: var(--cyan); 
  font-size: 0.9em;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(255,255,255,0.05);
}

body.theme-light code {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.05);
  color: #0f172a;
}

.reader-main hr { 
  border: none; 
  border-top: 1px solid rgba(255,255,255,0.08); 
  margin: 40px 0; 
}

body.theme-light hr { border-top-color: rgba(0,0,0,0.05); }

/* Links */
.reader-main a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(122, 162, 247, 0.3);
  transition: all 0.2s;
}

.reader-main a:hover {
  color: var(--purple);
  border-bottom-color: var(--purple);
  background: rgba(187, 154, 247, 0.1);
}

/* ── Input ── */
#input-line { display: flex; align-items: center; margin-top: 10px; }
.ps1 { display: flex; gap: 4px; white-space: nowrap; margin-right: 12px; font-weight: 600; font-size: 14px; }
.ps1-user { color: var(--purple); }
.ps1-host { color: var(--blue); }
.ps1-dir { color: var(--yellow); }
.ps1-branch { color: var(--fg-subtle); font-weight: 400; opacity: 0.8; }
.ps1-arrow { color: var(--purple); }

.input-wrapper { position: relative; flex: 1; display: flex; align-items: center; }
#cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  padding: 0;
  caret-color: transparent;
}
#cursor-block {
  position: absolute;
  left: 0;
  width: 8px;
  height: 18px;
  background: var(--purple);
  box-shadow: 0 0 10px var(--purple);
  animation: blink 1s infinite;
  pointer-events: none;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Commands & Components ── */
.line { font-size: 14px; line-height: 1.6; margin-bottom: 2px; }
.section-head { color: var(--fg-subtle); font-style: italic; margin-bottom: 10px; display: block; }
.c-purple { color: var(--purple); }
.c-blue { color: var(--blue); }
.c-cyan { color: var(--cyan); }
.c-green { color: var(--green); }
.c-red { color: var(--red); }
.c-yellow { color: var(--yellow); }
.c-dim { color: var(--fg-dim); }
.bold { font-weight: 700; }
.divider { display: block; border-top: 1px solid rgba(255,255,255,0.05); margin: 10px 0; }

.project-card {
  margin: 15px 0;
  padding: 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  transition: all 0.3s;
}
.project-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.project-name { color: var(--cyan); font-weight: 700; text-decoration: none; font-size: 16px; }
.project-meta { font-size: 12px; color: var(--fg-subtle); }
.project-desc { color: var(--fg-dim); font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.project-lang { font-size: 11px; color: var(--purple); opacity: 0.8; letter-spacing: 0.5px; }

.skill-row { display: flex; align-items: center; gap: 15px; margin-bottom: 12px; }
.skill-name { width: 120px; font-size: 13px; color: var(--fg-dim); }
.skill-bar-bg { flex: 1; height: 6px; background: rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; }
.skill-bar-fill { height: 100%; border-radius: 10px; transition: width 1s ease-out; }
.skill-pct { width: 40px; text-align: right; font-size: 11px; color: var(--fg-subtle); }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

/* ── Mobile ── */
@media (max-width: 900px) {
  .pane-blog.active { width: 100%; position: absolute; inset: 0; z-index: 100; border-left: none; }
  #window { border-radius: 0; width: 100vw; height: 100vh; }
  .reader-sidebar { width: 150px; }
}

::selection { background: var(--purple); color: #fff; }
