:root {
  --bg: #0f172a;
  --surface: #111827;
  --surface-alt: #1f2937;
  --primary: #5e7ce2;
  --primary-dark: #4258b6;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #f9fafb;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --radius: 14px;
  --shadow: 0 24px 50px rgba(15, 23, 42, 0.32);
  --transition: 0.2s ease;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1f2937 0%, #0f172a 60%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.75rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  gap: 1rem;
  flex-wrap: wrap;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon-button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition);
}

.header-icon-button__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(94, 124, 226, 0.18);
  border: 1px solid rgba(94, 124, 226, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-icon-button__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.header-icon-button__label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.header-icon-button:hover,
.header-icon-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.45);
  background: rgba(17, 24, 39, 0.9);
  outline: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(94, 124, 226, 0.18);
  border: 1px solid rgba(94, 124, 226, 0.3);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand>div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.15;
}

.brand h1 {
  font-size: 1.28rem;
  margin: 0;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-pill {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(94, 124, 226, 0.15);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid rgba(94, 124, 226, 0.2);
}

body.modal-open {
  overflow: hidden;
}

.settings-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: 1200;
}

.settings-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.settings-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(10px);
}

.settings-modal__dialog {
  position: relative;
  z-index: 1;
  background: rgba(11, 18, 32, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 48px 80px rgba(2, 6, 23, 0.55);
  width: min(1024px, calc(100% - 2.5rem));
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  transition: transform var(--transition);
  max-height: calc(100vh - 2rem);
  height: min(780px, calc(100vh - 2rem));
}

.settings-modal.is-open .settings-modal__dialog {
  transform: translateY(0);
}

.settings-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.6rem 1.8rem 1.1rem;
}

.settings-modal__header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.settings-modal__subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 32ch;
}

.settings-modal__close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition);
}

.settings-modal__close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.settings-modal__close:hover,
.settings-modal__close:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.45);
  background: rgba(17, 24, 39, 0.9);
  outline: none;
}

.settings-modal__body {
  padding: 0 1.8rem 1.4rem;
  display: grid;
  grid-template-columns: minmax(180px, 0.4fr) minmax(0, 1fr);
  gap: 1.6rem;
  min-height: 320px;
  flex: 1;
  overflow: hidden;
}

.settings-tabs {
  display: grid;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: calc(var(--radius) - 4px);
  align-content: start;
  overflow-y: auto;
  min-height: 0;
}

.settings-tab {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.15rem 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
    color var(--transition), transform var(--transition);
}

.settings-tab__label {
  font-weight: 600;
  color: var(--text);
  grid-column: 2;
  grid-row: 1;
}

.settings-tab__hint {
  font-size: 0.75rem;
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
}

.settings-tab:hover,
.settings-tab:focus-visible {
  border-color: rgba(94, 124, 226, 0.35);
  background: rgba(17, 24, 39, 0.7);
  transform: translateY(-1px);
  outline: none;
  color: var(--text);
}

.settings-tab:hover .settings-tab__icon,
.settings-tab:focus-visible .settings-tab__icon {
  border-color: rgba(94, 124, 226, 0.4);
  color: var(--text);
}

.settings-tab__icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(94, 124, 226, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 1;
  grid-row: 1 / span 2;
  color: rgba(148, 163, 184, 0.9);
}

.settings-tab__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.settings-tab.is-active {
  border-color: rgba(94, 124, 226, 0.5);
  background: rgba(37, 99, 235, 0.14);
  color: var(--text);
}

.settings-tab.is-active .settings-tab__icon {
  background: rgba(94, 124, 226, 0.22);
  border-color: rgba(94, 124, 226, 0.6);
  color: var(--text);
}

.settings-tab.is-active .settings-tab__hint {
  color: rgba(148, 163, 184, 0.9);
}

.settings-panels {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: calc(var(--radius) - 4px);
  padding: 1.1rem 1.4rem;
  display: grid;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

.settings-panel {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.settings-panel:not(.is-active) {
  display: none;
}

.settings-panel[hidden] {
  display: none !important;
}

.settings-panel__placeholder {
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-panel__cta {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.65);
  color: var(--muted);
  cursor: not-allowed;
}

.settings-form {
  display: grid;
  gap: 1rem;
}

.settings-field {
  display: grid;
  gap: 0.55rem;
}

.settings-field__label {
  font-weight: 600;
  font-size: 0.95rem;
}

.settings-field__control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
}

.settings-field__control input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.45rem 0.2rem;
}

.settings-field__control input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

.settings-field__control input:focus {
  outline: none;
}

