:root {
  color-scheme: light;
  --bg-start: #eaf4fb;
  --bg-end: #f7fbff;
  --text: #102033;
  --muted: rgba(16, 32, 51, 0.68);
  --line: rgba(148, 163, 184, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.22);
  --glass-bg-strong: rgba(255, 255, 255, 0.3);
  --glass-border: rgba(255, 255, 255, 0.42);
  --shadow: 0 24px 80px rgba(23, 53, 84, 0.16);
  --button: linear-gradient(135deg, #00a9d6, #26c7b8);
  --button-text: #f7ffff;
  --secondary-bg: rgba(255, 255, 255, 0.42);
  --warning-bg: rgba(255, 194, 112, 0.26);
  --warning-border: rgba(255, 168, 76, 0.4);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-start: #07121d;
  --bg-end: #101b2b;
  --text: #eef7ff;
  --muted: rgba(238, 247, 255, 0.72);
  --line: rgba(94, 121, 151, 0.14);
  --glass-bg: rgba(15, 24, 38, 0.45);
  --glass-bg-strong: rgba(19, 29, 45, 0.56);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.35);
  --button: linear-gradient(135deg, #0d7ea1, #1e8f86);
  --button-text: #f3ffff;
  --secondary-bg: rgba(255, 255, 255, 0.08);
  --warning-bg: rgba(191, 118, 34, 0.18);
  --warning-border: rgba(255, 173, 92, 0.32);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Outfit", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.6), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(0, 200, 255, 0.2), transparent 35%),
    linear-gradient(145deg, var(--bg-start), var(--bg-end));
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.background-layer,
.grid-overlay {
  position: absolute;
  inset: 0;
}

.grid-overlay {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 88%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: float 10s infinite ease-in-out;
}

.orb1 {
  top: 8%;
  left: 8%;
  width: 240px;
  height: 240px;
  background: rgba(255, 255, 255, 0.55);
}

.orb2 {
  top: 16%;
  right: 12%;
  width: 280px;
  height: 280px;
  background: rgba(0, 195, 255, 0.22);
  animation-delay: -2s;
}

.orb3 {
  bottom: 10%;
  left: 48%;
  width: 320px;
  height: 320px;
  background: rgba(23, 189, 173, 0.18);
  animation-delay: -4s;
}

.topbar,
.app-frame {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 8px;
}

.brand-pill,
.theme-toggle,
.button {
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.brand-pill,
.theme-toggle,
.button-secondary,
.button-ghost {
  background: var(--secondary-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-pill:hover,
.theme-toggle:hover,
.button:hover {
  transform: translateY(-1px);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.theme-toggle__icon {
  font-size: 18px;
  line-height: 1;
}

.app-frame {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.12)),
    var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 32px;
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 24px 80px -32px rgba(12, 74, 110, 0.45),
    var(--shadow);
}

.hero-card,
.view-card {
  padding: 30px;
}

.hero-card {
  max-width: 840px;
  margin: 24px auto 0;
}

.view-card {
  max-width: 940px;
  margin: 24px auto 0;
}

.card-expanded {
  max-width: min(1280px, calc(100vw - 32px));
}

.eyebrow {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.38);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 16px 0 8px;
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 4.6rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.hero-copy,
.muted,
.status-line,
.empty-state p {
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.inset-panel {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.28);
}

.mini-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inset-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.metrics-row,
.toolbar,
.toolbar-actions,
.view-header,
.status-row,
.editor-toolbar,
.editor-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.metrics-row {
  margin: 20px 0;
}

.metrics-row span,
.status-pill {
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.34);
  font-size: 14px;
}

.status-pill--ok {
  background: rgba(26, 184, 140, 0.18);
}

.status-pill--warn {
  background: rgba(255, 174, 0, 0.16);
}

.editor {
  width: 100%;
  min-height: 400px;
  margin-top: 10px;
  padding: 18px;
  border: none;
  border-radius: 20px;
  resize: none;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12)),
    var(--glass-bg-strong);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

.card-expanded .editor {
  min-height: min(78vh, 900px);
}

.editor:focus {
  outline: 2px solid rgba(17, 173, 206, 0.55);
  outline-offset: 3px;
}

.toolbar,
.status-row {
  justify-content: space-between;
  margin-top: 16px;
}

.editor-toolbar {
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.button {
  font-weight: 600;
}

.button-small {
  padding: 10px 14px;
  font-size: 14px;
}

.button-primary {
  color: var(--button-text);
  background: var(--button);
  box-shadow: 0 14px 28px rgba(14, 165, 233, 0.18);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.34);
}

.button-ghost {
  background: transparent;
}

.warning-banner,
.inline-error,
.toast,
.empty-state {
  margin-top: 16px;
  border-radius: 18px;
  padding: 16px 18px;
}

.warning-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
}

.inline-error {
  color: #b23a3a;
  background: rgba(255, 237, 237, 0.52);
  border: 1px solid rgba(204, 92, 92, 0.2);
}

:root[data-theme="dark"] .inline-error {
  color: #ffc0c0;
  background: rgba(110, 25, 25, 0.32);
  border-color: rgba(255, 164, 164, 0.14);
}

.toast {
  max-width: 440px;
  margin: 0 auto 16px;
  background: rgba(12, 32, 48, 0.84);
  color: #f7fbff;
  text-align: center;
}

.empty-state {
  background: rgba(255, 255, 255, 0.18);
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .topbar,
  .app-frame {
    width: min(100% - 20px, 100%);
  }

  .hero-card,
  .view-card {
    padding: 22px;
    border-radius: 24px;
  }

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

  .editor {
    min-height: 300px;
  }

  .view-header,
  .editor-toolbar,
  .toolbar,
  .status-row {
    align-items: stretch;
  }
}
