:root {
  color-scheme: light;
  --panel: rgba(255, 251, 244, 0.92);
  --panel-border: rgba(111, 78, 39, 0.14);
  --text: #231a12;
  --muted: #675342;
  --accent: #934d1b;
  --accent-deep: #72370f;
  --danger: #a1342d;
  --shadow: 0 22px 60px rgba(59, 37, 17, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 220, 170, 0.45), transparent 32%),
    radial-gradient(circle at 85% 8%, rgba(196, 123, 58, 0.18), transparent 20%),
    linear-gradient(180deg, #faf6ef 0%, #f3eadc 46%, #eee2d0 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.36), transparent 28%),
    repeating-linear-gradient(0deg, rgba(83, 51, 27, 0.02), rgba(83, 51, 27, 0.02) 1px, transparent 1px, transparent 16px);
  opacity: 0.65;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 12px;
}

.launcher-view,
.workspace {
  display: grid;
  gap: 14px;
}

.brand-card,
.panel,
.workspace-header {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand-card {
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(248, 235, 211, 0.96)),
    var(--panel);
}

.brand-card::after,
.panel::after,
.workspace-header::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(147, 77, 27, 0.09), transparent 70%);
  pointer-events: none;
}

.brand-card h1,
.panel-heading h2,
.workspace-header h2,
.stage-header h3,
.export-summary h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.03em;
}

.brand-card h1 {
  font-size: clamp(2.2rem, 7vw, 3.8rem);
}

.brand-copy,
.microcopy,
.header-summary,
.stage-header p,
.eyebrow,
.project-meta,
.action-card span:last-child {
  margin: 0;
}

.eyebrow,
.action-eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-copy,
.microcopy,
.header-summary,
.project-meta,
.stage-header p,
.action-card span:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.panel,
.workspace-header {
  padding: 16px;
}

.hero-card {
  min-height: 240px;
  align-content: end;
}

.panel-heading,
.workspace-header,
.workspace-headline,
.status-cluster,
.summary-badges,
.capture-actions,
.editor-actions,
.panel-toolbar,
.stack-actions {
  display: flex;
  gap: 12px;
}

.panel-heading,
.workspace-header {
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
}

.workspace-headline,
.status-cluster,
.capture-actions,
.editor-actions,
.panel-toolbar,
.stack-actions {
  flex-wrap: wrap;
  align-items: center;
}

.workspace-headline {
  flex-direction: column;
  align-items: flex-start;
}

.status-cluster {
  justify-content: flex-end;
}

.launcher-action-grid,
.metadata-form,
.adjustments-panel,
.export-grid {
  display: grid;
  gap: 14px;
}

.launcher-action-grid {
  grid-template-columns: 1fr;
}

.action-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 148px;
  width: 100%;
  padding: 18px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(123, 88, 49, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.action-card strong {
  font-size: 1.1rem;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-card {
  width: 100%;
  padding: 15px 16px;
  text-align: left;
  border: 1px solid rgba(123, 88, 49, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.project-card:hover {
  transform: translateY(-1px);
  border-color: rgba(147, 77, 27, 0.35);
}

.project-card.active {
  border-color: rgba(147, 77, 27, 0.52);
  box-shadow: inset 0 0 0 1px rgba(147, 77, 27, 0.24);
  background: rgba(255, 246, 232, 0.92);
}

.project-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}

.metadata-form label,
.adjustments-panel label,
.export-grid label {
  display: grid;
  gap: 8px;
}

.metadata-form span,
.adjustments-panel span,
.export-grid span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(123, 88, 49, 0.16);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
}

textarea {
  resize: vertical;
}

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

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.mini-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.primary-button {
  color: #fffaf5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 10px 28px rgba(114, 55, 15, 0.2);
}

.ghost-button,
.file-button,
.mini-button,
.tab-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(123, 88, 49, 0.14);
}

.danger-button {
  color: #fff8f6;
  background: linear-gradient(135deg, #c25342, var(--danger));
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.file-button:hover,
.mini-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.action-card.primary-button,
.action-card.file-button {
  display: grid;
  justify-items: start;
  justify-content: start;
  align-content: start;
  min-height: 148px;
  padding: 18px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button.large {
  min-width: 220px;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.workspace-tabs {
  position: sticky;
  top: 12px;
  z-index: 6;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-button {
  white-space: nowrap;
}

.tab-button.active {
  color: #fffaf5;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(114, 55, 15, 0.16);
}

.status-pill,
.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(123, 88, 49, 0.1);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

.status-pill.subtle,
.summary-badge.subtle {
  color: var(--muted);
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d8922f;
  box-shadow: 0 0 0 5px rgba(216, 146, 47, 0.16);
}

.status-ready .status-dot {
  background: #2f8b48;
  box-shadow: 0 0 0 5px rgba(47, 139, 72, 0.16);
}

.status-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(161, 52, 45, 0.16);
}

.panel-toolbar > *,
.capture-actions > *,
.editor-actions > *,
.stack-actions > * {
  width: 100%;
}

.stack-actions {
  align-items: stretch;
}

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

.page-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(123, 88, 49, 0.14);
  background: rgba(255, 255, 255, 0.78);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.page-card[draggable="true"] {
  cursor: grab;
}

.page-card.dragging {
  opacity: 0.45;
}

.page-card.selected {
  border-color: rgba(147, 77, 27, 0.52);
  box-shadow: inset 0 0 0 1px rgba(147, 77, 27, 0.24);
}

.page-card.drag-target {
  border-color: rgba(147, 77, 27, 0.82);
  box-shadow: 0 0 0 2px rgba(147, 77, 27, 0.16);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(243, 233, 215, 0.95), rgba(252, 249, 243, 0.92));
  border: 1px solid rgba(123, 88, 49, 0.1);
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-order {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(35, 26, 18, 0.82);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
}

.page-card label {
  display: grid;
  gap: 6px;
}

.page-card label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-button {
  min-height: 40px;
  padding: 10px 12px;
}

.page-empty,
.empty-editor {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed rgba(123, 88, 49, 0.22);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
  text-align: center;
  padding: 24px;
}

.editor-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

.editor-stage {
  display: grid;
  gap: 10px;
}

.editor-stage canvas {
  width: 100%;
  min-height: 260px;
  max-height: 70vh;
  touch-action: none;
  border-radius: 22px;
  border: 1px solid rgba(123, 88, 49, 0.18);
  background:
    linear-gradient(180deg, rgba(240, 229, 211, 0.92), rgba(249, 245, 238, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.adjustments-panel {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.export-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.export-summary {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(123, 88, 49, 0.1);
}

.back-button {
  align-self: flex-start;
}

.hidden {
  display: none !important;
}

[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

code {
  padding: 0.15rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(147, 77, 27, 0.08);
}

@media (min-width: 760px) {
  .app-shell {
    padding: 20px;
  }

  .panel,
  .workspace-header {
    padding: 20px;
  }

  .workspace-header {
    flex-direction: row;
    align-items: center;
  }

  .workspace-headline {
    flex-direction: row;
    align-items: center;
  }

  .launcher-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-toolbar > *,
  .capture-actions > *,
  .editor-actions > *,
  .stack-actions > * {
    width: auto;
  }

  .page-grid {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  }
}

@media (min-width: 1120px) {
  .app-shell {
    max-width: 1380px;
    margin: 0 auto;
  }

  .launcher-view {
    grid-template-columns: minmax(320px, 1.05fr) minmax(420px, 1fr);
    align-items: start;
  }

  .hero-card {
    min-height: 100%;
  }

  .library-panel {
    grid-column: 1 / -1;
  }

  .editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
