html,
body {
width: 100%;
min-height: 100vh;
margin: 0;
padding: 0;
overflow-x: hidden;
}

:root {
  --bg: #0a0c0e;
  --panel: rgba(15, 18, 21, 0.92);
  --panel-border: #1a1f26;
  --accent: #00d4aa;
  --accent-dim: #005f4b;
  --text: #c8d0d8;
  --text-dim: #5a6a7a;
  --text-bright: #e8f0f8;
  --blue: #2e7daf;
  --orange: #e8853d;
  --red: #d44a4a;
  --yellow: #d4b84a;
  --cyan: #3dc9d4;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
background: var(--bg);
color: var(--text);
font-family: 'JetBrains Mono', monospace;
}

#app.app-visible {
padding-bottom: 188px;
}

/* Site background - dark tech pattern */
.site-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,212,170,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(46,125,175,0.04) 0%, transparent 50%);
}
.site-bg::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 38px, rgba(0,212,170,0.04) 38px, rgba(0,212,170,0.04) 39px),
    repeating-linear-gradient(0deg, transparent, transparent 38px, rgba(0,212,170,0.04) 38px, rgba(0,212,170,0.04) 39px),
    radial-gradient(circle, rgba(0,212,170,0.06) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 20px 20px;
  background-position: 0 0, 0 0, 10px 10px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }

.screen {
display: none;
position: relative;
z-index: 1;
width: 100%;
min-height: 0;
}
.content-area {
display: flex;
flex-direction: column;
overflow: visible;
}
.screen.active {
display: flex;
flex-direction: column;
}
.screen.active > * { width: 100%; }

/* BOOT */
#boot {
  align-items: center; justify-content: center; flex-direction: column;
  background: #000;
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100;
  transition: opacity 1s ease, transform 1s ease;
}
#boot.hidden { opacity: 0; transform: scale(1.02); pointer-events: none; }
.boot-title { font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: 8px; margin-bottom: 40px; text-shadow: 0 0 20px rgba(0,212,170,0.3); }
.boot-line { font-size: 13px; color: var(--text-dim); line-height: 1.8; opacity: 0; transform: translateY(8px); }
.boot-line.done { opacity: 1; transform: translateY(0); color: var(--accent); }
.boot-line.active { opacity: 1; transform: translateY(0); }
.boot-line .status { color: var(--accent); }
.boot-container { width: 460px; }
.boot-progress { margin-top: 30px; width: 460px; height: 2px; background: var(--panel-border); border-radius: 1px; overflow: hidden; }
.boot-progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s; box-shadow: 0 0 8px var(--accent); }
.boot-hint { margin-top: 40px; font-size: 11px; color: var(--text-dim); opacity: 0; animation: blink 1.5s infinite; }
@keyframes blink { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* MAIN */
#app {
display: none;
position: relative;
z-index: 1;
width: 100%;
max-width: 1400px;
min-height: 100vh;
margin: 0 auto;
padding: 0 20px;
}

#app.app-visible {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.main-container {
width: 100%;
display: flex;
flex-direction: column;
padding: 0;
}

/* Status Bar */
.status-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; font-size: 11px; color: var(--text-dim); backdrop-filter: blur(8px); }
.status-bar .sys-name { color: var(--accent); font-weight: 600; letter-spacing: 2px; }
.status-led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-led.green { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-led.blue { background: var(--blue); box-shadow: 0 0 6px var(--blue); }

/* Nav */
.nav-tabs { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; overflow: hidden; backdrop-filter: blur(8px); }
.nav-tab { flex: 1; padding: 12px 16px; text-align: center; font-size: 11px; font-weight: 500; letter-spacing: 1px; color: var(--text-dim); cursor: pointer; transition: all 0.3s; background: transparent; border: none; font-family: inherit; text-transform: uppercase; }
.nav-tab:hover { color: var(--text); background: rgba(0,212,170,0.05); }
.nav-tab.active { color: var(--accent); background: rgba(0,212,170,0.1); box-shadow: inset 0 -2px 0 var(--accent); }

/* Panel */
.panel { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; overflow: visible; backdrop-filter: blur(8px); }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(0,0,0,0.3); border-bottom: 1px solid var(--panel-border); font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); }
.panel-body { padding: 24px; }

