:root {
  --bg-page: #1c1c22;
  --bg-terminal: rgba(30, 30, 36, 0.96);
  --bg-titlebar: linear-gradient(180deg, #3a3a40 0%, #2d2d33 100%);
  --text: #e8e8e8;
  --text-dim: #9a9aa2;
  --green: #3fd97f;
  --blue: #5a9cff;
  --cyan: #56c8ff;
  --yellow: #f4bf4f;
  --red-text: #ff6b6b;
  --purple: #c792ea;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Cascadia Code", "Fira Code",
    ui-monospace, monospace;
}

body.theme-green {
  --bg-terminal: rgba(5, 16, 8, 0.96);
  --bg-titlebar: linear-gradient(180deg, #10301a 0%, #0a2012 100%);
  --text: #7dff9c;
  --text-dim: #49965e;
  --blue: #33ff77;
  --cyan: #a5ffc0;
  --purple: #c4ffd4;
  --yellow: #eaffa5;
}

body.theme-light {
  --bg-terminal: rgba(246, 246, 248, 0.97);
  --bg-titlebar: linear-gradient(180deg, #e8e8ec 0%, #d5d5da 100%);
  --text: #26262c;
  --text-dim: #71717a;
  --blue: #1f6fe0;
  --cyan: #0b7aa8;
  --purple: #8a3fd0;
  --yellow: #a8770a;
  --red-text: #d3382f;
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg-page) url("background.jpg") center / cover no-repeat fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font-mono);
}

.terminal {
  position: relative;
  width: 100%;
  max-width: 780px;
  height: min(560px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-terminal);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 8px 20px rgba(0, 0, 0, 0.4);
}

.terminal-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  height: 34px;
  flex-shrink: 0;
  background: var(--bg-titlebar);
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  user-select: none;
}

.traffic-lights {
  display: flex;
  gap: 8px;
  padding-left: 12px;
}

.light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.light.red {
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

.light.yellow {
  background: #febc2e;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

.light.green {
  background: #28c840;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

.titlebar-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.terminal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  cursor: text;
}

.terminal-body::-webkit-scrollbar {
  width: 8px;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

#output {
  white-space: pre-wrap;
  word-break: break-word;
}

#output a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#output a:hover {
  filter: brightness(1.2);
}

.line-cmd {
  color: var(--text);
}

.line-error {
  color: var(--red-text);
}

.line-success {
  color: var(--green);
}

.line-prompt {
  color: var(--blue);
}

.line-dim {
  color: var(--text-dim);
}

.line-accent {
  color: var(--purple);
}

.hl {
  color: var(--purple);
  font-weight: 700;
}

.copy-user {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.copy-user:hover {
  filter: brightness(1.25);
}

.ls-item {
  color: var(--cyan);
  cursor: pointer;
}

.ls-item:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 999;
  cursor: pointer;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(22, 22, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #e8e8e8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.input-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.prompt {
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
}

.prompt-path {
  color: var(--cyan);
}

.input-wrap {
  position: relative;
  flex: 1;
}

.ghost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--text-dim);
  white-space: pre;
  overflow: hidden;
}

#cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  caret-color: var(--blue);
}

@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  .terminal {
    height: calc(100dvh - 20px);
  }
}
