:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #101317;
  --muted: #5d6673;
  --quiet: #8c949d;
  --line: #e5e9ee;
  --soft: #f6f8fa;
  --soft-blue: #f1fafb;
  --aqua: #00a6b8;
  --green: #2ba76f;
  --gold: #d69b25;
  --coral: #e35d4f;
  --shadow: 0 18px 54px rgba(22, 33, 44, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(0, 166, 184, 0.04), transparent 460px),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(229, 233, 238, 0.88);
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand,
.topnav,
.caption-row,
.button-row,
.action-stack {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-weight: 780;
  text-decoration: none;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aqua), var(--green) 70%);
  box-shadow: 0 0 0 6px rgba(0, 166, 184, 0.1);
}

.topnav {
  gap: 24px;
  color: var(--muted);
  font-size: 0.94rem;
}

.topnav a {
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(420px, 1fr) minmax(260px, 310px);
  align-items: start;
  gap: 18px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px;
}

.panel,
.canvas-panel,
.recipe-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 36px rgba(22, 33, 44, 0.04);
}

.panel {
  min-width: 0;
  padding: 22px;
}

.panel-heading {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #007c8b;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.35rem;
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.panel-heading p:last-child,
.section-heading p,
.recipe-grid p,
.recipe-box p {
  color: var(--muted);
}

.upload-zone {
  position: relative;
  margin: 20px 0 22px;
  border: 1px dashed rgba(0, 166, 184, 0.55);
  border-radius: var(--radius);
  background: var(--soft-blue);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.upload-zone.dragging {
  transform: translateY(-1px);
  border-color: #007c8b;
  background: #e9f9fb;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-zone label {
  display: grid;
  gap: 4px;
  min-height: 92px;
  align-content: center;
  padding: 18px;
  cursor: pointer;
}

.upload-zone span {
  color: var(--muted);
  font-size: 0.92rem;
}

.control-stack {
  display: grid;
  gap: 18px;
}

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

.control-stack label span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #303842;
  font-size: 0.93rem;
  font-weight: 700;
}

output {
  color: #007c8b;
}

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

.button-row,
.action-stack {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button-row button,
.action-stack button,
.view-toggle button {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.button-row button:hover,
.action-stack button:hover,
.view-toggle button:hover {
  border-color: rgba(0, 166, 184, 0.5);
}

.canvas-panel {
  min-width: 0;
  padding: 18px;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  background: var(--soft);
}

.view-toggle button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.view-toggle button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(22, 33, 44, 0.08);
}

.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 166, 184, 0.05), transparent),
    #f8fafb;
  overflow: hidden;
}

#previewCanvas {
  width: 100%;
  aspect-ratio: 1.58 / 1;
  display: block;
}

.split-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(16, 19, 23, 0.16), 0 0 24px rgba(0, 166, 184, 0.4);
  pointer-events: none;
}

.split-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(16, 19, 23, 0.18);
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.caption-row {
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.readout {
  display: grid;
  align-content: start;
  gap: 18px;
}

.score-card {
  border-radius: var(--radius);
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(0, 166, 184, 0.14), rgba(43, 167, 111, 0.08)),
    #fff;
}

.score-card strong {
  display: block;
  font-size: 4rem;
  line-height: 0.95;
}

.score-card span,
.mini-grid span {
  color: var(--muted);
}

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

.mini-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.mini-grid span,
.mini-grid strong {
  display: block;
}

.mini-grid strong {
  margin-top: 4px;
}

.action-stack {
  display: grid;
  margin-top: 0;
}

.action-stack button:first-child {
  border-color: #101317;
  background: #101317;
  color: #fff;
}

.recipe-box {
  border-left: 3px solid rgba(0, 166, 184, 0.55);
  padding-left: 14px;
}

.recipes {
  max-width: 1120px;
  margin: 0 auto;
  padding: 78px 22px 96px;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin-bottom: 12px;
  font-size: 2.1rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.recipe-grid article {
  padding: 24px;
}

.recipe-grid span {
  display: inline-flex;
  margin-bottom: 22px;
  color: #007c8b;
  font-weight: 800;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .readout {
    grid-column: 1 / -1;
    grid-template-columns: minmax(230px, 0.6fr) 1fr minmax(230px, 0.7fr);
  }

  .action-stack {
    align-content: center;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
  }

  .topnav {
    display: none;
  }

  .workspace,
  .readout,
  .recipe-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    width: 100vw;
    max-width: 100vw;
    padding: 14px;
  }

  .workspace > * {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-toggle {
    width: 100%;
  }

  .view-toggle button {
    flex: 1;
  }

  .caption-row {
    font-size: 0.82rem;
  }

  h1 {
    font-size: 2.05rem;
  }

  .section-heading h2 {
    font-size: 1.7rem;
  }

  .footer {
    flex-direction: column;
  }
}