/* Architecture - LARGE SVG centered */
.arch-svg-container {
  width: 100%;
  padding: 0;
  overflow: visible;
  display: flex;
  justify-content: center;
}
.arch-svg-container svg {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}
.arch-node { cursor: pointer; }
.arch-node:hover rect { filter: url(#glow); }
.arch-node:hover .node-label { fill: #fff; }
.arch-link { stroke-dasharray: 8,5; animation: dashMove 1.2s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -26; } }
.arch-pulse { animation: archPulse 2.5s ease-in-out infinite; }
@keyframes archPulse { 0%,100% { opacity: 0; } 30%,70% { opacity: 1; } }

.arch-tooltip {
  position: fixed; pointer-events: none; z-index: 50;
  background: rgba(10,12,14,0.96); border: 1px solid var(--accent-dim);
  padding: 14px 18px; font-size: 13px; max-width: 320px;
  border-radius: 4px; opacity: 0; transition: opacity 0.2s; line-height: 1.6;
}
.arch-tooltip.visible { opacity: 1; }
.arch-tooltip .tt-title { color: var(--accent); font-weight: 600; margin-bottom: 4px; font-size: 14px; }

/* Digital Twin - Background */
#screen-digtwin .panel-body { padding: 0; position: relative; min-height: 280px; overflow: hidden; }
.dtwin-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, #0d1518 0%, #06080a 100%);
  display: flex; align-items: center; justify-content: center;
}
.diag-overlay {
  position: absolute; top: 16px; left: 16px; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 16px;
  pointer-events: none;
}
.diag-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.diag-group { background: rgba(10,12,14,0.88); border: 1px solid var(--panel-border); border-radius: 4px; padding: 12px 16px; min-width: 160px; flex: 1; backdrop-filter: blur(6px); }
.diag-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 4px; }
.diag-value { font-size: 20px; font-weight: 600; color: var(--accent); }
.diag-bar { width: 100%; height: 2px; background: var(--panel-border); margin-top: 6px; border-radius: 1px; }
.diag-bar-fill { height: 100%; background: var(--accent); border-radius: 1px; transition: width 1s; }
.diag-bar-fill.warning { background: var(--yellow); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border); border-radius: 4px; padding: 20px; cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden; }
.project-card::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--accent); opacity: 0; transition: opacity 0.3s; }
.project-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.project-card:hover::before { opacity: 1; }
.project-card .mod-id { font-size: 10px; color: var(--accent-dim); letter-spacing: 2px; margin-bottom: 8px; }
.project-card .mod-name { font-size: 16px; font-weight: 600; color: var(--text-bright); margin-bottom: 6px; }
.project-card .mod-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.project-card .mod-badge { display: inline-block; padding: 2px 8px; font-size: 9px; border: 1px solid var(--panel-border); border-radius: 2px; margin-top: 10px; color: var(--text-dim); }

/* Modal */
.project-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 200; background: rgba(0,0,0,0.85); align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.project-modal.open { display: flex; }
.project-modal-content { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; width: 90%; max-width: 800px; max-height: 85vh; overflow-y: auto; }
.project-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--panel-border); }
.project-modal-header h2 { font-size: 18px; color: var(--accent); font-weight: 600; }
.project-modal-close { background: none; border: 1px solid var(--panel-border); color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 4px 12px; border-radius: 3px; font-family: inherit; transition: all 0.3s; }
.project-modal-close:hover { border-color: var(--red); color: var(--red); }
.project-modal-body { padding: 24px; }
.project-modal-body .spec-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.project-modal-body .spec-table td { padding: 8px 12px; border-bottom: 1px solid var(--panel-border); }
.project-modal-body .spec-table td:first-child { color: var(--text-dim); width: 140px; }
.project-modal-body .modal-desc { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 20px; }

