/* =====================================================
   64c_OS v2 — Green Minimal OS Theme
   ===================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green:        #00ff41;
  --green-dim:    #00cc33;
  --green-dark:   #005c1a;
  --bg:           #060c06;
  --bg-panel:     #0b160b;
  --bg-window:    #090f09;
  --border:       #183018;
  --border-hi:    #2a5a2a;
  --text:         #00ff41;
  --text-dim:     #4a8a4a;
  --text-muted:   #2a4a2a;
  --taskbar-h:    40px;
  --terminal-h:   200px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#hypercube-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  user-select: none;
}

/* CRT scanlines overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.10) 2px,
    rgba(0, 0, 0, 0.10) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* =====================================================
   LUCIDE ICON SIZING (global SVG rules)
   ===================================================== */
svg { display: inline-block; vertical-align: middle; }

.win-title     svg { width: 13px; height: 13px; stroke-width: 1.5; }
.tb-btn        svg { width: 11px; height: 11px; stroke-width: 1.5; }
.os-btn        svg { width: 12px; height: 12px; stroke-width: 1.5; }
.ctx-item      svg { width: 11px; height: 11px; stroke-width: 1.5; }
.icon-glyph    svg { width: 20px; height: 20px; stroke-width: 1.5; }
.contact-row   svg { width: 13px; height: 13px; stroke-width: 1.5; }
.detail-back   svg { width: 12px; height: 12px; stroke-width: 1.5; }
#term-titlebar svg { width: 13px; height: 13px; stroke-width: 1.5; }
.status-badge  svg { width: 8px;  height: 8px;  stroke-width: 2.5; }
.skill-cat-label > svg { width: 11px; height: 11px; stroke-width: 1.5; }
.app-section-title svg { width: 11px; height: 11px; stroke-width: 1.5; }
.strength-item svg { width: 14px; height: 14px; stroke-width: 1.5; }

/* =====================================================
   BOOT SCREEN
   ===================================================== */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.boot-lines {
  width: 520px;
  max-width: 90vw;
}

.boot-line {
  font-size: 12px;
  line-height: 1.9;
  opacity: 0;
  animation: bootFade 0.06s ease forwards;
  white-space: pre;
  color: #00cc33;
}

.boot-line.ok::after {
  content: '   [ OK ]';
  color: #00ff41;
}

.boot-line.dim { color: #1a3a1a; }
.boot-line.err::after { content: '  [ FAIL ]'; color: #ff5050; }

.boot-line.title {
  color: #00ff41;
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: 4px;
  font-weight: bold;
}

@keyframes bootFade {
  to { opacity: 1; }
}

/* =====================================================
   TASKBAR (TOP)
   ===================================================== */
#taskbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  z-index: 1000;
}

.tb-logo {
  font-size: 11px;
  font-weight: bold;
  color: var(--green);
  letter-spacing: 4px;
  text-transform: uppercase;
  padding-right: 14px;
  border-right: 1px solid var(--border-hi);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tb-logo svg { width: 14px; height: 14px; stroke-width: 1.5; }

#tb-apps {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}

.tb-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tb-btn:hover {
  border-color: var(--green-dim);
  color: var(--green-dim);
}

.tb-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(0, 255, 65, 0.08);
}

.tb-btn.minimized { opacity: 0.45; }

#tb-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

#tb-clock {
  font-size: 12px;
  color: var(--green);
  letter-spacing: 1px;
}

#tb-host {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border-hi);
}

#tb-host svg { width: 11px; height: 11px; stroke-width: 1.5; }

#tb-ip {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border-hi);
}

#tb-ip svg { width: 11px; height: 11px; stroke-width: 1.5; }

/* =====================================================
   DESKTOP
   ===================================================== */
#desktop {
  position: fixed;
  top: var(--taskbar-h);
  left: 0;
  right: 0;
  bottom: var(--terminal-h);
  overflow: hidden;
}

/* Grid dot pattern */
#desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(0, 255, 65, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* =====================================================
   DESKTOP ICONS
   ===================================================== */
#icon-grid {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 70px;
  padding: 7px 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.12s, background 0.12s;
}

.desktop-icon:hover,
.desktop-icon.selected {
  border-color: var(--border-hi);
  background: rgba(0, 255, 65, 0.05);
}

