@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #050816;
  --surface: rgba(9, 15, 30, 0.82);
  --surface-strong: rgba(8, 13, 26, 0.94);
  --surface-soft: rgba(15, 23, 42, 0.68);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(96, 165, 250, 0.28);
  --text: #e5eefb;
  --muted: #93a4c3;
  --muted-strong: #bfd0eb;
  --primary: #3b82f6;
  --secondary: #22d3ee;
  --accent: #f97316;
  --success: #22c55e;
  --shadow: 0 26px 80px rgba(2, 6, 23, 0.5);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-heading: "Poppins", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Open Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef4ff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(237, 244, 255, 0.84);
  --border: rgba(148, 163, 184, 0.22);
  --border-strong: rgba(59, 130, 246, 0.28);
  --text: #10213a;
  --muted: #556987;
  --muted-strong: #314766;
  --primary: #2563eb;
  --secondary: #0ea5e9;
  --accent: #ea580c;
  --success: #16a34a;
  --shadow: 0 26px 80px rgba(148, 163, 184, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(59, 130, 246, 0.18), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(34, 211, 238, 0.14), transparent 18%),
    linear-gradient(180deg, #050816 0%, #081120 52%, #050816 100%);
  color: var(--text);
  font-family: var(--font-body);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: var(--font-mono);
}

.bg-orb {
  position: fixed;
  inset: auto;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}

.orb-left {
  top: 6rem;
  left: -9rem;
  background: rgba(59, 130, 246, 0.35);
}

.orb-right {
  top: 18rem;
  right: -8rem;
  background: rgba(34, 211, 238, 0.24);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  border-radius: 999px;
  margin-bottom: 24px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #e0f2fe;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(34, 211, 238, 0.18));
  border: 1px solid rgba(96, 165, 250, 0.22);
}

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

.brand-overline,
.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
}

.brand strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 1rem;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--muted-strong);
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 42px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.theme-switcher-copy {
  display: grid;
  gap: 2px;
  padding-left: 8px;
}

.theme-switcher-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
}

.theme-status {
  color: var(--muted-strong);
  font-size: 0.8rem;
  white-space: nowrap;
}

.theme-switcher-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.theme-toggle-option {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 600;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.theme-toggle-option:hover,
.theme-toggle-option:focus-visible {
  outline: none;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(96, 165, 250, 0.16);
  color: var(--text);
}

.theme-toggle-option.is-active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.26);
  color: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.panel h2 {
  margin: 0;
  font-family: var(--font-heading);
  line-height: 1.08;
}

.stat-card,
.insight-note {
  background: var(--surface-soft);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-lg);
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 1rem;
  margin-bottom: 6px;
}

.template-card p,
.field-hint,
.insight-note li {
  color: var(--muted);
  line-height: 1.66;
}

.template-badge,
.template-tag,
.source-badge,
.toolbar-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  white-space: nowrap;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(320px, 680px);
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
}

.control-column {
  display: grid;
  gap: 14px;
  width: 100%;
  font-size: 0.92rem;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.control-column .panel {
  padding: 18px;
  border-radius: 24px;
}

.control-column .panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.panel-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: #b6f4ff;
  font-size: 0.74rem;
  white-space: nowrap;
}

.control-column .panel-kicker {
  margin-bottom: 5px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.control-column h2 {
  font-size: 1.08rem;
}

.panel-header,
.preview-actions,
.preview-toolbar,
.input-shell,
.preset-list,
.insight-grid,
.template-card-head {
  display: flex;
  gap: 12px;
}

.panel-header {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.control-column .panel-header {
  margin-bottom: 14px;
}

.compact-form-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background:
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(8, 13, 26, 0.84) 42%),
    rgba(8, 13, 26, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 44px rgba(2, 6, 23, 0.24);
}

.compact-form-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%);
}

.base-url-shell {
  display: grid;
  gap: 12px;
}

.base-url-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.base-url-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.base-url-status-pill.is-empty {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #d8e2f2;
}

.base-url-status-pill.is-ready {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.base-url-status-pill.is-warning {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.18);
  color: #fdba74;
}

