/* Colors and control geometry follow Magic Hour's shared dark UI tokens. */
:root {
  color-scheme: dark;
  --background: hsl(234.55 31.43% 6.86%);
  --foreground: #fff;
  --card: hsl(235.71 25.93% 10.59%);
  --muted: hsl(235.71 21.21% 12.94%);
  --muted-foreground: hsl(235 11.11% 57.65%);
  --primary: hsl(259.29 100% 50%);
  --secondary: hsl(252.73 37.93% 17.06%);
  --secondary-foreground: hsl(248.16 100% 75.49%);
  --border: hsl(232.17 22.77% 19.8%);
  --input: hsl(236 19% 15%);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 16px/1.5 sans-serif;
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: hsl(259.29 100% 57%);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.secondary:hover {
  background: hsl(252.73 37.93% 23%);
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  max-width: 1440px;
  margin: auto;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}
.brand svg {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
}
.brand span {
  margin-left: 12px;
  padding-left: 20px;
  border-left: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 400;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 14px;
}
nav a {
  color: #c7c8d2;
  text-decoration: none;
}
nav a:hover {
  color: #fff;
}
nav a[aria-current="page"] {
  color: var(--secondary-foreground);
}
main {
  max-width: 1248px;
  margin: auto;
  padding: 40px 24px 24px;
}
.eyebrow {
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 400;
  margin: 0 0 36px;
}
h1 {
  margin: 0 auto 16px;
  text-align: center;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -1px;
}
h1 em {
  color: inherit;
  font-style: normal;
}
h2 {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.35px;
}
h3 {
  font-size: 16px;
}
.intro {
  max-width: 800px;
  margin: 0 auto 20px;
  color: var(--muted-foreground);
  text-align: center;
  font-size: 18px;
}
.tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 28px;
}
.tags span {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #bfc0cd;
  font-size: 12px;
}
.workbench {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}
.controls {
  padding: 24px;
  border-right: 1px solid var(--border);
}
.controls h2 {
  margin: 0 0 24px;
  font-size: 18px;
}
.field {
  display: block;
  margin: 16px 0;
  color: #c7c8d2;
  font-size: 13px;
}
.field input,
.field select {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input);
  color: #fff;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.controls button {
  width: 100%;
  margin-top: 12px;
}
.hint {
  color: var(--muted-foreground);
  font-size: 12px;
}
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  background: var(--background);
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted-foreground);
  font-size: 12px;
}
.light {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--secondary-foreground);
}
#preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  flex: 1;
}
#preview > canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 500px;
  border-radius: 8px;
  object-fit: contain;
}
#status {
  min-height: 24px;
  margin-bottom: 0;
  color: var(--muted-foreground);
  font-size: 13px;
}
.error {
  color: #ff8b8b !important;
}
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.results figure {
  margin: 0;
  min-width: 0;
}
.results canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.results a {
  display: block;
  padding: 8px 0;
  font-size: 13px;
  color: var(--secondary-foreground);
}
.image-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}
.image-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.image-row input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: #fff;
  font-size: 12px;
}
.image-row button {
  width: auto;
  min-width: 32px;
  min-height: 36px;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: #fff;
  font-size: 14px;
}
input[type="checkbox"] {
  accent-color: var(--primary);
}
.next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 40px 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.next h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.next p {
  max-width: 660px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 14px;
}
.next .button {
  flex-shrink: 0;
}
.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 48px 0;
}
.notes h2 {
  font-size: 22px;
}
.notes p {
  color: var(--muted-foreground);
  font-size: 14px;
}
.notes a {
  font-size: 14px;
  color: var(--secondary-foreground);
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  max-width: 1200px;
  margin: auto;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 12px;
}
.toolcards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 40px 0;
}
.toolcard {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  text-decoration: none;
}
.toolcard:hover {
  border-color: var(--secondary-foreground);
}
.toolcard h2 {
  margin: 0 0 12px;
  font-size: 24px;
}
.toolcard p {
  color: var(--muted-foreground);
  font-size: 14px;
}
.toolcard .eyebrow {
  margin-bottom: 12px;
  font-size: 12px;
}
.toolcard strong {
  color: var(--secondary-foreground);
  font-size: 14px;
  font-weight: 500;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 250px;
  height: 130px;
  margin-bottom: 24px;
}
.mini-grid i {
  border-radius: 5px;
  background: var(--secondary);
}
.mini-grid i:nth-child(2n) {
  background: #493178;
}
.mini-grid i:nth-child(3n) {
  background: #71608c;
}
.mini-grid.reference {
  gap: 12px;
}
.mini-grid.reference i {
  border: 10px solid var(--muted);
  border-radius: 50px 50px 5px 5px;
}
code {
  overflow-wrap: anywhere;
  font-size: 13px;
}
.file-picker {
  width: 100%;
  color: var(--muted-foreground);
  font-size: 12px;
}
input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.sample-label {
  margin-top: 16px;
  color: var(--muted-foreground);
  font-size: 12px;
}
@media (max-width: 740px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
  }
  .brand span {
    font-size: 12px;
    padding-left: 12px;
    margin-left: 4px;
  }
  nav {
    gap: 20px;
    font-size: 13px;
  }
  main {
    padding: 28px 20px 12px;
  }
  .eyebrow {
    margin-bottom: 28px;
    font-size: 12px;
  }
  h1 {
    font-size: 32px;
    letter-spacing: -0.6px;
  }
  .intro {
    font-size: 16px;
  }
  .workbench {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }
  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 20px;
  }
  .stage {
    padding: 18px;
  }
  .stage-head {
    font-size: 11px;
  }
  #preview {
    min-height: 180px;
  }
  .next {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }
  .notes,
  .toolcards {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .notes {
    margin: 28px 0;
  }
  .toolcard {
    padding: 24px;
  }
  footer {
    flex-direction: column;
    gap: 10px;
    margin: 0 20px;
    padding: 20px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