/* Tech Tree with floating tooltip */
.tech-tree { font-size: 15px; line-height: 2.6; padding: 10px 0; }
.tech-tree .tree-core { color: var(--accent); font-weight: 700; font-size: 18px; letter-spacing: 2px; margin-bottom: 4px; }
.tech-tree .tree-category { color: var(--blue); font-weight: 600; margin-top: 24px; font-size: 14px; letter-spacing: 1px; }
.tech-tree .tree-item {
  color: var(--text); padding-left: 90px; position: relative;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.tech-tree .tree-item:hover { color: var(--accent); padding-left: 98px; background: rgba(0,212,170,0.03); border-radius: 2px; }
.tech-tree .tree-item::before { content: '\00a0\00a0\251c\2500\2500\2500\00a0\00a0'; color: var(--text-dim); position: absolute; left: 36px; }
.tech-tree .tree-item:last-child::before { content: '\00a0\00a0\2514\2500\2500\2500\00a0\00a0'; }

.tech-tooltip {
  position: fixed; pointer-events: none; z-index: 50;
  background: rgba(10,12,14,0.96); border: 1px solid var(--accent-dim);
  padding: 14px 18px; font-size: 13px; max-width: 340px;
  border-radius: 4px; opacity: 0; transition: opacity 0.2s; line-height: 1.6;
}
.tech-tooltip.visible { opacity: 1; }
.tech-tooltip .tt-title { color: var(--accent); font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.tech-tooltip .tt-desc { color: var(--text); }
.tech-tooltip .tt-source { color: var(--text-dim); font-size: 10px; margin-top: 6px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.stat-card { background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border); border-radius: 4px; padding: 24px 20px; text-align: center; transition: border-color 0.3s; }
.stat-card:hover { border-color: var(--accent-dim); }
.stat-value { font-size: 36px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); }

/* Terminal */
.terminal-wrap { background: #000; border: 1px solid var(--panel-border); border-radius: 4px; overflow: hidden; }
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--panel-border); }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.r { background: #ff5f56; }
.terminal-dot.y { background: #ffbd2e; }
.terminal-dot.g { background: #27c93f; }
.terminal-title { font-size: 11px; color: var(--text-dim); margin-left: 8px; }
.terminal-body { padding: 20px 24px; font-size: 13px; line-height: 1.8; min-height: 300px; background: #080a0c; }
.terminal-body .prompt { color: var(--accent); }
.terminal-body .cmd { color: var(--text-bright); }
.terminal-body .output { color: var(--text-dim); padding-left: 20px; }
.terminal-input-line { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.terminal-input-line .prompt { color: var(--accent); }
.terminal-input-line input { background: transparent; border: none; color: var(--text-bright); font-family: inherit; font-size: 13px; outline: none; flex: 1; caret-color: var(--accent); }

/* Responsive */
@media (max-width: 1024px) {
  .diag-row { flex-direction: column; }
  .diag-group { min-width: auto; }
}
@media (max-width: 768px) {
  .boot-container { width: 90%; }
  .boot-title { font-size: 20px; }
  .nav-tab { font-size: 9px; padding: 10px 8px; letter-spacing: 0.5px; }
  #three-container { min-height: 400px; }
  .projects-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-body { padding: 16px; }
  .terminal-body { padding: 16px; font-size: 12px; }
  #app { padding: 0 10px; }
}

#screen-tech .tech-tree {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 48px;
row-gap: 16px;
padding: 10px 0;
}

#screen-tech .tree-core {
grid-column: 1 / -1;
}

#screen-tech .tree-section {
min-width: 0;
}

#screen-tech .tree-category {
margin-top: 0;
}

#screen-tech .tree-item {
white-space: normal;
}

@media (max-width: 768px) {
#screen-tech .tech-tree {
grid-template-columns: 1fr;
}
}
#screen-arch .panel,
#screen-digtwin .panel {
display: flex;
flex-direction: column;
min-height: 0;
}

#screen-arch .panel-body {
padding: 12px !important;
}

#screen-arch .arch-svg-container {
max-height: calc(100vh - 260px);
}

#screen-arch .arch-svg-container svg {
width: 100%;
height: auto;
max-height: calc(100vh - 260px);
object-fit: contain;
}
.site-footer {
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 100%;
max-width: 1400px;
box-sizing: border-box;
border-top: 1px solid var(--panel-border);
padding: 16px 20px 14px;
background: var(--panel);
backdrop-filter: blur(8px);
z-index: 100;
}