.base-url-status-detail {
  color: var(--muted-strong);
  font-size: 0.82rem;
  line-height: 1.5;
}

.base-url-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(5, 10, 24, 0.56);
  border: 1px solid rgba(96, 165, 250, 0.12);
}

.base-url-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.base-url-meta strong {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #dbeafe;
  word-break: break-word;
}

.template-switcher {
  display: grid;
  gap: 10px;
}

.template-card {
  width: 100%;
  text-align: left;
  padding: 14px 14px 12px;
  border-radius: var(--radius-lg);
  background: rgba(8, 13, 26, 0.74);
  border: 1px solid rgba(148, 163, 184, 0.14);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.template-card:hover,
.template-card:focus-visible {
  background: rgba(10, 17, 31, 0.94);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(96, 165, 250, 0.08),
    0 10px 26px rgba(15, 23, 42, 0.16);
  outline: none;
}

.template-card.is-active {
  border-color: rgba(96, 165, 250, 0.68);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.16), rgba(8, 13, 26, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(96, 165, 250, 0.1),
    0 10px 28px rgba(15, 23, 42, 0.22);
}

.template-card-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.template-badge {
  min-height: 28px;
  padding: 0 9px;
  background: rgba(59, 130, 246, 0.14);
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 700;
}

.template-tag {
  min-height: 28px;
  padding: 0 9px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--muted-strong);
  font-size: 0.74rem;
}

.template-card strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.94rem;
  margin-bottom: 6px;
}

.form-group,
.preset-section {
  display: grid;
  gap: 8px;
}

.form-group label,
.group-label,
.insight-note h3 {
  font-weight: 600;
}

.control-column .form-group label,
.control-column .group-label,
.control-column .field-hint,
.control-column .template-card p,
.control-column .stat-card span,
.control-column .insight-note li,
.control-column .preset-note,
.control-column .preset-chip,
.control-column .secondary-button,
.control-column input[type="url"] {
  font-size: 0.88rem;
}

.control-column .stat-card strong {
  font-size: 0.92rem;
}

.stat-card-emphasis {
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(8, 13, 26, 0.78)),
    rgba(8, 13, 26, 0.88);
  border-color: rgba(96, 165, 250, 0.16);
}

.input-shell {
  align-items: stretch;
  padding: 4px;
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(96, 165, 250, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.compact-form-panel .input-shell {
  flex-wrap: nowrap;
}

input[type="url"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(6, 10, 22, 0.88);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.compact-form-panel input[type="url"] {
  flex: 1 1 auto;
  min-width: 0;
}

input[type="url"]:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.12),
    0 8px 24px rgba(37, 99, 235, 0.12);
}

.preset-list,
.insight-grid,
.preview-toolbar {
  flex-wrap: wrap;
}

.preset-chip,
.secondary-button,
.primary-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.preset-chip,
.secondary-button {
  background: rgba(9, 15, 30, 0.92);
  border-color: rgba(148, 163, 184, 0.14);
  color: var(--text);
}

.compact-form-panel .secondary-button {
  background: rgba(15, 23, 42, 0.92);
}

.compact-form-panel #reset-base-url {
  flex: 0 0 auto;
  white-space: nowrap;
}

.preset-chip:hover,
.preset-chip:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible {
  outline: none;
  border-color: rgba(96, 165, 250, 0.42);
}

.primary-button {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #22d3ee 100%);
  color: white;
  font-weight: 700;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 12px 12px 10px;
  background: rgba(8, 13, 26, 0.82);
  border-color: rgba(148, 163, 184, 0.1);
}

.insight-note {
  margin-top: 12px;
  padding: 14px 14px 12px;
}

.insight-note h3 {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
}

.insight-note ul {
  margin: 0;
  padding-left: 18px;
}

.panel-divider {
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0), rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0));
}

.template-summary {
  display: grid;
  gap: 12px;
}

.sidebar-overview-panel {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.24), rgba(8, 13, 26, 0.82)),
    rgba(8, 13, 26, 0.88);
}

.summary-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.94rem;
}

.summary-header .panel-kicker {
  margin-bottom: 6px;
}

