:root {
  color-scheme: light;
  --ink: #252c3a;
  --muted: #515f70;
  --paper: #f9f6ef;
  --white: #fff;
  --blue: #3979b9;
  --blue-dark: #235989;
  --purple: #7456a4;
  --purple-dark: #59417f;
  --orange: #d77c38;
  --green: #356e51;
  --line: #d9dce1;
  --soft: #f0edf5;
  --supporting-text-size: 14px;
  --shadow: 0 12px 30px rgb(33 43 61 / 8%);
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.55; }
body[data-theme="sky"] { background: #eaf3fb; }
body[data-theme="lavender"] { background: #f0eaf7; }
body[data-theme="mint"] { background: #e9f5ee; }
body[data-theme="peach"] { background: #fff0e6; }
body[data-theme="night"] { background: #e9edf7; }
a { color: var(--blue-dark); text-underline-offset: .2em; }
button, select, input { font: inherit; }
button, .button { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .7rem 1rem; border: 2px solid var(--purple-dark); border-radius: 14px; background: var(--purple-dark); color: var(--white); font-weight: 800; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: #463364; }
button.secondary, .button.secondary { background: var(--white); color: var(--purple-dark); }
button.warn { border-color: #883d36; background: #883d36; }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-disabled="true"] { opacity: .72; cursor: progress; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 4px solid #d48726; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 30; top: 12px; left: 12px; transform: translateY(-150%); padding: .7rem 1rem; border-radius: 12px; background: white; }
.skip-link:focus { transform: translateY(0); }
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem max(16px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 900; text-decoration: none; line-height: 1.15; white-space: nowrap; }
.brand small { display: block; margin-top: .2rem; color: var(--muted); font-size: var(--supporting-text-size); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: white; background: var(--purple); font-size: 1.65rem; }
.site-header nav, .site-footer nav { display: flex; gap: .3rem; align-items: center; }
.site-header nav a { display: inline-flex; min-height: 44px; align-items: center; padding: .45rem .65rem; border-radius: 12px; color: var(--ink); font-weight: 750; text-decoration: none; white-space: nowrap; }
.site-header nav a:hover { background: #f0edf5; }
main { min-height: calc(100vh - 160px); }
#app { width: min(1240px, 100%); margin: 0 auto; padding: 1rem 16px 3rem; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem max(16px, calc((100vw - 1240px) / 2)); background: #f0edf5; color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; padding: .4rem .6rem; }
.review-banner { margin: .35rem 0 .7rem; padding: .8rem 1rem; border: 1px solid #e5cf9f; border-left: 6px solid #be8934; border-radius: 14px; background: #fff7e7; color: #5b451f; }
.storage-banner { margin: .5rem 0; padding: .65rem .9rem; border-radius: 12px; background: #edf3fc; color: #304d73; }
.eyebrow { margin: 0; color: var(--purple-dark); font-size: var(--supporting-text-size); font-weight: 900; letter-spacing: .07em; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin: .35rem 0 .75rem; }
.page-title { margin: .1rem 0 0; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.2; letter-spacing: -.03em; }
.execution-status { min-height: 3rem; margin: .55rem 0 .8rem; padding: .65rem .85rem; border-radius: 12px; background: #f0edf5; color: #463364; }
.execution-status[data-kind="error"] { background: #fff0e9; color: #78371f; }
.execution-status[data-kind="success"] { background: #eaf5ed; color: #2b6243; }
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(190px, .8fr); gap: 1rem; align-items: center; padding: clamp(1.2rem, 4vw, 2.7rem); border: 1px solid #ddd7e8; border-radius: 26px; background: linear-gradient(125deg, #f0edf8 0%, #eff4fa 64%, #fff1e1 100%); }
.hero h1, .hero h2 { max-width: 18ch; margin: .5rem 0 .7rem; font-size: clamp(1.9rem, 4.7vw, 3.7rem); line-height: 1.08; letter-spacing: -.035em; }
.hero p { max-width: 58ch; color: #405166; font-size: 1.05rem; }
.hero-visual { display: grid; min-height: 200px; place-items: center; }
.hero-visual span { display: grid; width: 178px; aspect-ratio: 1; place-items: center; border: 9px solid #ddd5eb; border-radius: 42px; background: white; color: var(--purple); box-shadow: var(--shadow); font-size: 5rem; transform: rotate(3deg); }
.panel { margin: .9rem 0; padding: clamp(1rem, 2.5vw, 1.35rem); border: 1px solid var(--line); border-radius: 19px; background: white; box-shadow: 0 5px 18px rgb(25 45 75 / 4%); }
.panel h2, .panel h3 { margin-top: 0; }
.panel p:last-child, .panel ul:last-child { margin-bottom: 0; }
.panel h2 { font-size: clamp(1.2rem, 2.7vw, 1.55rem); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin: 1.4rem 0 .7rem; }
.section-heading h2 { margin: .2rem 0; font-size: clamp(1.25rem, 3vw, 1.85rem); }
.section-heading p { margin: .2rem 0; color: var(--muted); }
.guide-list { display: grid; gap: .5rem; padding-left: 1.25rem; }
.studio-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.studio-card { display: flex; min-height: 178px; flex-direction: column; gap: .45rem; padding: 1rem; border: 1px solid #d9dce2; border-radius: 18px; background: white; color: var(--ink); text-decoration: none; box-shadow: 0 4px 12px rgb(35 47 65 / 4%); }
.studio-card:hover { border-color: var(--purple); box-shadow: var(--shadow); }
.studio-card strong { font-size: 1.15rem; }
.studio-card > span:last-child { color: var(--muted); }
.studio-icon { color: var(--purple); font-size: 2.1rem; font-weight: 900; }
.choice-chip, .rhythm-choice { min-height: 48px; border-color: #b9adcb; background: white; color: var(--ink); }
.choice-chip[aria-pressed="true"] { border-color: var(--purple-dark); outline: 3px solid #e0d6ee; background: #f7f4fb; }
.choice-chip[aria-pressed="true"]:focus-visible, .rhythm-choice[aria-pressed="true"]:focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 3px; }
.theme-options, .bar-options, .map-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.instrument-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.instrument-stage { position: relative; }
.instrument-controls { position: sticky; bottom: env(safe-area-inset-bottom, 0px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin: .7rem 0; padding: .65rem; border: 1px solid var(--line); border-radius: 16px; background: rgb(255 255 255 / 97%); box-shadow: var(--shadow); }
.instrument-controls button, .instrument-controls .button { min-height: 56px; }
.instrument-grid { padding-bottom: 5rem; }
.instrument-card button { scroll-margin-block-end: 6rem; }
.instrument-card { display: flex; min-height: 192px; flex-direction: column; align-items: start; padding: .9rem; border: 1px solid var(--line); border-radius: 17px; background: white; }
.instrument-card h2 { margin: .2rem 0; font-size: 1.1rem; }
.instrument-card p:not(.eyebrow) { margin: .25rem 0 auto; color: var(--muted); font-size: .9rem; }
.instrument-card button { width: 100%; margin-top: .7rem; }
.pill { display: inline-flex; align-items: center; padding: .18rem .55rem; border-radius: 999px; background: #f0edf5; color: #493a64; font-size: .78rem; font-weight: 850; white-space: nowrap; }
.pill.music { background: #e8f0f8; color: #285780; }
.rhythm-levels { display: grid; gap: .75rem; margin-top: 1rem; }
.rhythm-level { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #fcfbfd; }
.rhythm-level-heading { margin-bottom: .75rem; }
.rhythm-level-heading h3 { margin: .15rem 0 .25rem; font-size: 1.15rem; }
.rhythm-level-heading p:last-child { margin: 0; color: var(--muted); }
.rhythm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.rhythm-choice { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; width: 100%; min-width: 0; min-height: 80px; padding: .65rem .75rem; border-color: #b9adcb; background: white; color: var(--ink); text-align: left; }
.rhythm-choice[aria-pressed="true"] { border-color: var(--purple-dark); outline: 3px solid #e0d6ee; background: #f7f4fb; }
.rhythm-choice-topline { display: flex; min-width: 0; align-items: center; gap: .5rem; }
.rhythm-choice-index { color: var(--purple-dark); font-size: .8rem; font-weight: 900; }
.rhythm-choice-topline strong { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.rhythm-choice-count { color: var(--muted); font-size: var(--supporting-text-size); white-space: nowrap; }
.rhythm-mini { display: flex; width: 100%; align-items: center; gap: 3px; }
.rhythm-mini i { display: block; min-width: 2px; height: 7px; flex: 1; border-radius: 999px; background: #dfe3e9; }
.rhythm-mini i.is-on { background: var(--orange); }
.rhythm-mini i.is-beat-start:not(:first-child) { margin-left: .45rem; }
.rhythm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; max-width: 960px; margin: .7rem 0; }
.rhythm-beat { display: grid; grid-template-columns: repeat(var(--beat-subdivisions, 1), minmax(44px, 1fr)); gap: .25rem; align-content: start; min-width: 0; padding: .35rem; border: 1px solid var(--line); border-radius: 12px; background: #faf9fc; }
.rhythm-beat--1 { --beat-subdivisions: 1; }
.rhythm-beat--2 { --beat-subdivisions: 2; }
.rhythm-beat--4 { --beat-subdivisions: 4; }
.rhythm-beat-label { grid-column: 1 / -1; color: var(--muted); font-size: var(--supporting-text-size); font-weight: 850; text-align: center; }
.rhythm-cell { width: 100%; min-width: 44px; min-height: 52px; padding: .3rem; border-color: #a8b1bb; background: #f3f5f7; color: #526174; font-size: 1.2rem; }
.rhythm-cell.is-on { border-color: var(--orange); background: #fff0e2; color: #7d451e; }
.composer-settings { display: grid; grid-template-columns: auto minmax(130px, 1fr); gap: .5rem .8rem; align-items: center; max-width: 32rem; }
.composer-settings label, .note-length label { font-weight: 800; }
select, input { min-height: 48px; padding: .5rem .7rem; border: 1px solid #aeb8c4; border-radius: 11px; background: white; color: var(--ink); }
.bar-chip { min-width: 74px; }
.piano-roll { display: grid; gap: .25rem; max-width: 600px; overflow-x: auto; margin: .8rem 0; padding: .45rem; border: 1px solid var(--line); border-radius: 14px; background: #faf9fc; }
.piano-header, .piano-row { display: grid; min-width: 330px; grid-template-columns: minmax(3.8rem, .75fr) repeat(4, minmax(52px, 1fr)); gap: .3rem; align-items: center; }
.piano-header { color: var(--muted); font-weight: 800; text-align: center; }
.piano-header span { padding: .35rem 0; border-radius: 9px; }
.piano-header [aria-current="step"] { background: #efe7f8; color: var(--purple-dark); outline: 2px solid var(--purple); }
.pitch-label { font-weight: 800; text-align: center; }
.note-cell { min-width: 0; min-height: 48px; padding: .3rem; border-color: #b5c6d8; background: #eef4fa; color: var(--blue-dark); }
.note-cell.is-on { border-color: var(--purple); background: #eee7f7; color: var(--purple-dark); }
.note-cell.is-locked { border-style: dashed; background: #ececef; }
.note-length { display: flex; align-items: center; gap: .6rem; }
.track-list, .work-list, .export-list, .license-list { display: grid; gap: .55rem; padding: 0; list-style: none; }
.track-card { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(160px, 2fr) auto; gap: .5rem; align-items: center; padding: .55rem; border: 1px solid var(--line); border-radius: 13px; background: white; }
.track-card.selected { border-color: var(--purple); background: #faf7fd; }
.track-select { display: flex; min-height: 48px; flex-direction: column; align-items: start; justify-content: center; border: 0; background: transparent; color: var(--ink); text-align: left; }
.track-select:hover { background: transparent; color: var(--purple-dark); }
.track-select span { color: var(--muted); font-size: .82rem; }
.compact { min-height: 44px; padding: .45rem .65rem; }
.work-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 14px; background: white; }
.work-card h2 { margin: .15rem 0; font-size: 1.2rem; }
.work-card p:last-child { margin: 0; color: var(--muted); }
.export-list li, .license-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem; border: 1px solid var(--line); border-radius: 12px; }
.license-list li span { color: var(--muted); font-size: .88rem; }
.empty-state { display: grid; justify-items: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state span { color: var(--purple); font-size: 3rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin: .7rem 0; }
.toolbar button, .toolbar .button { min-width: 124px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
form { display: grid; justify-items: start; gap: .65rem; }
input { max-width: 14rem; }
@media (max-width: 900px) {
  .instrument-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rhythm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rhythm-beat--4 { --beat-subdivisions: 2; }
}
@media (max-width: 680px) {
  .site-header { position: static; display: grid; gap: .35rem; padding: .65rem 12px; }
  .site-header nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .1rem; }
  .site-header nav a { justify-content: center; min-height: 44px; padding: .35rem .1rem; font-size: .83rem; }
  #app { padding: .8rem 12px 2.5rem; }
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .studio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track-card { grid-template-columns: minmax(0, 1fr) minmax(125px, 1.3fr); }
  .track-card .compact { grid-column: 1 / -1; }
  .site-footer { display: grid; padding: .9rem 12px; }
  .site-footer nav { flex-wrap: wrap; }
  .work-card { align-items: start; flex-direction: column; }
  .export-list li, .license-list li { align-items: start; flex-direction: column; }
  .rhythm-list { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .site-header nav a { font-size: .76rem; }
  .studio-card { min-height: 166px; padding: .8rem; }
  .composer-settings { grid-template-columns: 1fr; gap: .25rem; }
  .composer-settings label:not(:first-child) { margin-top: .35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Public visual rhythm edition */
:focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 3px; }
.button.secondary { min-height: 48px; }
.plain-note { margin: 1rem 0; padding: 1rem; border-left: 4px solid var(--blue-dark); border-radius: 8px; background: #edf3fc; }
.rhythm-cell { min-width: 44px; min-height: 52px; }
@media (max-width: 680px) {
  #app { width: 100%; min-width: 0; }
  .rhythm-grid { grid-template-columns: minmax(0, 1fr); }
  .rhythm-beat { grid-template-columns: repeat(var(--beat-subdivisions, 1), minmax(44px, 1fr)); }
}
