:root {
  color-scheme: light;
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f5f6f8; --panel-3: #eef0f4;
  --line: #e1e4ea; --line-bright: #c9cfda; --text: #171a21; --muted: #657080;
  --dim: #8a94a3; --accent: #6f55e8; --accent-hi: #8068ee; --danger: #d94355;
  --verse: #5969e8; --prechorus: #b15cd9; --chorus: #e45782; --bridge: #de8b3f;
  --interlude: #3ba7a0; --ending: #657080; --radius: 12px; --shadow: 0 18px 50px rgba(30,38,54,.14);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
.app-shell { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 62px; flex: 0 0 62px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.topbar-inner { width: min(1440px, calc(100% - 96px)); height: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 36px; height: 36px; display: block; border-radius: 8px; object-fit: contain; }
.brand div { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: .98rem; }
.brand span { max-width: 32vw; margin-top: 5px; color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.save-state { margin-right: 5px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: #3ccf91; box-shadow: 0 0 0 3px rgba(60,207,145,.12); }
.save-state.saving i { background: #ffbc51; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; font-size: .84rem; font-weight: 750; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hi); }
.button.secondary { background: rgba(111,85,232,.1); border-color: rgba(111,85,232,.32); color: #5940ca; }
.button.ghost { background: var(--panel-2); border-color: var(--line); color: #414957; }
.button.compact { min-height: 32px; padding: 0 11px; background: var(--panel-3); border-color: var(--line-bright); font-size: .76rem; }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--muted); font-size: .78rem; }
.text-button:hover { color: var(--text); }
.workspace { width: min(1440px, calc(100% - 96px)); min-height: 0; flex: 1; align-self: center; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.source-column { min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: #fafbfc; }
.source-scroll, .forms-column { height: 100%; overflow-y: auto; scrollbar-color: #c5cad3 transparent; scrollbar-width: thin; }
.source-scroll { padding: 26px clamp(20px, 3vw, 42px) 32px; display: flex; flex-direction: column; }
.forms-column { padding: 26px clamp(22px, 3vw, 44px) 60px; background: var(--bg); }
.source-section + .source-section { margin-top: 11px; padding-top: 0px;}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.45rem; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 1rem; }
.title-section > label { display: block; margin: 0 0 7px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.song-title-input { width: 100%; padding: 2px 0 12px; border: 0; border-bottom: 1px solid var(--line-bright); outline: 0; background: transparent; color: var(--text); font-size: clamp(1.6rem, 3vw, 1.35rem); font-weight: 800; letter-spacing: -.045em; }
.song-title-input:focus { border-color: var(--accent); color: #5840c4; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-palette { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.palette-chip, .order-chip { border: 0; color: white; font-weight: 850; font-size: .76rem; }
.palette-chip { min-width: 43px; height: 33px; padding: 0 11px; border-radius: 7px; transition: transform .15s ease, filter .15s ease; }
.palette-chip:hover { filter: brightness(1.14); transform: translateY(-2px); }
.arrangement-lane { min-height: 64px; margin-top: 10px; padding: 11px; display: flex; align-items: center; gap: 7px; overflow-x: auto; border: 1px dashed var(--line-bright); border-radius: var(--radius); background: rgba(17,24,39,.02); }
.arrangement-lane.drag-over { border-color: var(--accent-hi); background: rgba(124,92,255,.08); }
.arrangement-empty { margin: auto; color: var(--dim); font-size: .8rem; }
.order-chip { position: relative; min-width: 48px; height: 36px; padding: 0 24px 0 10px; flex: 0 0 auto; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.order-chip.dragging { opacity: .38; transform: scale(.94); }
.order-chip.drop-before { transform: translateX(5px); box-shadow: -4px 0 0 var(--accent-hi), inset 0 0 0 1px rgba(255,255,255,.12); }
.order-chip.drop-after { transform: translateX(-5px); box-shadow: 4px 0 0 var(--accent-hi), inset 0 0 0 1px rgba(255,255,255,.12); }
.order-chip .remove-order { position: absolute; top: 8px; right: 6px; opacity: .65; }
.hint { margin: 9px 0 0; color: var(--dim); font-size: .76rem; line-height: 1.55; }
.hint code { color: #6553ad; }
.raw-section { flex: 1; min-height: 280px; display: flex; flex-direction: column; }
.raw-source { width: 100%; min-height: 0; flex: 1; margin-top: 14px; padding: 16px; resize: none; border: 1px solid var(--line); border-radius: var(--radius); outline: 0; background: #ffffff; color: #272c35; font-family: "D2Coding", Consolas, monospace; font-size: .86rem; line-height: 1.7; tab-size: 2; }
.raw-source:focus { border-color: var(--accent); }
.forms-toolbar { position: sticky; top: -11px; z-index: 5; margin: -11px 0 18px; padding: 11px 0 17px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.forms-summary { display: flex; gap: 10px; color: var(--muted); font-size: .75rem; }
.forms-summary span + span::before { content: "·"; margin-right: 10px; color: var(--dim); }
.forms-list { display: flex; flex-direction: column; gap: 16px; }
.form-card { overflow: visible; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 8px 30px rgba(30,38,54,.08); transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease; }
.form-card.dragging { opacity: .38; transform: scale(.985); }
.form-card.drop-before { transform: translateY(7px); box-shadow: 0 -5px 0 -1px var(--accent-hi), 0 8px 30px rgba(0,0,0,.14); }
.form-card.drop-after { transform: translateY(-7px); box-shadow: 0 5px 0 -1px var(--accent-hi), 0 8px 30px rgba(0,0,0,.14); }
.form-card-header { min-height: 44px; padding: 4px 9px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid rgba(255,255,255,.16); border-radius: 13px 13px 0 0; }
.drag-handle { padding: 3px 2px; color: rgba(255,255,255,.72); cursor: grab; user-select: none; letter-spacing: -2px; }
.form-label-input { min-width: 0; flex: 1; padding: 4px 7px; border: 1px solid transparent; border-radius: 7px; outline: 0; background: transparent; color: white; font-size: .94rem; font-weight: 800; }
.form-label-input:focus { border-color: rgba(255,255,255,.42); background: rgba(0,0,0,.16); }
.card-actions { display: flex; gap: 2px; }
.mini-button { width: 27px; height: 27px; border: 0; border-radius: 6px; background: transparent; color: rgba(255,255,255,.7); }
.mini-button:hover { background: rgba(0,0,0,.2); color: white; }
.mini-button.danger:hover { color: var(--danger); }
.lyrics-input { display: block; width: 100%; min-height: 290px; overflow-y: hidden; resize: none; padding: 20px 20px 76px; border: 0; border-radius: 0 0 13px 13px; outline: 0; background: #ffffff; color: #1d222b; font-family: "D2Coding", Consolas, "Malgun Gothic", monospace; font-size: 1rem; line-height: 1.85; }
.lyrics-input::placeholder { color: #98a0ad; }
.lyrics-input:focus { background: #fcfbff; box-shadow: inset 0 0 0 1px rgba(111,85,232,.4); }
.modal { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-bright); border-radius: 16px; color: var(--text); background: #ffffff; box-shadow: 0 30px 90px rgba(30,38,54,.22); }
.modal::backdrop { background: rgba(4,5,8,.72); backdrop-filter: blur(5px); }
.modal form { padding: 28px; }
.modal-mark { width: 42px; height: 42px; margin-bottom: 19px; display: grid; place-items: center; border-radius: 11px; background: rgba(124,92,255,.16); color: #b8a8ff; font-size: 1.25rem; font-weight: 900; }
.modal h2 { font-size: 1.24rem; }
.modal p { margin: 8px 0 22px; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.modal label { display: block; margin-bottom: 7px; color: #c4c9d2; font-size: .8rem; font-weight: 700; }
.modal label { color: #414957; }
.modal input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-bright); border-radius: 9px; outline: 0; background: #ffffff; color: var(--text); }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 50; padding: 10px 15px; transform: translate(-50%,16px); opacity: 0; pointer-events: none; border: 1px solid #303746; border-radius: 9px; background: #202532; color: white; box-shadow: var(--shadow); font-size: .8rem; transition: .2s ease; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.drop-overlay { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(7,8,12,.78); backdrop-filter: blur(6px); pointer-events: none; }
.drop-overlay.visible { display: grid; }
.drop-overlay div { width: min(520px, calc(100vw - 40px)); padding: 54px; display: grid; place-items: center; gap: 15px; border: 2px dashed var(--accent-hi); border-radius: 20px; background: #ffffff; color: var(--text); }
.drop-overlay span { color: var(--accent-hi); font-size: 2.4rem; }
.drop-overlay strong { font-size: 1.1rem; }
@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .workspace { width: 100%; display: block; border-left: 0; border-right: 0; }
  .source-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .source-scroll, .forms-column { height: auto; overflow: visible; }
  .source-scroll { display: block; }
  .raw-source { min-height: 420px; }
  .forms-toolbar { top: 0; margin-top: 0; }
}
@media (max-width: 620px) {
  .topbar { height: auto; min-height: 62px; }
  .topbar-inner { width: 100%; padding: 11px 14px; align-items: flex-start; gap: 12px; }
  .brand span, .save-state { display: none; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .button { min-height: 36px; padding: 0 10px; }
  .source-scroll, .forms-column { padding-left: 16px; padding-right: 16px; }
  .forms-toolbar { grid-template-columns: 1fr auto; }
  .forms-summary { display: none; }
  .lyrics-input { min-height: 300px; padding: 18px 16px 76px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