.compact-grid {
  gap: 8px;
}

.compact-note h3 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.compact-note ul {
  padding-left: 16px;
}

.preset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-note {
  color: var(--muted);
}

.compact-form-panel .preset-list {
  gap: 8px;
}

.compact-form-panel .field-hint {
  font-size: 0.88rem;
  color: #b8c7e4;
}

.compact-form-panel .preset-chip {
  min-height: 34px;
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.72);
  border-color: rgba(96, 165, 250, 0.12);
}

.compact-form-panel .preset-chip.is-active {
  background: rgba(14, 24, 46, 0.98);
  border-color: rgba(96, 165, 250, 0.4);
  color: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12);
}

.compact-form-panel .preset-chip:hover,
.compact-form-panel .preset-chip:focus-visible {
  background: rgba(14, 24, 46, 0.96);
  border-color: rgba(96, 165, 250, 0.36);
  box-shadow: 0 8px 18px rgba(8, 13, 26, 0.2);
}

.preview-panel {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: clamp(680px, calc(100vh - 40px), 920px);
  min-height: 680px;
}

.preview-header {
  margin-bottom: 0;
}

.preview-actions {
  align-items: center;
}

.source-badge {
  min-height: 34px;
  padding: 0 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
  font-size: 0.84rem;
}

.preview-toolbar {
  justify-content: space-between;
  align-items: center;
}

.preview-toolbar-group,
.preview-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.preview-toolbar-actions {
  justify-content: flex-end;
}

.toolbar-pill {
  min-height: 34px;
  padding: 0 12px;
  background: rgba(8, 13, 26, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--muted-strong);
  font-size: 0.84rem;
}

.toolbar-pill-active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.18);
  color: #dbeafe;
}

.toolbar-pill strong {
  margin-left: 6px;
  color: var(--text);
}

.toolbar-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.toolbar-button[aria-pressed="true"] {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.28);
  color: #dbeafe;
}

.toolbar-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.code-frame {
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.44), rgba(2, 6, 23, 0.84)),
    rgba(2, 6, 23, 0.88);
}

.code-window-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.code-window-bar span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.34);
}

.code-window-bar span:nth-child(1) {
  background: rgba(248, 113, 113, 0.72);
}

.code-window-bar span:nth-child(2) {
  background: rgba(250, 204, 21, 0.72);
}

.code-window-bar span:nth-child(3) {
  background: rgba(74, 222, 128, 0.72);
}

.code-content {
  margin: 0;
  min-height: 0;
  flex: 1;
  padding: 12px 10px 18px 0;
  color: #dbeafe;
  font-size: 0.9rem;
  line-height: 1.72;
  overflow: auto;
}

