:root {
  color-scheme: light;
  --paper: #f9f7f1;
  --ink: #211f28;
  --muted: #5d5965;
  --line: #dcd7d1;
  --surface: #fffdfa;
  --lab: #eae6fa;
  --lab-line: #cfc6e5;
  --accent: #5d3e9c;
  --action: #262137;
  --action-text: #fffaf5;
  --wheel-back: #f4f1eb;
  font: 16px/1.55 "Segoe UI", sans-serif;
}

:root[data-appearance="dark"] {
  color-scheme: dark;
  --paper: #211e29;
  --ink: #fbf5ed;
  --muted: #c3bccc;
  --line: #51485a;
  --surface: #2c2735;
  --lab: #3a3050;
  --lab-line: #65567f;
  --accent: #d4bcff;
  --action: #e4d4ff;
  --action-text: #261d37;
  --wheel-back: #26212f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .shell { width: min(100% - 72px, 1160px); margin-inline: auto; }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 72px; gap: 28px; }
.brand { display: inline-flex; align-items: center; width: max-content; font-size: 1.48rem; font-weight: 750; letter-spacing: -.075em; }
.brand-mark { width: 23px; aspect-ratio: 1; margin-right: 10px; border-radius: 50%; background: conic-gradient(#f66d7f, #fdb74d, #f9d45e, #a8c977, #78b9c5, #7669d0, #d18bf2, #f66d7f); }
.brand-dot { color: var(--accent); }
nav { display: flex; gap: 30px; color: var(--muted); font-size: .86rem; font-weight: 600; }
nav a:hover, footer a:hover { color: var(--accent); text-decoration: underline; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 43px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .86rem; font-weight: 700; }
.button:hover { border-color: var(--accent); }
.account-button { justify-self: end; }
.primary { background: var(--action); border-color: var(--action); color: var(--action-text); }
.primary:hover { opacity: .88; }
.intro { display: grid; align-items: end; grid-template-columns: 1fr minmax(230px, 300px); gap: 28px; padding: 54px 0 36px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font: 700 .72rem/1.3 "Cascadia Code", Consolas, monospace; letter-spacing: .105em; text-transform: uppercase; }
.signal { width: 8px; height: 8px; border-radius: 50%; background: #ea7187; }
h1, .notes-heading h2, dialog h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.075em; }
h1 { margin-top: 9px; font-size: clamp(4.4rem, 8vw, 7.2rem); line-height: .96; }
h1 em { color: var(--accent); font-weight: inherit; }
.intro-copy { max-width: 285px; padding-bottom: 4px; color: var(--muted); font-size: 1.04rem; }
.studio { display: grid; grid-template-columns: 1.08fr 1fr; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.wheel-panel, .palette-panel { min-width: 0; padding: 25px 29px; }
.wheel-panel { background: var(--surface); }
.palette-panel { display: flex; flex-direction: column; background: var(--lab); border-left: 1px solid var(--lab-line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 34px; }
.panel-head h2 { font-size: 1.35rem; line-height: 1.15; letter-spacing: -.045em; }
.wheel-hint { font-size: .78rem; color: var(--muted); }
.wheel-hint span { color: var(--accent); padding-left: 3px; }
.wheel-stage { display: grid; place-items: center; min-height: 338px; margin: 18px 0 16px; border-radius: 12px; background: radial-gradient(circle, var(--line) .9px, transparent 1px) 0 0 / 17px 17px, var(--wheel-back); }
.wheel-frame { width: min(100% - 28px, 323px); aspect-ratio: 1; }
#wheel { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.wheel-controls { display: grid; align-items: center; grid-template-columns: auto 1fr 3.2rem; gap: 16px; }
.wheel-controls label, .harmony legend { font-size: .84rem; font-weight: 650; }
#hue { width: 100%; margin: 0; accent-color: var(--accent); }
#hue-value { font: 650 .82rem/1 Consolas, monospace; text-align: right; }
.appearance { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--lab-line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 1.22rem; line-height: 1; }
.appearance:hover { background: var(--surface); }
.harmony { padding: 0; margin: 22px 0 20px; border: 0; min-width: 0; }
.harmony legend { padding: 0; margin-bottom: 8px; }
.harmony-options { display: flex; gap: 6px; flex-wrap: wrap; }
.harmony-options label { cursor: pointer; }
.harmony-options input { position: absolute; opacity: 0; pointer-events: none; }
.harmony-options span { display: block; padding: 6px 9px; border: 1px solid var(--lab-line); border-radius: 6px; color: var(--ink); font-size: .75rem; line-height: 1.4; }
.harmony-options input:checked + span { background: var(--action); color: var(--action-text); border-color: var(--action); }
.harmony-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-radius: 10px; overflow: hidden; }
.swatch { display: grid; grid-template-rows: 124px auto; min-width: 0; padding: 0; overflow: hidden; border: 0; color: var(--ink); background: var(--surface); }
.swatch:focus-visible { outline-offset: -4px; }
.swatch:hover .swatch-color { filter: brightness(1.1); }
.swatch-color { display: block; width: 100%; height: 100%; }
.swatch-hex { padding: 7px 0; border-right: 1px solid var(--line); font: 600 clamp(.57rem, 1vw, .77rem)/1.45 Consolas, monospace; }
.swatch:last-child .swatch-hex { border-right: 0; }
.explanation { min-height: 61px; margin: 16px 0; font-size: .86rem; color: var(--muted); }
.explanation strong { color: var(--ink); }
.save-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding-top: 13px; margin-top: auto; border-top: 1px solid var(--lab-line); }
.save-row .button { flex-shrink: 0; }
.status { color: var(--muted); font-size: .77rem; }
.notes { padding-top: 64px; scroll-margin-top: 30px; }
.notes-heading { margin-bottom: 20px; }
.notes-heading h2 { margin-top: 5px; font-size: clamp(2.65rem, 6vw, 4rem); line-height: 1.05; }
.note-grid { display: grid; gap: 15px; grid-template-columns: repeat(3, 1fr); }
.note { display: flex; flex-direction: column; min-width: 0; gap: 7px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.note h3 { letter-spacing: -.035em; font-size: 1.18rem; }
.note p { color: var(--muted); font-size: .87rem; }
.note button { align-self: start; margin-top: auto; padding: 8px 0 0; border: 0; background: transparent; color: var(--accent); text-align: left; font-size: .8rem; font-weight: 700; }
.note button:hover { text-decoration: underline; }
.lesson-graphic { width: 78px; height: 27px; margin-bottom: 6px; border-radius: 3px; }
.hue-graphic { background: linear-gradient(90deg,#eb647e 25%,#f2ae64 25% 50%,#b0c876 50% 75%,#7b75cc 75%); }
.harmony-graphic { background: radial-gradient(circle at 35% 50%,#cb77b8 0 13px,transparent 14px),radial-gradient(circle at 62% 50%,#fa9a8d 0 13px,transparent 14px); }
.lightness-graphic { background: linear-gradient(90deg,#392b65 20%,#765baa 20% 40%,#a38bd1 40% 60%,#c6b6e8 60% 80%,#e3daf5 80%); }
footer { display: flex; justify-content: space-between; margin-top: 37px; padding: 18px 0 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: .81rem; }
dialog { position: fixed; width: min(100% - 36px, 410px); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #16102280; }
dialog .dialog-close { position: absolute; right: 16px; top: 16px; }
dialog h2 { margin: 9px 0; font-size: 2.7rem; line-height: 1; }
dialog p:not(.eyebrow) { color: var(--muted); font-size: .93rem; }
.dialog-actions { display: grid; gap: 8px; margin-top: 18px; }
.dialog-status:not(:empty) { margin-top: 12px; }

@media (max-width: 940px) {
  .wheel-panel, .palette-panel { padding: 20px; }
  .header-inner, .shell { width: calc(100% - 44px); }
}
@media (max-width: 740px) {
  .header-inner, .shell { width: calc(100% - 30px); }
  .header-inner { grid-template-columns: 1fr auto; min-height: 63px; }
  nav { display: none; }
  .intro { grid-template-columns: 1fr; padding: 40px 0 25px; gap: 15px; }
  .intro-copy { max-width: 370px; }
  .studio { grid-template-columns: 1fr; }
  .palette-panel { border-left: 0; border-top: 1px solid var(--lab-line); }
  .wheel-stage { min-height: 282px; }
  .wheel-frame { max-width: 284px; }
  .swatch { grid-template-rows: 104px auto; }
  .swatch-hex { font-size: .7rem; }
  .notes { padding-top: 46px; }
  .note-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .wheel-panel, .palette-panel { padding: 15px; }
  h1 { font-size: 3.85rem; }
  .save-row { flex-wrap: wrap; }
  .wheel-controls { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
