:root {
  color-scheme: light dark;
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --card-bg: rgba(15, 23, 42, 0.72);
  --card-border: rgba(148, 163, 184, 0.2);
  --panel-bg: rgba(15, 23, 42, 0.82);
  --panel-border: rgba(148, 163, 184, 0.18);
  --surface: #0b1120;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --muted: #475569;
  --shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.75);
  --radius-lg: 18px;
  --radius-sm: 10px;
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(
      circle at top left,
      rgba(59, 130, 246, 0.35),
      transparent 55%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(244, 63, 94, 0.28),
      transparent 52%
    ),
    linear-gradient(160deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

code {
  background: rgba(148, 163, 184, 0.16);
  padding: 0.15em 0.35em;
  border-radius: 6px;
  font-size: 0.9em;
}

.app-header {
  padding: 3rem clamp(1.5rem, 3vw, 4rem) 2rem;
  text-align: center;
}

.app-header__content {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.app-header__content h1 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
}

.app-header__content p {
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 0 clamp(1.25rem, 3vw, 4rem) 3.5rem;
  width: min(1200px, 100%);
  margin: 0 auto;
}

.builder-panel,
.preview-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 2.5vw, 2.25rem);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel-description {
  margin-top: 0.35rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.control-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 170px;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.control-card:focus-within,
.control-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
}

.control-card.disabled {
  opacity: 0.55;
}

.control-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.control-card__header h3 {
  font-size: 1.05rem;
}

.control-card__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

input[type="color"] {
  appearance: none;
  background: none;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}

input[type="color"]::-webkit-color-swatch,
input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 12px;
}

input[type="color"]:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.5;
}

.color-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-flex;
  align-items: center;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
  transition: background 0.2s ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch__track {
  background: rgba(56, 189, 248, 0.65);
}

.switch input:checked + .switch__track::after {
  transform: translateX(22px);
  background: #0ea5e9;
}

.preview-panel h2 {
  font-size: 1.45rem;
}

.preview-terminal {
  background: rgba(15, 23, 42, 0.94);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: inset 0 15px 35px -15px rgba(8, 15, 35, 0.6);
  padding: 1.5rem;
  font-family: "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.preview-terminal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.15),
    transparent 60%
  );
  pointer-events: none;
}

#previewPrompt {
  margin: 0;
  white-space: pre-wrap;
}

.preview-space {
  white-space: pre;
}

.preview-cursor {
  margin-left: 0.35rem;
  color: rgba(148, 163, 184, 0.4);
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.command-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.command-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.select-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.select-label__text {
  font-weight: 600;
  color: var(--text-primary);
}

.shell-select {
  appearance: none;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  min-width: 160px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.shell-select:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 2px;
}

.bash-command {
  width: 100%;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 1rem;
  color: var(--text-primary);
  font-family: "Fira Code", "JetBrains Mono", monospace;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 120px;
}

.bash-command:focus {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 2px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  font-size: 0.95rem;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0f172a;
  box-shadow: 0 14px 30px -12px rgba(14, 165, 233, 0.8);
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -14px rgba(14, 165, 233, 0.95);
}

.ghost-button {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text-secondary);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.7);
}

.copy-hint {
  font-size: 0.9rem;
  color: var(--accent);
  min-height: 1.2em;
}

.copy-hint--error {
  color: #f87171;
}

.app-footer {
  margin-top: auto;
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}

.app-footer a:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 3rem;
  }

  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .action-row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .builder-panel,
  .preview-panel {
    padding: 1.5rem;
  }

  .control-card {
    min-height: auto;
  }

  .app-header {
    padding-bottom: 1.5rem;
  }
}