.code-line {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: start;
  min-height: 1.9em;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.code-line::before {
  content: "";
  position: absolute;
  inset: 6px auto 6px 0;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background-color 180ms ease;
}

.code-line:hover {
  background: rgba(59, 130, 246, 0.08);
}

.code-line.is-locked {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.code-line.is-locked::before {
  background: linear-gradient(180deg, rgba(96, 165, 250, 1), rgba(34, 211, 238, 0.9));
}

.code-line.is-flash {
  background: rgba(34, 197, 94, 0.12);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.24);
}

.code-line.is-flash::before {
  background: linear-gradient(180deg, rgba(74, 222, 128, 1), rgba(34, 197, 94, 0.92));
}

.line-number {
  display: block;
  padding: 0 14px 0 0;
  color: #475569;
  text-align: right;
  user-select: none;
  border-right: 1px solid rgba(148, 163, 184, 0.1);
}

.code-line:hover .line-number,
.code-line.is-locked .line-number,
.code-line.is-flash .line-number {
  color: #cbd5e1;
}

.line-content {
  display: block;
  padding-left: 16px;
  white-space: pre;
}

.code-content.is-lines-hidden {
  padding-left: 12px;
}

.code-content.is-lines-hidden .code-line {
  grid-template-columns: minmax(0, 1fr);
}

.code-content.is-lines-hidden .line-number {
  display: none;
}

.code-content.is-lines-hidden .line-content {
  padding-left: 8px;
}

.tok-comment {
  color: #64748b;
}

.tok-section {
  color: #7dd3fc;
}

.tok-key {
  color: #93c5fd;
}

.tok-operator {
  color: #cbd5e1;
}

.tok-string {
  color: #f9a8d4;
}

.tok-number {
  color: #facc15;
}

.tok-boolean {
  color: #86efac;
}

.tok-punct {
  color: #cbd5e1;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 12% 12%, rgba(59, 130, 246, 0.14), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(34, 211, 238, 0.12), transparent 18%),
    linear-gradient(180deg, #f7fbff 0%, #edf4ff 52%, #f7fbff 100%);
}

:root[data-theme="light"] .orb-left {
  background: rgba(59, 130, 246, 0.2);
}

:root[data-theme="light"] .orb-right {
  background: rgba(14, 165, 233, 0.16);
}

:root[data-theme="light"] .brand-mark {
  color: #1d4ed8;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.16));
  border-color: rgba(59, 130, 246, 0.18);
}

:root[data-theme="light"] .topbar-pill,
:root[data-theme="light"] .theme-switcher {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

:root[data-theme="light"] .theme-toggle-option:hover,
:root[data-theme="light"] .theme-toggle-option:focus-visible {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(59, 130, 246, 0.18);
  color: #1d4ed8;
}

:root[data-theme="light"] .theme-toggle-option.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.24);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

:root[data-theme="light"] .panel-chip {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.18);
  color: #0369a1;
}

:root[data-theme="light"] .compact-form-panel {
  border-color: rgba(96, 165, 250, 0.18);
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.92) 42%),
    rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 18px 44px rgba(148, 163, 184, 0.18);
}

:root[data-theme="light"] .compact-form-panel::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.56), transparent 22%);
}

:root[data-theme="light"] .base-url-status-pill.is-empty {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.18);
  color: #475569;
}

:root[data-theme="light"] .base-url-status-pill.is-ready,
:root[data-theme="light"] .source-badge {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}

:root[data-theme="light"] .base-url-status-pill.is-warning {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.18);
  color: #c2410c;
}

:root[data-theme="light"] .base-url-meta {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="light"] .base-url-label {
  color: #0369a1;
}

:root[data-theme="light"] .base-url-meta strong,
:root[data-theme="light"] .template-card strong,
:root[data-theme="light"] .toolbar-pill strong,
:root[data-theme="light"] .code-content {
  color: #10213a;
}

:root[data-theme="light"] .template-card {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="light"] .template-card:hover,
:root[data-theme="light"] .template-card:focus-visible {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(59, 130, 246, 0.26);
  box-shadow:
    inset 0 0 0 1px rgba(96, 165, 250, 0.06),
    0 10px 26px rgba(148, 163, 184, 0.18);
}

:root[data-theme="light"] .template-card.is-active {
  border-color: rgba(59, 130, 246, 0.42);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(96, 165, 250, 0.1),
    0 12px 28px rgba(148, 163, 184, 0.18);
}

:root[data-theme="light"] .template-badge {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

:root[data-theme="light"] .template-tag {
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
  color: #475569;
}

:root[data-theme="light"] .stat-card-emphasis {
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.96), rgba(255, 255, 255, 0.98));
  border-color: rgba(96, 165, 250, 0.18);
}

:root[data-theme="light"] .input-shell {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] input[type="url"] {
  background: rgba(255, 255, 255, 0.96);
  color: #10213a;
}

:root[data-theme="light"] input[type="url"]:focus {
  border-color: rgba(59, 130, 246, 0.36);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.1),
    0 8px 24px rgba(96, 165, 250, 0.16);
}

:root[data-theme="light"] .preset-chip,
:root[data-theme="light"] .secondary-button,
:root[data-theme="light"] .toolbar-pill,
:root[data-theme="light"] .toolbar-button {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.18);
  color: #10213a;
}

:root[data-theme="light"] .compact-form-panel .secondary-button {
  background: rgba(241, 245, 249, 0.96);
}

