:root {
  --bg: #f4f4f6;
  --panel-bg: #ffffff;
  --panel-border: #e3e3e8;
  --text: #1c1c1e;
  --muted: #86868b;
  --accent: #0a84ff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Side panel ---------- */

.panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  padding: 28px 24px;
  overflow-y: auto;
}

.panel h1 {
  font-size: 19px;
  margin: 0 0 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
  color: var(--text);
  font-family: inherit;
}

.field textarea {
  font-family: "SF Mono", Menlo, Monaco, monospace;
  resize: vertical;
  line-height: 1.5;
}

.field input[type="range"] {
  width: 100%;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: -8px 0 20px;
}

.hint code {
  background: #eee;
  padding: 1px 4px;
  border-radius: 4px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.action-btn.primary {
  border: none;
  background: var(--accent);
  color: white;
}

.action-btn.secondary {
  border: 1px solid var(--panel-border);
  background: #fafafa;
  color: var(--text);
}

.action-btn:hover {
  opacity: 0.9;
}

.action-btn:active {
  transform: scale(0.98);
}

.copy-status {
  min-height: 16px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #1d8a3d;
  text-align: center;
}

/* ---------- Preview area ---------- */

.preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(circle at 20% 20%, #eef0ff 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, #ffeef0 0%, transparent 45%),
    var(--bg);
}

.terminal-window {
  width: 680px;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 30px 60px -10px rgba(0, 0, 0, 0.35),
    0 10px 20px -8px rgba(0, 0, 0, 0.25);
  font-family: "SF Mono", "Menlo", "Monaco", "Fira Code", monospace;
}

.titlebar {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  position: relative;
}

.traffic-lights {
  display: flex;
  gap: 8px;
  z-index: 2;
}

.light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15);
}

.light.red { background: #ff5f57; }
.light.yellow { background: #febc2e; }
.light.green { background: #28c840; }

.title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

.body {
  padding: 18px 20px 26px;
  min-height: 280px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
}

.line {
  line-height: 1.65;
}

.prompt .user { font-weight: 600; }
.prompt .at { opacity: 0.7; }
.prompt .host { font-weight: 600; }
.prompt .path { font-weight: 600; }
.prompt .sym { margin: 0 6px 0 4px; opacity: 0.85; }

.output-line {
  opacity: 0.85;
}

.comment-line {
  opacity: 0.55;
  font-style: italic;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

.cursor.force-visible {
  animation: none;
  opacity: 1;
}

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

/* ---------- Themes ---------- */

/* Dark: classic macOS Terminal "Pro" theme */
.terminal-window[data-theme="dark"] .titlebar {
  background: #3a3a3c;
  border-bottom: 1px solid #2a2a2c;
}
.terminal-window[data-theme="dark"] .title {
  color: #d8d8dc;
}
.terminal-window[data-theme="dark"] .body {
  background: #1e1e1e;
  color: #f2f2f2;
}
.terminal-window[data-theme="dark"] .prompt .user,
.terminal-window[data-theme="dark"] .prompt .host {
  color: #6cc644;
}
.terminal-window[data-theme="dark"] .prompt .path {
  color: #61afef;
}
.terminal-window[data-theme="dark"] .cursor {
  background: #f2f2f2;
}

/* Light theme */
.terminal-window[data-theme="light"] .titlebar {
  background: #e8e8ea;
  border-bottom: 1px solid #d4d4d8;
}
.terminal-window[data-theme="light"] .title {
  color: #3c3c43;
}
.terminal-window[data-theme="light"] .body {
  background: #fbfbfc;
  color: #1c1c1e;
}
.terminal-window[data-theme="light"] .prompt .user,
.terminal-window[data-theme="light"] .prompt .host {
  color: #1d8a3d;
}
.terminal-window[data-theme="light"] .prompt .path {
  color: #0a6ed1;
}
.terminal-window[data-theme="light"] .cursor {
  background: #1c1c1e;
}

/* Dracula theme */
.terminal-window[data-theme="dracula"] .titlebar {
  background: #21222c;
  border-bottom: 1px solid #191a21;
}
.terminal-window[data-theme="dracula"] .title {
  color: #f8f8f2;
}
.terminal-window[data-theme="dracula"] .body {
  background: #282a36;
  color: #f8f8f2;
}
.terminal-window[data-theme="dracula"] .prompt .user,
.terminal-window[data-theme="dracula"] .prompt .host {
  color: #50fa7b;
}
.terminal-window[data-theme="dracula"] .prompt .path {
  color: #8be9fd;
}
.terminal-window[data-theme="dracula"] .cursor {
  background: #f8f8f2;
}

@media (max-width: 860px) {
  .app {
    flex-direction: column;
  }
  .panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }
  .terminal-window {
    width: 100%;
  }
}