.settings-field__control--select {
  padding: 0;
  background: transparent;
  border: none;
}

.settings-field__control--select select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-size: 0.95rem;
}

.settings-field__control--select select:focus-visible {
  outline: 2px solid rgba(94, 124, 226, 0.45);
  outline-offset: 2px;
}

.settings-field__toggle {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 124, 226, 0.35);
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
  cursor: pointer;
  font-size: 0.8rem;
  transition: transform var(--transition), background var(--transition),
    border-color var(--transition);
}

.settings-field__toggle:hover,
.settings-field__toggle:focus-visible {
  transform: translateY(-1px);
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(94, 124, 226, 0.6);
  outline: none;
}

.settings-field__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.settings-field__hint a {
  color: #93c5fd;
  text-decoration: none;
}

.settings-field__hint a:hover,
.settings-field__hint a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.settings-form__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.settings-form__link {
  background: none;
  border: none;
  color: rgba(148, 163, 184, 0.9);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}

.settings-form__link:hover,
.settings-form__link:focus-visible {
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.15);
  outline: none;
}

.settings-panel__info {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(12, 20, 36, 0.65);
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.85);
}

.settings-panel__info[data-state="connected"] {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(6, 78, 59, 0.35);
  color: #bbf7d0;
}

.settings-panel__info--inline[data-state="success"] {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(6, 95, 70, 0.4);
  color: #a7f3d0;
}

.settings-panel__info--inline[data-state="error"] {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(153, 27, 27, 0.38);
  color: #fecaca;
}

.settings-panel__info--inline[data-state="loading"] {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.5);
  color: rgba(226, 232, 240, 0.9);
}

.settings-section__title {
  margin: 0;
  font-size: 1rem;
}

.settings-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.settings-option__meta {
  display: grid;
  gap: 0.25rem;
  max-width: 70%;
}

.settings-option__meta strong {
  font-size: 1rem;
}

.settings-option__meta small {
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
}

.settings-option input[type="checkbox"]:checked {
  accent-color: var(--primary);
}

.settings-option input[type="checkbox"]:disabled,
.settings-option select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.settings-option select {
  min-width: 160px;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font-size: 0.9rem;
}

.settings-modal__footer {
  padding: 0 1.8rem 1.8rem;
  display: flex;
  justify-content: flex-end;
}

.settings-modal__confirm {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition);
}

.settings-modal__confirm:hover,
.settings-modal__confirm:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.4);
  background: rgba(17, 24, 39, 0.88);
  outline: none;
}

.settings-modal__confirm.secondary {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(94, 124, 226, 0.35);
  color: #bfdbfe;
}

.settings-modal__confirm.secondary:hover,
.settings-modal__confirm.secondary:focus-visible {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(94, 124, 226, 0.6);
}

