/* ===== VARIABLES ===== */
:root {
  --bg-editor:       #1e1e1e;
  --bg-sidebar:      #252526;
  --bg-activity:     #333333;
  --bg-titlebar:     #3c3c3c;
  --bg-tab-inactive: #2d2d2d;
  --bg-tab-active:   #1e1e1e;
  --bg-statusbar:    #007acc;
  --bg-hover:        #2a2d2e;
  --bg-selected:     #094771;
  --bg-inline-code:  #2d2d2d;

  --text-primary:  #cccccc;
  --text-dim:      #858585;
  --text-muted:    #555555;
  --text-white:    #ffffff;

  --border:    #1e1e1e;
  --accent:    #007acc;

  --syn-h1:        #4fc1ff;
  --syn-h2:        #9cdcfe;
  --syn-h3:        #ce9178;
  --syn-blockquote:#6a9955;
  --syn-bold:      #ffffff;
  --syn-italic:    #d7ba7d;
  --syn-link:      #4ec9b0;
  --syn-code:      #ce9178;
  --syn-codeblock: #9cdcfe;
  --syn-hr:        #404040;
  --syn-list:      #569cd6;
  --syn-arrow:     #4ec9b0;
  --syn-comment:   #6a9955;
  --syn-bracket:   #ffd700;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: var(--bg-editor);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ===== BOOT SCREEN ===== */
.boot-screen {
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  transition: opacity 0.5s;
}
.boot-content { width: 420px; }
.boot-line {
  color: #4ec9b0;
  font-size: 13px;
  line-height: 26px;
  opacity: 0;
  animation: fadeIn 0.15s forwards;
}
.boot-line.dim { color: var(--text-dim); }
.boot-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #4ec9b0;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ===== APP LAYOUT ===== */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ===== TITLE BAR ===== */
.titlebar {
  height: 30px;
  background: var(--bg-titlebar);
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  position: relative;
}
.traffic-lights { display: flex; gap: 7px; }
.light { width: 12px; height: 12px; border-radius: 50%; }
.light-red    { background: #ff5f56; }
.light-yellow { background: #ffbd2e; }
.light-green  { background: #27c93f; }
.titlebar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

/* ===== MENU BAR ===== */
.menubar {
  height: 30px;
  background: var(--bg-titlebar);
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,0.4);
}
.menu-item {
  padding: 4px 8px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 3px;
  font-size: 13px;
}
.menu-item:hover { background: rgba(255,255,255,0.1); }

/* ===== WORKBENCH ===== */
.workbench { display: flex; flex: 1; overflow: hidden; }

/* ===== ACTIVITY BAR ===== */
.activity-bar {
  width: 48px;
  background: var(--bg-activity);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 2px;
  flex-shrink: 0;
}
.activity-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #858585;
  transition: color 0.15s;
  position: relative;
}
.activity-icon:hover { color: var(--text-white); }
.activity-icon.active { color: var(--text-white); }
.activity-icon.active::before {
  content: '';
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 2px;
  background: var(--text-white);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.3);
}
.sidebar-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  padding: 12px 12px 4px;
  text-transform: uppercase;
}
.sidebar-repo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 4px 12px 6px;
  text-transform: uppercase;
}
.file-tree { flex: 1; overflow-y: auto; }
.file-tree::-webkit-scrollbar { width: 5px; }
.file-tree::-webkit-scrollbar-track { background: transparent; }
.file-tree::-webkit-scrollbar-thumb { background: #424242; border-radius: 3px; }

.tree-folder {
  display: flex;
  align-items: center;
  height: 22px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}
.tree-folder:hover { background: var(--bg-hover); }

.tree-item {
  display: flex;
  align-items: center;
  height: 22px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
}
.tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-item.active { background: var(--bg-selected); color: var(--text-white); }

.tree-chevron {
  font-size: 9px;
  color: var(--text-dim);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.tree-file-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #519aba;
  margin: 0 6px 0 3px;
  flex-shrink: 0;
}
.tree-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== EDITOR AREA ===== */
.editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ===== TAB BAR ===== */
.tab-bar {
  height: 35px;
  background: var(--bg-tab-inactive);
  display: flex;
  align-items: flex-end;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.tab-bar::-webkit-scrollbar { height: 0; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 12px;
  height: 35px;
  background: var(--bg-tab-inactive);
  color: var(--text-dim);
  cursor: pointer;
  border-right: 1px solid #1e1e1e;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 130px;
  position: relative;
  transition: background 0.1s;
}
.tab:hover { background: #2a2a2a; color: var(--text-primary); }
.tab.active {
  background: var(--bg-tab-active);
  color: var(--text-white);
}
.tab.active::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
}
.tab-icon {
  width: 14px;
  height: 14px;
  background: #519aba;
  border-radius: 2px;
  flex-shrink: 0;
}
.tab-name { flex: 1; font-size: 13px; }
.tab-close {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-muted);
  opacity: 0;
  line-height: 1;
  flex-shrink: 0;
}
.tab:hover .tab-close, .tab.active .tab-close { opacity: 1; }
.tab-close:hover { background: rgba(255,255,255,0.1); color: var(--text-white); }

/* ===== BREADCRUMB ===== */
.breadcrumb {
  height: 22px;
  background: var(--bg-editor);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  gap: 0;
}
.bc-item { font-size: 12px; color: var(--text-dim); cursor: pointer; }
.bc-item:hover { color: var(--text-primary); }
.bc-item.bc-active { color: var(--text-primary); }
.bc-sep { font-size: 12px; color: var(--text-muted); padding: 0 3px; }

/* ===== EDITOR ===== */
.editor {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-editor);
}
.editor-scroll {
  flex: 1;
  display: flex;
  overflow-y: auto;
  overflow-x: hidden;
}
.editor-scroll::-webkit-scrollbar { width: 8px; }
.editor-scroll::-webkit-scrollbar-track { background: var(--bg-editor); }
.editor-scroll::-webkit-scrollbar-thumb { background: #424242; border-radius: 4px; }
.editor-scroll::-webkit-scrollbar-thumb:hover { background: #555; }

.line-numbers {
  flex-shrink: 0;
  width: 56px;
  padding: 12px 0;
  text-align: right;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-muted);
  border-right: 1px solid rgba(255,255,255,0.04);
  padding-right: 10px;
  align-self: flex-start;
  min-height: 100%;
}
.line-num { display: block; }

.editor-content {
  flex: 1;
  padding: 12px 20px 80px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 14px;
  line-height: 22px;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
  align-self: flex-start;
  width: 100%;
}
.editor-line { display: block; min-height: 22px; }
.editor-line:hover { background: rgba(255,255,255,0.02); }

/* ===== SYNTAX ===== */
.syn-h1        { color: var(--syn-h1); font-weight: 700; }
.syn-h2        { color: var(--syn-h2); font-weight: 700; }
.syn-h3        { color: var(--syn-h3); font-weight: 700; }
.syn-blockquote{ color: var(--syn-blockquote); font-style: italic; }
.syn-bold      { color: var(--syn-bold); font-weight: 700; }
.syn-italic    { color: var(--syn-italic); font-style: italic; }
.syn-link      { color: var(--syn-link); }
.syn-inline-code {
  color: var(--syn-code);
  background: var(--bg-inline-code);
  padding: 1px 4px;
  border-radius: 3px;
}
.syn-codeblock { color: var(--syn-codeblock); }
.syn-hr        { color: var(--syn-hr); }
.syn-list      { color: var(--syn-list); }
.syn-arrow     { color: var(--syn-arrow); }
.syn-comment   { color: var(--syn-comment); font-style: italic; }
.syn-bracket   { color: var(--syn-bracket); }
.syn-bracket.status-active    { color: #4ec9b0; }
.syn-bracket.status-prototype { color: #d7ba7d; }
.syn-bracket.status-draft     { color: #858585; }

/* ===== MINIMAP ===== */
.minimap {
  width: 64px;
  background: #1e1e1e;
  border-left: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.minimap-content { padding: 12px 6px; }
.mini-line {
  height: 2px;
  margin-bottom: 2px;
  border-radius: 1px;
  opacity: 0.5;
}

/* ===== STATUS BAR ===== */
.statusbar {
  height: 22px;
  background: var(--bg-statusbar);
  display: flex;
  align-items: center;
  padding: 0 6px;
  flex-shrink: 0;
  color: #fff;
  font-size: 12px;
}
.statusbar-left  { display: flex; align-items: center; }
.statusbar-right { margin-left: auto; display: flex; align-items: center; }
.sb-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  height: 22px;
  cursor: pointer;
  white-space: nowrap;
}
.sb-item:hover { background: rgba(255,255,255,0.15); }

/* ===== MOBILE iOS-STYLE ===== */

.mobile-home {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 25% 75%, #0d0520 0%, #080810 55%);
}

.mobile-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 0;
  height: 48px;
}
.mobile-time {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  font-family: -apple-system, sans-serif;
  letter-spacing: -0.2px;
}
.mobile-status-right {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
}

/* App grid */
.mobile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 12px;
  padding: 36px 28px 24px;
  max-width: 380px;
  margin: 0 auto;
}
.mobile-grid-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-icon-img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0,0,0,0.55);
  transition: transform 0.12s ease, opacity 0.12s ease;
  will-change: transform;
}
.mobile-icon-label {
  font-size: 11px;
  color: rgba(255,255,255,0.88);
  text-align: center;
  font-family: -apple-system, sans-serif;
  font-weight: 400;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  letter-spacing: 0.1px;
}

