:root {
  color-scheme: dark;
  --navy: #0e1a2e;
  --panel: #13233d;
  --line: #25395c;
  --gold: #e8c96a;
  --muted: #9fb0c8;
  font-family: 'Barlow Condensed', Arial, sans-serif;
  color: #f6f4ef;
  background: var(--navy);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 28px 20px 50px;
}
main {
  max-width: 1240px;
  margin: auto;
}
header {
  margin-bottom: 28px;
}
a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
a:hover {
  color: var(--gold);
}
.eyebrow,
legend,
.preview-label {
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 2px;
  font-weight: 700;
}
.eyebrow {
  color: var(--gold);
  margin: 26px 0 8px;
  text-transform: uppercase;
}
h1 {
  font:
    900 clamp(48px, 7vw, 76px)/0.95 'Barlow Condensed',
    sans-serif;
  text-transform: uppercase;
  margin: 0;
}
h1 span {
  color: var(--gold);
}
header > p:last-child {
  color: var(--muted);
}
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  align-items: start;
}
.preview {
  position: sticky;
  top: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.preview-label {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}
.stage {
  height: 440px;
  background: #091323;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 12px 40px #0005;
}
.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  flex-wrap: wrap;
}
.transport input {
  flex: 1;
  min-width: 60px;
}
.transport output {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  padding: 0 16px 12px;
}
fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 18px 0;
  margin: 0;
}
legend {
  color: var(--gold);
  text-transform: uppercase;
  font-size: 14px;
  padding-right: 12px;
}
label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 7px;
}
input,
textarea,
select,
button {
  font: inherit;
}
textarea,
input:not([type='range']),
select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  padding: 10px;
  margin-bottom: 15px;
}
textarea {
  resize: vertical;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--gold);
  margin-bottom: 12px;
}
input[type='color'] {
  height: 42px;
  padding: 4px;
}
button {
  background: #1b3050;
  color: #f6f4ef;
  border: 1px solid #365071;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}
button:hover {
  border-color: var(--gold);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f6f4ef;
  margin-bottom: 16px;
}
.check input[type='checkbox'] {
  width: auto;
  margin: 0;
  accent-color: var(--gold);
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.exports {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
@media (max-width: 850px) {
  .studio {
    grid-template-columns: 1fr;
  }
  .preview {
    position: static;
  }
  .stage {
    height: 360px;
  }
  form {
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

canvas.transparent {
  background-color: #d0d4da;
  background-image: conic-gradient(
    #aab0ba 25%,
    transparent 0 50%,
    #aab0ba 0 75%,
    transparent 0
  );
  background-size: 24px 24px;
}
[hidden] {
  display: none !important;
}

/* UI consistency pilot (HANDOFF "General UI consistency"): interface labels use a
   regular sans; Barlow Condensed stays on headings and the exported artwork.
   Canvas fonts are untouched. */
:root {
  --ui: 'Helvetica Neue', Arial, 'Segoe UI', system-ui, sans-serif;
}
.transport button,
label,
.hint,
#status,
.transport output,
.preview-label,
button,
select,
textarea,
input:not([type='range']):not([type='color']) {
  font-family: var(--ui);
}
label {
  font-size: 13px;
  line-height: 1.35;
}
.hint {
  font-size: 13px;
}
/* Interface controls stay at least 44px tall for touch. */
@media (max-width: 650px), (pointer: coarse) {
  button,
  select,
  textarea,
  input:not([type='range']):not([type='checkbox']):not([type='color']) {
    min-height: 44px;
  }
  input[type='range'] {
    min-height: 36px;
  }
}
/* Phone: keep the preview compact so the first text field sits on the first screen. */
@media (max-width: 850px) {
  body {
    padding: 16px 12px 40px;
  }
  header {
    margin-bottom: 14px;
  }
  .eyebrow {
    margin: 14px 0 6px;
  }
  .preview-label {
    padding: 10px 12px;
  }
  main .studio .preview .stage {
    height: clamp(180px, 36svh, 300px);
    padding: 10px;
  }
  .transport {
    padding: 10px 12px;
  }
  .hint {
    padding: 0 12px 10px;
  }
  .studio {
    display: flex;
    flex-direction: column;
  }
  /* Content first, then the rest; the saved-projects panel moves to the end. */
}
/* Editing fields lead at every width; export and the saved-project panels follow. */
#controls {
  display: flex;
  flex-direction: column;
}
#controls > fieldset {
  order: 1;
}
#controls > .exports {
  order: 2;
}
#controls > #status {
  order: 3;
}
#controls > .tim-projects {
  order: 4;
}

.transport button {
  font-size: 14px;
  min-width: 84px;
}

/* Keep a focused field clear of the software keyboard on phones. */
#controls input:focus,
#controls select:focus,
#controls textarea:focus {
  scroll-margin-bottom: 140px;
}