@media (max-width: 640px) {
  .settings-modal {
    padding: 1.25rem;
  }

  .settings-modal__dialog {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .settings-modal__body {
    padding: 0 1.2rem 1.2rem;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    overflow: visible;
  }

  .settings-tabs {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    grid-auto-flow: row;
    max-height: none;
  }

  .settings-modal__footer {
    padding: 0 1.2rem 1.4rem;
  }

  .settings-option {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-option__meta {
    max-width: 100%;
  }

  .settings-option select {
    width: 100%;
  }

  .settings-panels {
    min-height: auto;
    height: auto;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.workspace {
  display: grid;
  grid-template-columns: var(--workspace-columns,
      minmax(220px, 260px) minmax(0, 1.1fr) minmax(320px, 0.95fr) minmax(260px, 0.85fr));
  grid-template-rows: var(--workspace-rows,
      minmax(0, 1fr) minmax(220px, 0.65fr));
  grid-template-areas: var(--workspace-areas,
      "file-sidebar editor-panel preview-panel chat-panel"
      "file-sidebar editor-panel console-panel chat-panel"
    );
  gap: 1.25rem;
  padding: 1.25rem 2rem 2rem;
  flex: 1;
  grid-auto-rows: minmax(0, auto);
}

.file-sidebar {
  background: rgba(17, 24, 39, 0.75);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.2rem 1.3rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-actions {
  display: flex;
  gap: 0.4rem;
}

.sidebar-actions button {
  padding: 0.35rem 0.7rem;
  border-radius: 10px;
  min-width: 0;
}

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

.sidebar-header h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.sidebar-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-list li {
  margin: 0;
}

.file-item {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border-radius: calc(var(--radius) / 1.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 0.65rem 0.8rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  transition: border-color var(--transition), background var(--transition),
    transform var(--transition);
}

.file-item:hover {
  border-color: rgba(94, 124, 226, 0.5);
  transform: none;
}

.file-item.active {
  background: rgba(94, 124, 226, 0.16);
  border-color: rgba(94, 124, 226, 0.5);
  box-shadow: 0 12px 25px rgba(59, 130, 246, 0.22);
  transform: none;
}

.file-icon {
  flex: 0 0 auto;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.file-icon svg text {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.file-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.file-language {
  flex: 0 0 auto;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  margin-left: auto;
}

.file-sidebar-footer {
  padding: 0.9rem 1.3rem 1.2rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.55rem;
}

.file-sidebar-footer button {
  width: 100%;
}

.layout-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.1rem;
  align-items: center;
  margin: 1rem 2rem 0;
  padding: 0.8rem 1.25rem;
  background: rgba(11, 18, 32, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: calc(var(--radius) - 4px);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
}

.layout-controls span {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-right: 0.6rem;
}

.layout-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.layout-controls input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.is-hidden {
  display: none !important;
}

.editor-panel,
.preview-panel,
.console-panel,
.chat-panel {
  background: rgba(17, 24, 39, 0.85);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.file-sidebar {
  grid-area: file-sidebar;
}

.editor-panel {
  grid-area: editor-panel;
}

.preview-panel {
  grid-area: preview-panel;
}

.console-panel {
  grid-area: console-panel;
  min-height: 220px;
}

.chat-panel {
  grid-area: chat-panel;
  min-width: 260px;
  overflow: hidden;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  overscroll-behavior: contain;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  position: sticky;
  top: 0;
  z-index: 5;
}

.toolbar span {
  font-weight: 600;
  letter-spacing: 0.02em;
}

button {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 999px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition);
}

button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  box-shadow: 0 12px 24px rgba(94, 124, 226, 0.28);
}

button.ghost {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

button.ghost:hover {
  box-shadow: none;
  transform: none;
  border-color: rgba(148, 163, 184, 0.35);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(94, 124, 226, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
  transform: none;
}

.editor {
  flex: 1;
  min-height: clamp(420px, 60vh, 720px);
  border-top: 1px solid var(--border);
}

.start-screen {
  position: fixed;
  inset: 0;
  padding: 3rem 1.5rem;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 28, 0.82);
  backdrop-filter: blur(22px);
  z-index: 999;
}

.start-screen.visible {
  display: flex;
}

.start-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(17, 24, 39, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  box-shadow: 0 42px 90px rgba(2, 6, 23, 0.6);
  max-width: min(960px, 92vw);
  width: min(960px, 92vw);
  padding: clamp(2rem, 4vw, 2.8rem);
}

.start-card__layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: stretch;
}

.start-card__content {
  display: grid;
  gap: 1.5rem;
}

.start-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(96, 165, 250, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
  width: fit-content;
}

.start-card__content h2 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.4rem);
}

.start-card__content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.start-card__highlights {
  display: grid;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.start-card__highlights li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  background: rgba(11, 18, 32, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 0.9rem 1.1rem;
}

.start-card__highlights strong {
  font-size: 1rem;
  color: var(--text);
}

.start-card__highlights p {
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.highlight-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

.start-card__panel {
  background: rgba(8, 13, 26, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: clamp(1.4rem, 3vw, 1.8rem);
  display: grid;
  gap: 1.4rem;
  align-content: start;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.start-card__panel-title {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.start-card__panel-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.75);
  box-shadow: 0 0 18px rgba(96, 165, 250, 0.55);
}

.start-card__actions {
  display: grid;
  gap: 0.75rem;
}

.start-card__actions .hidden,
.start-card__meta .hidden {
  display: none;
}

.button-pair {
  width: 100%;
  font-size: 1rem;
  padding: 0.85rem 1.3rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button-pair.primary {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #0b1120;
  box-shadow: 0 22px 44px rgba(96, 165, 250, 0.35);
}

.button-pair.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--text);
}

.button-pair.secondary:hover {
  border-color: rgba(148, 163, 184, 0.45);
}

.button-pair:hover {
  transform: translateY(-1px);
}

.start-card__meta {
  display: grid;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.start-card__meta div {
  background: rgba(12, 19, 34, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.4rem;
}

.start-card__meta strong {
  font-size: 1.05rem;
  color: var(--text);
}

.start-card__meta p {
  margin: 0;
  line-height: 1.5;
}

.meta-label {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(191, 219, 254, 0.75);
}

body.start-screen-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .start-card {
    padding: clamp(1.8rem, 6vw, 2.4rem);
  }

  .start-card__highlights li {
    grid-template-columns: minmax(32px, 38px) 1fr;
    gap: 0.75rem;
  }

  .start-card__panel {
    padding: clamp(1.2rem, 4vw, 1.6rem);
  }
}

.preview-panel iframe {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
}

.console-output {
  padding: 1rem 1.2rem 1.2rem;
  flex: 1;
  background: rgba(11, 18, 32, 0.78);
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid var(--border);
  overflow: hidden;
}

#console-log {
  margin: 0;
  height: 100%;
  overflow-y: auto;
  max-height: none;
  font-family: "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.85rem;
  color: var(--accent);
  white-space: pre-wrap;
  padding-right: 0.4rem;
}

.chat-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem 1.4rem 1.6rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  height: 100%;
  overscroll-behavior: contain;
}

.chat-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.6rem 0.75rem;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(11, 18, 32, 0.6);
}

.chat-actions__title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.9);
}

.chat-actions__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chat-action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition), color var(--transition);
}

.chat-action-button:hover,
.chat-action-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.45);
  background: rgba(17, 24, 39, 0.88);
  outline: none;
  color: var(--text);
}

