:root {
  color-scheme: light;
  --ink: #111;
  --page-ink: #111;
  --muted: #566468;
  --paper: #d2f758;
  --white: #fff;
  --green: #111;
  --line: #000000;
  --serif: "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
.page-shell { max-width: 1440px; margin: 0 auto; padding: 0 7.1%; }
.intro { display: flex; align-items: baseline; gap: 12px; padding: 25px 0 24px; }
.eyebrow { width: fit-content; padding: 0; border: 0; background: transparent; color: #111; font-size: 9px; font-weight: 700; letter-spacing: .4em; display: flex; align-items: center; gap: 9px; }
.intro .eyebrow { color: var(--page-ink); }
.intro h1 { display: table; max-width: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: var(--page-ink); font-family: var(--serif); font-size: clamp(29px, 4vw, 43px); letter-spacing: .09em; line-height: 1.35; font-weight: 700; }
.intro h1 span { color: inherit; }
.collection { padding-bottom: 65px; }
.collection-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 22px; border-bottom: 0; margin-bottom: 23px; }
.collection-title { display: flex; gap: 13px; align-items: center; }
.collection-icon { width: 37px; height: 37px; border: 1px solid #111; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #111; font-size: 20px; }
.collection-title h2 { display: inline-block; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--page-ink); font-size: 10px; letter-spacing: .12em; margin: 0 0 4px; }
.collection-title p { display: table; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--page-ink); font-size: 9px; letter-spacing: .1em; margin: 0; }
.collection-actions { display: flex; gap: 9px; align-items: center; }
.background-picker { display: flex; align-items: center; gap: 7px; height: 38px; padding: 4px 7px 4px 10px; border: 1px solid #111; border-radius: 999px; background: #fff; color: #111; font-size: 10px; font-weight: 600; cursor: pointer; }
.background-picker input { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.background-picker input::-webkit-color-swatch-wrapper { padding: 0; }
.background-picker input::-webkit-color-swatch { border: 1px solid #111; border-radius: 50%; }
.background-picker input::-moz-color-swatch { border: 1px solid #111; border-radius: 50%; }
.button { border: 1px solid #111; border-radius: 999px; padding: 11px 16px; background: #fff; color: #111; font-size: 11px; font-weight: 600; transition: background .18s, transform .18s; }
.button:active { transform: translateY(1px); }
.button-dark { color: #111; background: #fff; }
.button-dark:hover { background: #f1f1f1; }
.button-dark:disabled { opacity: .4; cursor: not-allowed; }
.button-dark span { margin-right: 7px; color: #111; font-size: 15px; }
.button-quiet { color: #111; background: #fff; }
.button-quiet:hover { background: #f1f1f1; }
.card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 31px 20px; }
.song-card { min-width: 0; position: relative; background: white; box-shadow: 0 4px 18px #3a51400b; transition: transform .2s, box-shadow .2s; }
.song-card { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.song-card img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.song-card.dragging { opacity: .55; z-index: 20; cursor: grabbing; transition: none; }
.song-card.dragging:hover { transform: none; }
.song-card.drag-over { outline: 0; }
.drag-placeholder { min-width: 0; aspect-ratio: 0.86; border: 2px dashed #80909b; border-radius: 4px; background: #ffffff66; transition: transform 180ms cubic-bezier(.2,.75,.25,1); }
.song-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px #3a514014; }
.card-art { position: relative; aspect-ratio: 1; overflow: hidden; background: #e7ebe4; }
.card-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card-art-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #a4b2a7; background: linear-gradient(140deg, #e6eee7, #f3eee6); font-size: 42px; }
.card-info { position: relative; min-height: 86px; padding: 8px 9px 7px; border-top: 2px solid var(--card-color); overflow: hidden; }
.card-character-window { position: absolute; right: 0; bottom: 0; width: 80.18px; height: 84px; overflow: hidden; opacity: .13; filter: grayscale(1); mask-image: linear-gradient(115deg, transparent 3%, #000 65%); }
.card-character-bg { position: absolute; max-width: none; display: block; }
.card-name-line { position: relative; z-index: 1; min-width: 0; line-height: 1.0; overflow-wrap: anywhere; }
.character-name { font-family: var(--serif); font-size: 11px; font-weight: 700; }
.name-separator { margin: 0 1px; color: #a3ada5; font-size: 8px; white-space: nowrap; }
.scenario-name { color: #919b95; font-size: 9px; }
.song-name { position: relative; z-index: 1; margin-top: 5px; font-family: var(--serif); font-size: 11px; line-height: 1.2; font-weight: 600; overflow-wrap: anywhere; }
.artist-name { position: relative; z-index: 1; margin-top: 2px; color: #8c9790; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .16s; }
.song-card:hover .card-actions, .song-card:focus-within .card-actions { opacity: 1; }
.card-action { width: 27px; height: 27px; border: 0; border-radius: 50%; background: #fffffff0; color: #4a5750; box-shadow: 0 1px 5px #0002; }
.add-card { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 235px; color: #111; background: #fff; border: 1px solid #111; border-radius: 8px; transition: background .18s, border-color .18s; }
.add-card:hover { background: #f1f1f1; border-color: #111; }
.add-card-icon { width: 39px; height: 39px; border: 1px solid #111; border-radius: 50%; display: grid; place-items: center; font-size: 21px; font-weight: 300; }
.add-card-label { margin-top: 12px; font-size: 10px; letter-spacing: .06em; }
.empty-state { text-align: center; padding: 63px 20px 58px; }
.empty-art { width: 93px; height: 93px; margin: 0 auto 22px; position: relative; display: grid; place-items: center; border: 1px solid #111; border-radius: 50%; background: #fff; color: #111; font-size: 34px; }
.empty-art i { position: absolute; right: 6px; top: 0; font-style: normal; font-size: 20px; color: #c0a989; }
.empty-state h3 { display: table; margin: 0 auto 8px; padding: 6px 12px; color: var(--page-ink); font-size: 17px; font-family: var(--serif); }
.empty-state p { display: table; margin: 0 auto 20px; letter-spacing: 0.08em; padding: 6px 11px; color: var(--page-ink); font-size: 11px; }
.footer { min-height: 68px; border-top: 1px solid var(--line); color: var(--page-ink); display: flex; gap: 12px; align-items: center; font-size: 8px; letter-spacing: .1em; }
.footer span:first-child { font-weight: 700; }
.footer span:nth-child(2) { color: var(--page-ink); }

.editor-dialog, .crop-dialog { width: min(960px, calc(100vw - 28px)); max-width: none; max-height: min(90vh, 1000px); padding: 0; border: 1px solid #111; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 22px 90px #202d2850; overflow: auto; }
.editor-dialog { height: min(820px, calc(100vh - 28px)); overflow: hidden; }
.editor { height: 100%; display: flex; flex-direction: column; }
.editor-body { flex: 1; min-height: 0; }
.form-column, .song-column { min-height: 0; overflow-y: auto; }
.editor-dialog::backdrop, .crop-dialog::backdrop { background: #1d2926a6; backdrop-filter: blur(3px); }
.editor { padding: 38px 42px 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 20px; border-bottom: 0; }
.dialog-heading h2, .crop-dialog-heading h2 { display: inline-block; margin: 9px 0 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #111; font-family: var(--serif); font-size: 22px; }
.icon-button { border: 0; background: transparent; color: #819087; font-size: 26px; line-height: 1; }
.editor-body { display: grid; grid-template-columns: .95fr 1.05fr; gap: 42px; padding: 30px 0 32px; }
.field-label { display: flex; align-items: center; justify-content: space-between; margin: 0 0 9px; color: #45524b; font-size: 12px; font-weight: 700; }
.field-label > span { color: #a0aaa3; font-size: 10px; font-weight: 400; }
.form-column > input:not(.visually-hidden), .song-column > input:not(.visually-hidden) { width: 100%; border: 1px solid #e0e6df; outline: none; border-radius: 4px; padding: 13px 14px; margin: 0 0 19px; background: white; color: var(--ink); font-size: 13px; }
.form-column > input:focus, .song-column > input:focus, .search-box:focus-within { border-color: #8ea894; box-shadow: 0 0 0 3px #dce8dc88; }
input::placeholder { color: #b2bbb4; }
.color-label { margin: 0 0 11px; }
.color-picker { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
#color-control { --selected-hue: 355; appearance: none; flex: 1; height: 12px; margin: 0; border: 0; border-radius: 99px; background: linear-gradient(90deg, #f33 0%, #ff0 16.7%, #0d5 33.3%, #0dd 50%, #35f 66.7%, #d0f 83.3%, #f33 100%); cursor: pointer; }
#color-control::-webkit-slider-thumb { appearance: none; width: 25px; height: 25px; border: 3px solid white; border-radius: 50%; background: hsl(var(--selected-hue), 65%, 55%); box-shadow: 0 1px 5px #0004; }
#color-control::-moz-range-thumb { width: 20px; height: 20px; border: 3px solid white; border-radius: 50%; background: hsl(var(--selected-hue), 65%, 55%); box-shadow: 0 1px 5px #0004; }
.color-picker-swatch { display: block; width: 34px; height: 34px; flex: 0 0 34px; padding: 3px; border: 1px solid #dfe6de; border-radius: 50%; background: white; cursor: pointer; }
.color-picker-swatch input { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.color-picker-swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-swatch input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.theme-color-code { width: 82px !important; height: 34px; margin: 0 !important; padding: 7px 8px !important; border: 1px solid #dfe6de !important; border-radius: 999px !important; color: #111; background: #fff; font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; text-transform: uppercase; }
.theme-color-code.invalid { border-color: #b85f5f !important; color: #9b4646; }
.image-label { margin-bottom: 10px; }
.upload-button { min-height: 42px; display: inline-flex; gap: 8px; align-items: center; padding: 0 14px; border: 1px solid #111; border-radius: 999px; background: #fff; color: #111; font-size: 12px; cursor: pointer; }
.upload-button > span { font-size: 18px; }
.upload-button small { margin-left: 4px; color: #a5aea7; font-size: 9px; }
.image-preview { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.image-preview[hidden] { display: none; }
.image-preview-window { position: relative; width: 63px; height: 66px; flex: 0 0 63px; overflow: hidden; border-radius: 4px; background: #e5e9e4; }
.image-preview-window > img { position: absolute; max-width: none; display: block; }
.image-preview-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.crop-editor { padding: 30px 34px 26px; }
.crop-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.crop-dialog-heading h2 { margin: 9px 0 0; font-family: var(--serif); font-size: 22px; }
.crop-instruction { margin: 16px 0 12px; color: #7d8981; font-size: 12px; }
.crop-frame { position: relative; width: 100%; height: min(55vh, 480px); min-height: 260px; overflow: hidden; background: #e5e9e4; cursor: default; }
.crop-frame:active { cursor: grabbing; }
.crop-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: center; pointer-events: none; }
.crop-selection { position: absolute; border: 2px solid #fff; outline: 1px solid #30443a; box-shadow: 0 0 0 9999px #1c282b4a; cursor: grab; touch-action: none; }
.crop-selection:active { cursor: grabbing; }
.crop-selection:focus-visible { outline: 2px solid #30443a; }
.crop-selection-label { position: absolute; bottom: 6px; left: 6px; padding: 3px 5px; background: #ffffffdf; color: #35473d; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.crop-handle { position: absolute; z-index: 2; width: 14px; height: 14px; border: 1px solid #111; background: white; touch-action: none; }
.crop-handle.top-left { top: -7px; left: -7px; cursor: nwse-resize; }
.crop-handle.top-right { top: -7px; right: -7px; cursor: nesw-resize; }
.crop-handle.bottom-left { bottom: -7px; left: -7px; cursor: nesw-resize; }
.crop-handle.bottom-right { bottom: -7px; right: -7px; cursor: nwse-resize; }
.crop-controls { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 10px; color: #859087; font-size: 10px; }
.crop-controls span:first-child { line-height: 1.6; }
.crop-controls span:last-child { white-space: nowrap; }
.text-button { padding: 7px 0 0; border: 0; background: none; color: #9b7772; font-size: 10px; }
.crop-dialog-footer { display: flex; justify-content: flex-end; align-items: center; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.crop-dialog-footer #remove-image-from-crop { margin-right: auto; }
.song-tabs { display: flex; gap: 22px; margin: 0 0 14px; border-bottom: 1px solid #e5e9e3; }
.song-tab { position: relative; border: 0; background: none; padding: 0 0 11px; color: #9aa39d; font-size: 12px; }
.song-tab.active { color: #35594c; font-weight: 700; }
.song-tab.active::after { position: absolute; content: ""; height: 2px; background: #638675; bottom: -1px; left: 0; right: 0; }
.search-box { height: 47px; display: flex; align-items: center; border: 1px solid #111; border-radius: 999px; background: white; }
.search-box > span { padding: 0 10px; color: #829287; font-size: 20px; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 12px; background: transparent; }
.search-box button { align-self: stretch; margin: 5px; padding: 0 14px; border: 1px solid #111; border-radius: 999px; color: #111; background: #fff; font-size: 11px; }
.search-results { height: 220px; max-height: 220px; overflow: auto; }
.result-item { width: 100%; display: flex; gap: 12px; align-items: center; padding: 9px 6px; border: 0; border-bottom: 1px solid #edf0eb; background: transparent; text-align: left; }
.result-item:hover { background: #f0f4ee; }
.result-item img, .result-art-placeholder { width: 50px; height: 50px; flex: 0 0 50px; object-fit: cover; border-radius: 3px; background: #e5ebe4; }
.result-art-placeholder { display: grid; place-items: center; color: #8fa291; }
.result-copy { flex: 1; min-width: 0; }
.result-copy strong, .result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-copy strong { font-family: var(--serif); font-size: 12px; }
.result-copy span { margin-top: 4px; color: #87918a; font-size: 10px; }
.result-select { color: #8ba18e; font-size: 17px; }
.result-message { padding: 22px 6px; color: #8e9891; text-align: center; font-size: 11px; }
.subfield-label { margin-top: 13px; }
.compact-upload { margin-top: 0; }
.manual-preview { margin-top: 9px; }
.manual-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 3px; }
.selected-song { display: flex; gap: 10px; align-items: center; margin-top: 15px; padding: 10px; background: #edf3ec; border-radius: 4px; }
.selected-song img, .selected-song-placeholder { width: 38px; height: 38px; flex: 0 0 38px; object-fit: cover; background: #dfe9df; }
.selected-song-placeholder { display: grid; place-items: center; color: #7c947f; }
.selected-song strong, .selected-song span { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-song strong { font-family: var(--serif); font-size: 12px; }
.selected-song span { margin-top: 4px; color: #849188; font-size: 10px; }
.remove-selected-song { width: 23px; height: 23px; margin-left: auto; flex: 0 0 23px; border: 0; border-radius: 50%; color: #8a9690; background: transparent; font-size: 17px; }
.remove-selected-song:hover { background: #dfe9de; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; }
.dialog-footer .button { padding: 13px 20px; }
.dialog-footer .button-dark span { margin: 0 0 0 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.toast { position: fixed; z-index: 10; bottom: 24px; left: 50%; padding: 13px 18px; border-radius: 5px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; color: white; background: #2e3b39; font-size: 13px; transition: .2s; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 1280px) { .page-shell { padding-left: 9%; padding-right: 9%; } }
@media (max-width: 1100px) { .page-shell { padding: 0 18px; } }
@media (max-width: 850px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .page-shell { padding: 0 18px; }
  .intro { padding: 20px 0 18px; }
  .collection-heading { align-items: flex-end; }
  .collection-actions { gap: 2px; }
  .collection-actions .button { padding: 10px; font-size: 9px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 18px; }
  .card-info { min-height: 90px; padding: 8px; }
  .song-card:hover { transform: none; }
  .add-card { min-height: 210px; }
  .editor { padding: 23px 20px 18px; }
  .editor-body { grid-template-columns: 1fr; gap: 25px; padding: 19px 0; }
  .crop-editor { padding: 22px 18px 18px; }
  .crop-frame { height: 48vh; min-height: 220px; }
  .crop-dialog-footer .button { padding: 11px 12px; }
  .search-results { max-height: 200px; }
  .footer { flex-wrap: wrap; padding: 14px 0; line-height: 1.6; }
}