/* Bottom dock */
.mobile-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 24px max(24px, env(safe-area-inset-bottom, 24px));
  display: flex;
  justify-content: center;
}
.mobile-dock-inner {
  background: rgba(28, 28, 38, 0.78);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 26px;
  padding: 12px 28px;
  display: flex;
  gap: 28px;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 6px 28px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.04);
}
.mobile-dock-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-dock-icon-img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
  transition: transform 0.12s ease, opacity 0.12s ease;
  will-change: transform;
}
.mobile-dock-icon-label {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  font-family: -apple-system, sans-serif;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* App panels (slide up from bottom) */
.mobile-panel {
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 200;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.04, 0.64, 1);
  display: flex;
  flex-direction: column;
}
.mobile-panel.active { transform: translateY(0); }

.mobile-panel-nav {
  height: 48px;
  background: rgba(16, 16, 22, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  gap: 10px;
}
.mobile-panel-back {
  background: none;
  border: none;
  color: #007acc;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  font-family: -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.mobile-panel-title {
  color: #bbb;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, sans-serif;
  letter-spacing: -0.1px;
}
.mobile-panel-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Hide address bar in mobile app panels */
.mobile-panel-content .app-addr-bar { display: none; }

/* ===== DESKTOP OS ===== */
.desktop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #080810;
}

