:root {
  color-scheme: light;
  --bg: #f8f7fc;
  --ink: #191521;
  --muted: #6d617d;
  --line: #ded7ec;
  --accent: #7b3ff2;
  --accent-strong: #5523c6;
  --accent-hot: #be22c8;
  --accent-soft: #efe7ff;
  --warning: #bd581f;
  --body-glow-primary: rgba(123, 63, 242, 0.16);
  --body-glow-secondary: rgba(214, 43, 216, 0.11);
  --brand-glow: rgba(123, 63, 242, 0.26);
  --button-glow: rgba(123, 63, 242, 0.22);
  --button-text: #ffffff;
  --panel-border: rgba(222, 215, 236, 0.95);
  --panel-bg: rgba(255, 255, 255, 0.94);
  --input-bg: #fdfcff;
  --preview-bg: #f3effa;
  --focus-ring: rgba(123, 63, 242, 0.18);
  --icon-hover: #e4d7ff;
  --placeholder: #80748c;
  --shadow: 0 24px 70px rgba(25, 21, 33, 0.16);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080711;
  --ink: #f7f1ff;
  --muted: #b8abc9;
  --line: #2a2241;
  --accent: #b57cff;
  --accent-strong: #f05af4;
  --accent-hot: #ff3fd5;
  --accent-soft: #21102f;
  --warning: #ffb36e;
  --body-glow-primary: rgba(181, 124, 255, 0.18);
  --body-glow-secondary: rgba(255, 63, 213, 0.12);
  --brand-glow: rgba(181, 124, 255, 0.38);
  --button-glow: rgba(255, 63, 213, 0.2);
  --button-text: #080711;
  --panel-border: rgba(42, 34, 65, 0.95);
  --panel-bg: rgba(14, 12, 26, 0.94);
  --input-bg: #100d1f;
  --preview-bg: #151025;
  --focus-ring: rgba(181, 124, 255, 0.24);
  --icon-hover: #31194b;
  --placeholder: #9083a2;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, var(--body-glow-primary), transparent 38%),
    linear-gradient(315deg, var(--body-glow-secondary), transparent 34%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.tool-panel {
  width: min(100%, 560px);
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.tool-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080711;
  box-shadow: 0 0 28px var(--brand-glow);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2vw + 1rem, 2.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.theme-switcher {
  display: inline-grid;
  grid-template-columns: repeat(3, 36px);
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--preview-bg);
}

.theme-option {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.theme-option:hover,
.theme-option[aria-pressed="true"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.theme-option svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -8px 0 22px;
  padding: 16px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.install-banner[hidden] {
  display: none;
}

.install-copy {
  min-width: 0;
}

.install-title {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.install-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.install-button {
  min-height: 44px;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 14px;
  color: var(--button-text);
  background: var(--accent-strong);
  font-weight: 800;
}

.install-button:hover {
  background: var(--accent);
}

.install-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.install-button svg {
  width: 18px;
  height: 18px;
}

.command-form {
  display: grid;
  gap: 14px;
}

.console-field {
  display: grid;
  gap: 6px;
}

.selector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px;
  gap: 8px;
}

select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--input-bg);
  outline: none;
  font: inherit;
  cursor: pointer;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.icon-button--sm {
  width: 48px;
  min-height: 48px;
}

.icon-button--danger {
  color: var(--warning);
  background: rgba(183, 85, 33, 0.1);
}

.icon-button--danger:hover {
  background: rgba(183, 85, 33, 0.2);
}

:root[data-theme="dark"] .icon-button--danger {
  background: rgba(255, 173, 114, 0.1);
}

:root[data-theme="dark"] .icon-button--danger:hover {
  background: rgba(255, 173, 114, 0.2);
}

.icon-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--input-bg);
  outline: none;
}

input::placeholder {
  color: var(--placeholder);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.icon-button,
.primary-button,
.secondary-button,
.install-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  min-height: 48px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.icon-button:hover {
  background: var(--icon-hover);
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.install-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.endpoint-preview {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--preview-bg);
}

.endpoint-preview span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

output {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.96rem;
}

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.secondary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button {
  min-height: 52px;
  gap: 10px;
  padding: 0 18px;
  color: var(--button-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  box-shadow: 0 12px 28px var(--button-glow);
  font-weight: 800;
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-hot));
}

.secondary-button {
  min-height: 44px;
  gap: 8px;
  padding: 0 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 800;
}

.secondary-button:hover {
  background: var(--icon-hover);
}

.secondary-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.secondary-button svg {
  width: 18px;
  height: 18px;
}

.secondary-link {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.secondary-link:hover {
  text-decoration: underline;
}

.status-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.status-message.is-warning {
  color: var(--warning);
}

.command-frame {
  position: fixed;
  top: -1px;
  left: -1px;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.notes {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
}

.notes summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.notes ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.notes li + li {
  margin-top: 7px;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080711;
    --ink: #f7f1ff;
    --muted: #b8abc9;
    --line: #2a2241;
    --accent: #b57cff;
    --accent-strong: #f05af4;
    --accent-hot: #ff3fd5;
    --accent-soft: #21102f;
    --warning: #ffb36e;
    --body-glow-primary: rgba(181, 124, 255, 0.18);
    --body-glow-secondary: rgba(255, 63, 213, 0.12);
    --brand-glow: rgba(181, 124, 255, 0.38);
    --button-glow: rgba(255, 63, 213, 0.2);
    --button-text: #080711;
    --panel-border: rgba(42, 34, 65, 0.95);
    --panel-bg: rgba(14, 12, 26, 0.94);
    --input-bg: #100d1f;
    --preview-bg: #151025;
    --focus-ring: rgba(181, 124, 255, 0.24);
    --icon-hover: #31194b;
    --placeholder: #9083a2;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  }
}

@media (max-width: 560px) {
  .app-shell {
    align-items: start;
    padding: 14px;
  }

  .tool-panel {
    padding: 20px;
  }

  .tool-header {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
    gap: 12px;
  }

  .theme-switcher {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .install-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .install-button {
    width: 100%;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .secondary-actions {
    justify-content: center;
  }

  .secondary-link {
    justify-self: center;
  }
}
