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

:root {
  --bg:         #1e1e1e;
  --bg-sidebar: #252526;
  --bg-header:  #323233;
  --border:     #3c3c3c;
  --text:       #cccccc;
  --text-dim:   #888888;
  --green:      #4ec9b0;
  --orange:     #ce9178;
  --yellow:     #dcdcaa;
  --red:        #f44747;
  --blue:       #9cdcfe;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Consolas, monospace;
  font-size: 13px;
  overflow: hidden;
}

/* ── レイアウト ──────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100%; }

#header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  color: var(--yellow);
  flex-shrink: 0;
  user-select: none;
  display: flex;
  align-items: center;
}

.header-logo {
  height: 20px;
  display: block;
}

#main { display: flex; flex: 1; min-height: 0; }

/* ── ターミナル ──────────────────────────────────── */
#terminal {
  position: relative;
  flex: 1;
  cursor: text;
  min-width: 0;
  overflow: hidden;
}

#output {
  height: 100%;
  overflow-y: auto;
  padding: 12px 16px;
  line-height: 1.7;
}
#output::-webkit-scrollbar { width: 6px; }
#output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* キーボード入力の受け口（非表示） */
#hidden-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  padding: 0;
  outline: none;
  font-family: inherit;
  font-size: inherit;
}

/* ── 出力行 ──────────────────────────────────────── */
.line { white-space: pre; min-height: 1em; }
.line.cat   { color: var(--orange); }
.line.error { color: var(--red); }
.line.info  { color: var(--blue); }
.line.dir   { color: var(--green); }
.line.dim   { color: var(--text-dim); }

/* インライン入力行 */
.prompt-text { color: var(--green); }
.cursor { animation: blink 1s step-end infinite; }

@keyframes blink { 50% { opacity: 0; } }

/* ── サイドバー ──────────────────────────────────── */
#sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-header {
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
}

#file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  font-size: 12px;
  line-height: 1.9;
}
#file-tree::-webkit-scrollbar { width: 4px; }
#file-tree::-webkit-scrollbar-thumb { background: var(--border); }

.tree-item { padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item.t-dir  { color: var(--green); }
.tree-item.t-file { color: var(--text); }
.tree-item.t-cwd  { color: var(--yellow); font-weight: bold; }

/* ── exit 画面 ───────────────────────────────────── */
#exit-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
}
#exit-screen.show { display: flex; }

.exit-cat  { font-size: 40px; color: var(--orange); }
.exit-msg  { color: var(--text-dim); }
.exit-hint { color: var(--green); animation: blink 1.2s step-end infinite; }