.chat-action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(148, 163, 184, 0.7);
}

.chat-action-button__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.chat-message {
  background: rgba(12, 20, 36, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.5rem;
  max-width: 92%;
}

.chat-message--system {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.14);
}

.chat-message--user {
  margin-left: auto;
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(94, 124, 226, 0.38);
  text-align: left;
}

.chat-message--user .chat-message__title,
.chat-message--user p {
  color: #e0eaff;
}

.chat-message--assistant {
  border-color: rgba(16, 185, 129, 0.32);
  background: rgba(22, 163, 74, 0.12);
}

.chat-message--assistant .chat-message__title,
.chat-message--assistant p {
  color: #d1fae5;
}

.chat-message--pending {
  opacity: 0.7;
  position: relative;
}

.chat-message--error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(127, 29, 29, 0.3);
}

.chat-message--error .chat-message__title,
.chat-message--error p {
  color: #fecaca;
}

.chat-message__title {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-message p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
}

.chat-message--system p {
  color: #dbeafe;
}

.chat-input {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.chat-input.is-disabled textarea,
.chat-input.is-disabled .chat-send-button {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input__footer {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.chat-input__buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.chat-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition);
}

.chat-icon-button:hover,
.chat-icon-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.4);
  background: rgba(17, 24, 39, 0.82);
  outline: none;
}

.chat-send-button {
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
  cursor: pointer;
  font-weight: 500;
  transition: transform var(--transition), border-color var(--transition),
    background var(--transition), color var(--transition);
}

.chat-send-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  background: rgba(15, 23, 42, 0.65);
  color: var(--muted);
  border-color: rgba(148, 163, 184, 0.24);
}

.chat-send-button:not(:disabled):hover,
.chat-send-button:not(:disabled):focus-visible {
  transform: translateY(-1px);
  border-color: rgba(94, 124, 226, 0.5);
  background: rgba(37, 99, 235, 0.28);
  outline: none;
}

.chat-input.is-busy textarea,
.chat-input.is-busy .chat-send-button {
  cursor: progress;
}

.chat-action-button__icon svg,
.chat-icon-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.chat-input textarea {
  resize: none;
  min-height: 96px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  padding: 0.9rem 1.1rem;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-input textarea:disabled {
  opacity: 0.6;
}

.chat-input button {
  justify-content: center;
}

.toast {
  position: fixed;
  inset: auto auto 2rem 50%;
  transform: translateX(-50%) translateY(130%);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  pointer-events: none;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
}

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

.status-pill.info {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
}

.status-pill.success {
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.2);
}

.status-pill.warning {
  background: rgba(245, 158, 11, 0.14);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.24);
}

.status-pill.error {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

@media (max-width: 1080px) {
  .workspace {
    --workspace-columns: 1fr;
    --workspace-rows: auto;
    --workspace-areas: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: none;
  }

  .file-sidebar,
  .editor-panel,
  .preview-panel,
  .console-panel,
  .chat-panel {
    grid-area: auto;
  }

  .preview-panel {
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .workspace {
    padding: 1.5rem;
    gap: 1rem;
    grid-template-rows: none;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  button {
    width: 100%;
    justify-content: center;
  }

  .sidebar-actions {
    justify-content: flex-end;
  }

  .file-sidebar {
    order: -1;
  }

  .console-panel {
    grid-column: 1;
  }

  .chat-panel {
    grid-column: 1;
  }

  .start-card__layout {
    grid-template-columns: 1fr;
  }

  .start-card__panel {
    order: -1;
  }
}