.desktop-icon.selected { border-color: var(--green); }

.icon-glyph {
  width: 42px;
  height: 42px;
  border: 1px solid var(--green-dark);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.desktop-icon:hover .icon-glyph,
.desktop-icon.selected .icon-glyph {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.22);
  background: rgba(0, 255, 65, 0.07);
}

.icon-label {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
}

/* =====================================================
   OS WINDOWS
   ===================================================== */
.os-window {
  position: absolute;
  background: var(--bg-window);
  border: 1px solid var(--border-hi);
  min-width: 300px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8), 0 0 14px rgba(0, 255, 65, 0.05);
  z-index: 100;
}

.os-window.focused {
  border-color: var(--green);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.9), 0 0 22px rgba(0, 255, 65, 0.13);
  z-index: 200;
}

.os-window.minimized { display: none; }

/* Title bar */
.win-titlebar {
  height: 30px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}

.win-titlebar:active { cursor: grabbing; }
.os-window.focused .win-titlebar { border-bottom-color: var(--green-dark); }

.win-title {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.os-window.focused .win-title { color: var(--green-dim); }

.win-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.win-btn {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.win-btn svg { width: 11px; height: 11px; stroke-width: 2; }

.win-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.win-btn.close-btn:hover {
  border-color: #ff5050;
  color: #ff5050;
}

.win-btn.max-btn:hover {
  border-color: var(--green-dim);
  color: var(--green-dim);
}

/* When window is maximized the titlebar cursor becomes default (no drag) */
.os-window.maximized .win-titlebar {
  cursor: default;
}

/* Window content */
.win-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.7;
  user-select: text;
}

.win-body::-webkit-scrollbar { width: 4px; }
.win-body::-webkit-scrollbar-track { background: var(--bg); }
.win-body::-webkit-scrollbar-thumb { background: var(--green-dark); }
.win-body::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* Resize handle */
.win-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
}

.win-resize::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-bottom: 2px solid var(--border-hi);
  border-right: 2px solid var(--border-hi);
}

/* =====================================================
   APP CONTENT — SHARED
   ===================================================== */
.app-section {
  margin-bottom: 16px;
}

.app-section-title {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-section-title::before {
  content: '>';
  color: var(--green-dark);
  font-size: 11px;
}

/* =====================================================
   ABOUT APP
   ===================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 1.6s step-end infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.stat-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 10px 8px;
  text-align: center;
}

.stat-num {
  font-size: 22px;
  color: var(--green);
  font-weight: bold;
  line-height: 1;
}

.stat-lbl {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* =====================================================
   SKILLS APP
   ===================================================== */
.skill-bar-row {
  margin-bottom: 9px;
}

.skill-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.skill-bar-track {
  height: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-category {
  margin-bottom: 12px;
}

.skill-cat-label {
  font-size: 10px;
  color: var(--green-dim);
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.skill-tag {
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 7px;
  font-size: 10px;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s;
}

.skill-tag:hover {
  border-color: var(--border-hi);
  color: var(--text-dim);
}

/* =====================================================
   PROJECTS APP
   ===================================================== */
.project-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 11px 13px;
  margin-bottom: 8px;
  transition: border-color 0.12s, background 0.12s;
}

.project-card:hover {
  border-color: var(--border-hi);
  background: rgba(0, 255, 65, 0.025);
}

.project-title {
  color: var(--green);
  font-size: 12px;
  margin-bottom: 3px;
}

.project-title::before { content: '[ '; color: var(--green-dark); }
.project-title::after  { content: ' ]'; color: var(--green-dark); }

.project-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.project-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

.detail-back {
  font-size: 11px;
  color: var(--green-dim);
  cursor: pointer;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-family: inherit;
  transition: color 0.12s;
}

.detail-back:hover { color: var(--green); }

.proj-detail-body {
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-dim);
  user-select: text;
}

.proj-detail-body h1,
.proj-detail-body h2,
.proj-detail-body h3,
.proj-detail-body h4 {
  color: var(--green);
  font-size: 13px;
  margin: 12px 0 5px;
}

.proj-detail-body img {
  max-width: 100%;
  border: 1px solid var(--border);
  margin: 8px 0;
  display: block;
}

.proj-detail-body a { color: var(--green-dim); }
.proj-detail-body ul,
.proj-detail-body ol { padding-left: 18px; }

.proj-detail-body code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0 4px;
  font-family: inherit;
  color: var(--green-dim);
  font-size: 11px;
}

