:root {
  --bg: #f5f0e8;
  --panel: rgba(252, 249, 244, 0.88);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --text: #1f1e1a;
  --muted: #665f54;
  --line: rgba(65, 56, 40, 0.12);
  --accent: #c95a1c;
  --accent-dark: #8f3c0f;
  --shadow: 0 22px 50px rgba(73, 52, 20, 0.16);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(221, 154, 84, 0.28), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(73, 124, 128, 0.2), transparent 24%),
    linear-gradient(180deg, #faf5ee 0%, #f2e7d7 48%, #efe6dc 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  pointer-events: none;
  filter: blur(10px);
}

body::before {
  width: 340px;
  height: 340px;
  top: 9%;
  right: 3%;
  background: rgba(182, 73, 33, 0.12);
  border-radius: 42% 58% 63% 37% / 47% 31% 69% 53%;
}

body::after {
  width: 280px;
  height: 280px;
  bottom: 5%;
  left: 2%;
  background: rgba(84, 121, 118, 0.13);
  border-radius: 55% 45% 31% 69% / 38% 53% 47% 62%;
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(85, 66, 35, 0.1);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px 34px 30px;
  border-radius: 34px;
}

.hero-copy::after,
.hero-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), transparent 45%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.hero h1 {
  margin: 0;
  max-width: 9ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.hero-text,
.panel-heading p,
.hint,
.status,
.preview-header span,
.library-summary span {
  color: var(--muted);
}

.hero-text {
  max-width: 62ch;
  margin: 16px 0 0;
  font-size: 1.03rem;
  line-height: 1.65;
}

.hero-card {
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(31, 30, 26, 0.94), rgba(57, 46, 33, 0.94));
  color: #f7efe1;
}

.hero-card-label {
  margin: 0 0 18px;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 239, 225, 0.72);
}

.hero-card ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

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

.controls-panel,
.library-panel {
  display: grid;
  gap: 20px;
}

.preview-panel {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
}

.panel-heading h2,
.preview-header h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.panel-heading p {
  margin: 8px 0 0;
  line-height: 1.55;
}

.control-group {
  display: grid;
  gap: 8px;
}

.controls-grid {
  display: grid;
  gap: 16px;
}

label {
  font-weight: 700;
}

input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px dashed rgba(71, 54, 27, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(71, 54, 27, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

output {
  min-width: 62px;
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.integration-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(79, 60, 27, 0.1);
  background: rgba(255, 252, 246, 0.82);
}

.compact-heading p {
  margin-top: 6px;
}

.google-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.google-meta a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration-thickness: 1.5px;
}

button {
  appearance: none;
  border: 1px solid rgba(77, 54, 31, 0.14);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(90, 63, 26, 0.14);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), #d77d2d);
  border-color: rgba(129, 57, 18, 0.28);
}

.status {
  min-height: 48px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(79, 63, 31, 0.1);
  background: rgba(255, 252, 246, 0.92);
  line-height: 1.5;
}

.preview-grid {
  display: grid;
  gap: 18px;
}

.preview-card {
  display: grid;
  gap: 12px;
}

.preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.canvas-frame {
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(242, 229, 211, 0.7)),
    repeating-linear-gradient(
      45deg,
      rgba(195, 168, 136, 0.08),
      rgba(195, 168, 136, 0.08) 14px,
      rgba(255, 255, 255, 0.06) 14px,
      rgba(255, 255, 255, 0.06) 28px
    );
  border: 1px solid rgba(82, 61, 29, 0.08);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 68vh;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.library-summary {
  display: flex;
  gap: 24px;
}

.library-summary strong {
  display: block;
  font-size: 1.7rem;
  font-family: Georgia, "Times New Roman", serif;
}

.source-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 14px;
}

.empty-state {
  min-height: 140px;
  place-items: center;
  border: 1px dashed rgba(78, 59, 31, 0.2);
  border-radius: 22px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 251, 245, 0.76);
}

.source-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(79, 60, 27, 0.08);
  background: var(--panel-strong);
}

.source-thumb {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}

.source-meta {
  display: grid;
  gap: 4px;
}

.source-name {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.3;
  word-break: break-word;
}

.source-origin {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(201, 90, 28, 0.1);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.source-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

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

  .preview-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding-inline: 14px;
  }

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

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 24px;
  }

  .hero-copy {
    padding: 28px 24px;
  }

  .panel {
    padding: 20px;
  }

  .preview-header,
  .library-summary,
  .button-row {
    flex-direction: column;
    align-items: flex-start;
  }

  canvas {
    max-height: 50vh;
  }
}
