:root {
  color-scheme: light;
  --ink: #172744;
  --deep: #0c1930;
  --maroon: #7c2539;
  --maroon-dark: #591927;
  --muted: #5d626c;
  --surface: #fff;
  --paper: #f8f6f3;
  --line: #e3ddd8;
  --focus: #315d8b;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); min-width: 300px; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .55; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px max(24px, calc((100vw - 1140px) / 2)); border-top: 4px solid var(--maroon); border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { object-fit: contain; }
.brand p { margin: 0; font-weight: 750; line-height: 1.2; }
.brand p span { display: block; color: var(--muted); font-size: .875rem; font-weight: 550; }
.masthead-label { color: var(--maroon); font-size: .875rem; font-weight: 720; }
main { width: min(1140px, calc(100% - 48px)); margin: 0 auto; }
.intro { padding: clamp(22px, 4vw, 45px) 0 24px; }
.intro h1 { margin: 0 0 6px; font: 700 clamp(2.2rem, 5vw, 3.75rem) / 1.04 Georgia, serif; letter-spacing: -.045em; }
.intro p { margin: 0; color: var(--muted); line-height: 1.5; }
.studio { display: grid; grid-template-columns: minmax(290px, .86fr) minmax(0, 1.14fr); gap: 24px; align-items: start; }
.preview { position: sticky; top: 16px; }
.portrait-frame { position: relative; overflow: hidden; border: 1px solid #ddd6d0; border-radius: 14px; background: #ede8e5; }
#portrait { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; }
.loading { position: absolute; inset: 45% 12px auto; text-align: center; color: var(--muted); }
.preview-tools { display: grid; grid-template-columns: 1fr 1.18fr; gap: 10px; margin-top: 12px; }
.reference-button { display: block; margin: 12px auto 0; }
.button { min-height: 46px; border-radius: 8px; padding: 9px 14px; border: 1px solid transparent; font-weight: 750; }
.primary { background: var(--maroon); color: #fff; }
.primary:hover:not(:disabled) { background: var(--maroon-dark); }
.secondary { background: #fff; border-color: #d7c9cc; }
.secondary:hover:not(:disabled) { background: #f6efee; }
.editor, .comparison { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.tablist { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 5px 8px 0; border-bottom: 1px solid var(--line); gap: 3px; }
.tablist button { padding: 13px 4px; background: transparent; border: 0; border-bottom: 3px solid transparent; font-size: .94rem; font-weight: 700; }
.tablist button[aria-selected="true"] { color: var(--maroon); border-bottom-color: var(--maroon); background: #fcf7f7; }
#options { padding: 22px; min-height: 245px; }
.field + .field { margin-top: 23px; }
.field h2, .starter-section h2 { font-size: 1rem; margin: 0 0 9px; line-height: 1.3; }
.field-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.choice-grid, .starter-grid { display: grid; grid-template-columns: repeat(var(--columns, 3),minmax(0,1fr)); gap: 8px; }
.choice, .starter { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf9; padding: 7px 6px; min-height: 42px; font-size: .88rem; font-weight: 650; text-align: center; line-height: 1.22; }
.choice:hover, .starter:hover { border-color: #a77d86; }
.choice[aria-pressed="true"], .starter[aria-pressed="true"] { border: 1px solid var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); background: #fbf0f1; color: var(--maroon-dark); }
.swatch { width: 25px; height: 25px; background: var(--swatch); border: 1px solid #0003; border-radius: 50%; }
.extra-colour { margin-top: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaf8; }
.extra-colour summary { cursor: pointer; min-height: 44px; padding: 11px 2px; font-weight: 700; color: var(--maroon-dark); }
.current-colour { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 10px; color: var(--ink); font: .875rem ui-monospace, monospace; }
.current-colour::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0004; background: var(--sample); }
.palette-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 1px 0 12px; }
.palette-choice { display: grid; justify-items: center; align-content: start; gap: 4px; border: 1px solid transparent; border-radius: 7px; background: none; min-height: 57px; padding: 4px 2px; font-size: .875rem; line-height: 1.15; overflow-wrap: anywhere; }
.palette-choice:hover, .palette-choice[aria-pressed="true"] { border-color: var(--maroon); background: #f9ebee; }
.palette-choice[aria-pressed="true"] .swatch { outline: 2px solid var(--maroon); outline-offset: 2px; }
.custom-colour { display: grid; grid-template-columns: auto minmax(0, 9rem) auto; justify-content: start; align-items: end; column-gap: 8px; padding: 10px 0 12px; border-top: 1px solid var(--line); }
.custom-colour label { display: grid; gap: 5px; font-size: .875rem; font-weight: 650; }
.custom-colour input { height: 44px; min-width: 0; border: 1px solid #baadb0; border-radius: 7px; background: white; color: var(--ink); }
.custom-colour input[type="color"] { cursor: pointer; width: 55px; padding: 4px; }
.custom-colour input[type="text"] { width: 100%; padding-inline: 7px; font: 1rem ui-monospace, monospace; }
.custom-colour input[aria-invalid="true"] { border-color: var(--maroon); }
.custom-colour .button { min-height: 44px; padding: 7px 10px; }
.colour-error { grid-column: 1 / -1; font-size: .875rem; color: var(--maroon-dark); padding-top: 6px; }
.colour-error:empty { display: none; }
.choice canvas, .starter canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 7; border-radius: 5px; background: #f2edeb; }
.choice[data-field="eyeShape"] canvas { aspect-ratio: 2 / 1; }
.context-icon { display: block; width: min(var(--silhouette), 100%); height: 24px; background: #a77983; margin-top: 3px; border-radius: 58% 58% 3px 3px; }
.link-button { border: none; background: none; color: var(--maroon); text-underline-offset: 3px; text-decoration: underline; padding: 0 0 9px; font-size: .875rem; font-weight: 700; }
.starter-section { border-top: 1px solid var(--line); padding: 17px 22px 22px; }
.starter-grid { --columns: 4; }
.starter { align-self: stretch; justify-content: start; }
.comparison { margin: 24px 0 0; padding: 20px; }
.comparison-heading { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.comparison h2, .comparison p { margin: 0; }
.comparison h2 { font: 700 1.5rem Georgia, serif; }
.comparison p { margin-top: 5px; color: var(--muted); }
.comparison-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.reference-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.comparison-grid figure { margin: 0; text-align: center; }
.comparison-grid canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; display: block; }
.comparison-grid figcaption { padding-top: 6px; font-size: .875rem; font-weight: 750; }
.notice { color: var(--maroon-dark); margin: 12px 0 0; }
.notice:empty { display: none; }
footer { color: var(--muted); text-align: center; padding: 26px 16px; font-size: .875rem; }
@media (max-width: 690px) {
  main { width: min(570px, calc(100% - 30px)); }
  .studio { grid-template-columns: 1fr; gap: 18px; }
  .preview { position: static; }
  .portrait-frame { max-width: 410px; margin-inline: auto; }
  .preview-tools { max-width: 410px; margin-inline: auto; }
}
@media (max-width: 405px) {
  .masthead { padding-inline: 14px; }
  .masthead-label { display: none; }
  .tablist button { font-size: .84rem; }
  #options, .starter-section { padding-inline: 13px; }
  .choice-grid.many, .starter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .palette-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .comparison { padding: 12px; }
  .comparison-grid { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