:root[data-theme="light"] .preset-chip:hover,
:root[data-theme="light"] .preset-chip:focus-visible,
:root[data-theme="light"] .secondary-button:hover,
:root[data-theme="light"] .secondary-button:focus-visible,
:root[data-theme="light"] .toolbar-button:hover,
:root[data-theme="light"] .toolbar-button:focus-visible {
  border-color: rgba(59, 130, 246, 0.28);
}

:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .insight-note {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="light"] .panel-divider {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0), rgba(148, 163, 184, 0.22), rgba(148, 163, 184, 0));
}

:root[data-theme="light"] .sidebar-overview-panel {
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.72), rgba(255, 255, 255, 0.94)),
    rgba(255, 255, 255, 0.92);
}

:root[data-theme="light"] .compact-form-panel .field-hint {
  color: #556987;
}

:root[data-theme="light"] .compact-form-panel .preset-chip {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="light"] .compact-form-panel .preset-chip.is-active {
  background: rgba(239, 246, 255, 0.98);
  border-color: rgba(59, 130, 246, 0.28);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

:root[data-theme="light"] .compact-form-panel .preset-chip:hover,
:root[data-theme="light"] .compact-form-panel .preset-chip:focus-visible {
  background: rgba(239, 246, 255, 0.96);
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: 0 8px 18px rgba(148, 163, 184, 0.14);
}

:root[data-theme="light"] .toolbar-pill-active,
:root[data-theme="light"] .toolbar-button[aria-pressed="true"] {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.22);
  color: #1d4ed8;
}

:root[data-theme="light"] .code-frame {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.84), rgba(255, 255, 255, 0.98)),
    rgba(255, 255, 255, 0.96);
}

:root[data-theme="light"] .code-window-bar {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="light"] .code-window-bar span {
  background: rgba(148, 163, 184, 0.26);
}

:root[data-theme="light"] .code-line:hover {
  background: rgba(37, 99, 235, 0.06);
}

:root[data-theme="light"] .code-line.is-locked {
  background: rgba(37, 99, 235, 0.08);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.16);
}

:root[data-theme="light"] .code-line.is-flash {
  background: rgba(22, 163, 74, 0.08);
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.18);
}

:root[data-theme="light"] .line-number {
  color: #8aa0bd;
  border-right-color: rgba(148, 163, 184, 0.16);
}

:root[data-theme="light"] .code-line:hover .line-number,
:root[data-theme="light"] .code-line.is-locked .line-number,
:root[data-theme="light"] .code-line.is-flash .line-number {
  color: #475569;
}

:root[data-theme="light"] .tok-comment {
  color: #64748b;
}

:root[data-theme="light"] .tok-section {
  color: #0369a1;
}

:root[data-theme="light"] .tok-key {
  color: #2563eb;
}

:root[data-theme="light"] .tok-operator,
:root[data-theme="light"] .tok-punct {
  color: #475569;
}

:root[data-theme="light"] .tok-string {
  color: #be185d;
}

:root[data-theme="light"] .tok-number {
  color: #b45309;
}

:root[data-theme="light"] .tok-boolean {
  color: #15803d;
}

:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(148, 163, 184, 0.2);
  color: #10213a;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(8, 13, 26, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: white;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1180px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
    height: auto;
    min-height: 680px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
    padding: 18px 0 40px;
  }

  .topbar,
  .panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar,
  .panel-header,
  .preview-header,
  .topbar-actions,
  .theme-switcher,
  .preview-actions,
  .input-shell,
  .preview-toolbar,
  .preview-toolbar-group,
  .preview-toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .compact-form-panel .input-shell {
    flex-direction: row;
    align-items: stretch;
  }

  .theme-switcher {
    justify-content: space-between;
  }

  .theme-switcher-copy {
    padding-left: 0;
  }

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

  .code-content {
    padding: 18px;
    font-size: 0.84rem;
  }

  .code-line {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .line-number {
    padding-right: 10px;
  }

  .code-content.is-lines-hidden {
    padding-left: 10px;
  }

  .line-content {
    padding-left: 12px;
  }

  .code-frame {
    min-height: 520px;
  }
}