.proj-detail-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 11px;
}

/* =====================================================
   CONTACT APP
   ===================================================== */
.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  margin-bottom: 7px;
  transition: border-color 0.12s;
  text-decoration: none;
  cursor: pointer;
  color: var(--text-dim);
}

.contact-row:hover { border-color: var(--green-dim); }

.contact-row span {
  font-size: 12px;
  font-family: inherit;
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 11px;
  color: var(--green-dim);
  overflow-x: auto;
  white-space: pre;
  margin-top: 4px;
  font-family: inherit;
}

.code-highlight { color: var(--green); }

/* =====================================================
   SHARED BUTTON STYLE
   ===================================================== */
.os-btn {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.os-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

/* Loading spinner */
.spin-loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   TERMINAL (BOTTOM DOCKED)
   ===================================================== */
#terminal-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--terminal-h);
  background: var(--bg-panel);
  border-top: 1px solid var(--border-hi);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: height 0.18s ease;
}

#terminal-dock.collapsed { height: 28px; }

#term-titlebar {
  height: 28px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

#term-titlebar span {
  flex: 1;
  font-size: 11px;
  color: var(--green-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#term-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
  font-family: inherit;
  transition: color 0.12s;
}

#term-collapse-btn:hover { color: var(--green); }

#term-output {
  flex: 1;
  overflow-y: auto;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.65;
}

#terminal-dock.collapsed #term-output,
#terminal-dock.collapsed #term-input-row { display: none; }

#term-output::-webkit-scrollbar { width: 3px; }
#term-output::-webkit-scrollbar-thumb { background: var(--green-dark); }

.tl { color: var(--text-dim); white-space: pre-wrap; word-break: break-all; }
.tl.cmd { color: var(--green); }
.tl.cmd::before { content: '$ '; color: var(--green-dark); }
.tl.err { color: #ff6b6b; }
.tl.ok  { color: var(--green); }
.tl.inf { color: #44aaff; }

#term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 5px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.term-prompt {
  color: var(--green-dark);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

#term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: inherit;
  font-size: 12px;
  caret-color: var(--green);
}

/* =====================================================
   CONTEXT MENU
   ===================================================== */
#ctx-menu {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-hi);
  padding: 4px 0;
  min-width: 160px;
  z-index: 9000;
  display: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

.ctx-item {
  padding: 5px 14px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: inherit;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}

.ctx-item:hover {
  background: rgba(0, 255, 65, 0.07);
  color: var(--green);
}

.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/* ── Mobile Responsive ───────────────────────────── */
@media (max-width: 768px) {
  /* Taskbar: hide host/IP, clock, compact layout */
  .tb-host, .tb-ip, #tb-clock { display: none; }
  .taskbar { padding: 0 6px; gap: 4px; }
  .tb-btn { font-size: 10px; padding: 3px 6px; gap: 3px; }
  .tb-btn svg { width: 12px; height: 12px; }

  /* Icon grid: horizontal wrap instead of vertical column */
  #icon-grid {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px;
    gap: 16px;
  }
  .desktop-icon { width: 72px; }
  .icon-glyph { width: 44px; height: 44px; }
  .icon-label { font-size: 10px; }

  /* Windows: always full-screen on mobile */
  .os-window {
    width: 100% !important;
    height: calc(100% - var(--taskbar-h)) !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0;
  }
  .win-resize { display: none; }
  .win-controls .maximize { display: none; }
  .win-titlebar { cursor: default; }

  /* Larger tap targets for window controls */
  .win-controls button { width: 32px; height: 32px; }

  /* Terminal: shorter default, larger input */
  #terminal-dock { --terminal-h: 140px; }
  .term-input { font-size: 14px; }

  /* Context menu: wider on mobile */
  #ctx-menu { min-width: 180px; }
  .ctx-item { padding: 10px 14px; font-size: 13px; }
}
