:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: rgba(16, 23, 42, 0.84);
  --panel: rgba(15, 23, 42, 0.9);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eefb;
  --muted: #94a3b8;
  --accent: #58d6c2;
  --accent-2: #f6b84b;
  --danger: #ff7b7b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(88, 214, 194, 0.18), transparent 35%),
    radial-gradient(circle at top right, rgba(246, 184, 75, 0.16), transparent 32%),
    linear-gradient(180deg, #09111f, #0b1020 45%, #050814);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  position: relative;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 100%);
}

.app-shell {
  width: min(1200px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4rem);
  max-width: 11.5ch;
}

.lede {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-card,
.card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(8, 13, 28, 0.92));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  border-radius: 28px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-card__label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.hero-card__value {
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 10px;
}

.hero-card__note {
  color: var(--muted);
  margin-top: 8px;
}

.panel,
.preview-layout {
  margin-top: 18px;
}

.toolbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-top: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar__chip {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(7, 12, 26, 0.7);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.toolbar__chip:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 214, 194, 0.5);
}

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

.card {
  border-radius: var(--radius);
  padding: 18px;
}

.card h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

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

input[type="file"],
input[type="number"],
input[type="range"],
select {
  width: 100%;
  font: inherit;
}

input[type="number"],
select {
  background: rgba(3, 7, 18, 0.55);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 12px 13px;
}

input[type="file"] {
  color: var(--muted);
}

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

.two-up,
.slider-grid,
.crop-grid {
  display: grid;
  gap: 12px;
}

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

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

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status {
  background: rgba(3, 7, 18, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.9rem;
}

.status--dim {
  color: var(--muted);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.preview-card {
  padding: 18px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.time-readout {
  background: rgba(3, 7, 18, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.canvas-frame {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 62%),
    linear-gradient(180deg, rgba(3, 7, 18, 0.84), rgba(3, 7, 18, 0.58));
  border-radius: 22px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050814;
  border-radius: 16px;
}

.button {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(7, 12, 26, 0.8);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 214, 194, 0.5);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  background: linear-gradient(135deg, rgba(88, 214, 194, 0.18), rgba(88, 214, 194, 0.08));
  border-color: rgba(88, 214, 194, 0.5);
}

.button--accent {
  background: linear-gradient(135deg, rgba(246, 184, 75, 0.18), rgba(246, 184, 75, 0.08));
  border-color: rgba(246, 184, 75, 0.5);
}

.progress-wrap {
  margin-top: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.progress-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(3, 7, 18, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s linear;
}

.message {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.message--error {
  color: var(--danger);
}

.download-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero,
  .grid {
    grid-template-columns: 1fr;
  }

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

  .preview-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 16px, 1200px);
    padding-top: 12px;
  }

  .card,
  .hero-card {
    border-radius: 20px;
    padding: 16px;
  }

  .toolbar {
    padding: 12px;
  }

  .two-up,
  .crop-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .toolbar__group--actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar__chip {
    width: 100%;
  }
}