canvas.wallpaper {
  position: absolute;
  inset: 0;
  display: block;
}

/* Desktop menu bar */
.desktop-menubar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  background: rgba(8, 8, 16, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 200;
  color: #fff;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
.dmb-left  { display: flex; align-items: center; gap: 16px; }
.dmb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; color: rgba(255,255,255,0.8); }
.dmb-logo  { font-size: 16px; }
.dmb-brand { font-weight: 600; letter-spacing: 0.01em; }
.dmb-item  { color: rgba(255,255,255,0.65); cursor: default; }
.dmb-time  { font-variant-numeric: tabular-nums; }

/* IDE Window */
.ide-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.08);
  z-index: 10;
  transition: box-shadow 0.2s;
}
.ide-window.maximized {
  border-radius: 0 !important;
  top: 28px !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 28px) !important;
}

.window-titlebar {
  height: 30px;
  background: #3c3c3c;
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  cursor: default;
  position: relative;
  user-select: none;
}
.window-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Dock */
.dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 8px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  z-index: 150;
}
.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}
.dock-item:hover { transform: translateY(-10px); }
.dock-icon {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s;
}
.dock-item:hover .dock-icon { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.dock-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
}
.dock-dot.hidden { visibility: hidden; }
.dock-tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.96);
  color: #f0f0f0;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.dock-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(28, 28, 30, 0.96);
}
.dock-item:hover .dock-tooltip { opacity: 1; }
.dock-name {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.01em;
  user-select: none;
  line-height: 1;
  margin-top: 1px;
}

/* Desktop icons */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 7px;
  width: 54px;
  transition: background 0.15s;
}
.desktop-icon:hover { background: rgba(255,255,255,0.1); }
.desktop-icon-name {
  font-size: 10px;
  color: rgba(255,255,255,0.88);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.6);
  line-height: 1.3;
  user-select: none;
  word-break: break-word;
}

