@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --ink: #1f1c1a;
  --muted: #5c564f;
  --paper: #f7f2ea;
  --cream: #efe5d5;
  --accent: #1f7a6a;
  --accent-dark: #145647;
  --glow: rgba(31, 122, 106, 0.2);
  --card: rgba(255, 255, 255, 0.78);
  --border: rgba(31, 28, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, #ffe9c4 0%, transparent 55%),
    radial-gradient(circle at 85% 10%, #d8f2e7 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, #c9d7ff 0%, transparent 45%),
    linear-gradient(120deg, #f7f2ea 0%, #f1e4d2 50%, #f6efe5 100%);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: var(--ink);
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 8px;
}

.title-block h2 {
  color:#333333;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2.3rem, 3vw, 3.3rem);
  margin: 0 0 8px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.status-block {
  display: flex;
  align-items: center;
}

.status-pill {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(31, 28, 26, 0.08);
}

.status-pill.ready {
  background: rgba(31, 122, 106, 0.12);
  border-color: rgba(31, 122, 106, 0.4);
  color: var(--accent-dark);
}

.card {
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow:
    0 20px 40px rgba(31, 28, 26, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: rise 0.6s ease-out both;
}

.io-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.io-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.download-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.download-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.download-field label {
  font-weight: 600;
  color: var(--ink);
}

.download-field input[type="range"] {
  width: 140px;
}

.download-quality-value {
  min-width: 3ch;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.is-hidden {
  display: none;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px var(--glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px var(--glow);
}

.file-button input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: #f0e7d6;
  color: var(--ink);
}

button.secondary:hover {
  background: #e6dcc8;
}

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

.canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canvas-wrap h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

canvas {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  border: 1px dashed rgba(31, 28, 26, 0.2);
  min-height: 260px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 20px;
}

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

.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.adder {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.adder select {
  flex: 1 1 auto;
  min-width: 0;
}

#add-step {
  white-space: nowrap;
  flex-shrink: 0;
}

select {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
}

.pipeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pipeline-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.pipeline-item.selected {
  border-color: var(--accent);
  background: rgba(31, 122, 106, 0.08);
}

.pipeline-title {
  font-weight: 600;
}

.pipeline-controls {
  display: flex;
  gap: 6px;
}

.pipeline-controls button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.pipeline-empty {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
}

.params-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.param-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-row label {
  font-weight: 600;
}

.param-row input[type="range"],
.param-row input[type="number"],
.param-row select {
  width: 100%;
}

.param-value {
  font-size: 0.9rem;
  color: var(--muted);
}

.param-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.app-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-bottom a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.app-bottom a:hover {
  text-decoration: underline;
}

.content-links {
  font-size: 0.85rem;
  color: var(--muted);
}

#hidden-image,
#camera-video,
#camera-canvas {
  display: none;
}

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

@media (max-width: 960px) {

  .card {
    padding: 10px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .section-header {
    gap: 0;
  }

  .section-header h2 {
    font-size: 1.0rem;
  }

  .adder {
    gap: 0;
  }

  select {
    padding: 0;
    font-weight: 200;
  }

  .pipeline-title {
    font-weight: 200;
  }

  .param-row label {
    font-weight: 200;
  }

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