:root {
  color-scheme: light;
  font-family: Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  color: #201d31;
  background: #f6f7ee;
  --ink: #201d31;
  --muted: #5e596e;
  --accent: #5c3bc7;
  --accent-deep: #4d2db6;
  --accent-light: #ede7ff;
  --lime: #e2f889;
  --border: #e5e2ec;
  --radius: 28px;
}

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; }
button { font: inherit; }
button:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 4px; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

.shell {
  width: calc(100% - 56px);
  max-width: 1056px;
  margin-inline: auto;
}

.site-header {
  min-height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #dddcd4;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.0625rem;
  font-weight: 850;
  letter-spacing: -.06em;
  white-space: nowrap;
}

.wordmark-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: white;
}

.mic-icon {
  position: relative;
  width: 7px;
  height: 12px;
  margin-top: -5px;
  border: 1.5px solid currentColor;
  border-radius: 6px;
}

.mic-icon::before, .mic-icon::after {
  position: absolute;
  left: 50%;
  content: '';
  transform: translateX(-50%);
}

.mic-icon::before {
  top: 5px;
  width: 12px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.mic-icon::after { top: 13px; width: 1.5px; height: 4px; background: currentColor; }
.header-label { color: var(--muted); font-size: .875rem; font-weight: 650; }

main.shell { padding-bottom: 44px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  min-height: 288px;
  padding: 10px 24px 12px 5px;
  gap: 24px;
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.7rem, 6vw, 4.85rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -.085em;
  word-break: keep-all;
}

.hero h1 span {
  display: table;
  position: relative;
  margin-top: 3px;
  color: var(--accent);
}

.hero h1 span::after {
  content: '';
  position: absolute;
  z-index: -1;
  bottom: .02em;
  left: -.03em;
  width: 106%;
  height: .25em;
  border-radius: .06em;
  background: var(--lime);
  transform: rotate(-3deg);
}

.hero p {
  margin-top: 19px;
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: -.035em;
  word-break: keep-all;
}

.hero-art {
  display: block;
  justify-self: center;
  width: min(100%, 440px);
  height: 264px;
  object-fit: contain;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 20px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  min-width: 0;
}

.controls {
  background: #fff;
  box-shadow: 0 6px 22px #251d4010;
}

.card h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 850;
  letter-spacing: -.055em;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  margin-bottom: 16px;
}

.reset-button {
  border: 0;
  min-height: 36px;
  padding: 6px 8px;
  margin-inline-end: -8px;
  border-radius: 7px;
  color: var(--accent-deep);
  background: transparent;
  font-weight: 750;
  font-size: .875rem;
  cursor: pointer;
}

.reset-button:disabled { color: #766f83; cursor: default; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.singer-fieldset { margin-top: 17px; }

legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: .9375rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.legend-note {
  margin-inline-start: 5px;
  font-weight: 550;
  font-size: .8125rem;
  color: var(--muted);
}

.chips { display: grid; gap: 8px; }
.genre-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.singer-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.extra-genres { margin-top: 5px; }
.extra-genres summary { width: fit-content; padding: 5px 0; color: var(--accent-deep); font-size: .8125rem; font-weight: 700; cursor: pointer; }
.extra-genres[open] .chips { padding-top: 5px; }
.extra-genres summary:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

.chip { position: relative; min-width: 0; }

.chip input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.chip-face {
  display: flex;
  gap: 7px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  background: #faf9fd;
  font-size: .875rem;
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -.045em;
  text-align: center;
  word-break: keep-all;
}

.chip-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid #aaa3b6;
  border-radius: 50%;
}

.chip input:checked + .chip-face {
  border-color: #8267d7;
  color: #44259f;
  background: var(--accent-light);
}

.chip input:checked + .chip-face .chip-check { border-color: var(--accent); background: var(--accent); }

.chip input:checked + .chip-face .chip-check::after {
  content: '';
  width: 7px;
  height: 4px;
  margin-top: -1px;
  border: solid white;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
}

.chip input:focus-visible + .chip-face { outline: 3px solid var(--accent-deep); outline-offset: 2px; }

.draw-controls { margin-top: 19px; }

.draw-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid var(--accent-deep);
  border-radius: 13px;
  background: var(--accent);
  box-shadow: 0 3px 0 var(--accent-deep);
  color: white;
  cursor: pointer;
  font-size: 1.0625rem;
  font-weight: 850;
  letter-spacing: -.035em;
}

.shuffle-icon { color: var(--lime); font-size: 1.125rem; }
.draw-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-deep); }

.candidate-note {
  min-height: 1.45em;
  margin-top: 12px;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.45;
  text-align: center;
  word-break: keep-all;
}

.result {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: #ddd3f3;
  background: radial-gradient(ellipse at 90% 10%, #f3eeff 0%, transparent 62%), #eae1fb;
}

.result-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-block: 15px 10px;
}

.record {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 108px;
  aspect-ratio: 1;
  border: 1px solid #3b2a64;
  border-radius: 50%;
  background:
    conic-gradient(from 26deg, transparent 0 97deg, #9b7fd746 120deg, transparent 153deg 273deg, #9b7fd747 298deg, transparent 327deg),
    repeating-radial-gradient(circle, #302448 0 3px, #4a3867 3px 4px, #302448 4px 6.5px);
  box-shadow: 0 7px 13px #4d367b30;
}

.record span {
  display: grid;
  place-items: center;
  width: 41%;
  aspect-ratio: 1;
  border: 1px solid #aecc43;
  border-radius: 50%;
  background: var(--lime);
}

.record span::after { content: ''; width: 15%; aspect-ratio: 1; border-radius: 50%; background: #352551; }
.result-text { min-width: 0; color: #46375f; text-align: center; }

.result-title {
  color: #2f2147;
  font-size: clamp(1.375rem, 3.8vw, 2.375rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.065em;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.result-detail { margin-top: 7px; line-height: 1.45; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; word-break: keep-all; }

.result-genre {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  border: 1px solid #d3c5ed;
  border-radius: 20px;
  color: #543990;
  background: #f5efff;
  font-size: .8125rem;
  font-weight: 720;
}

.result[data-state='drawn'] .result-title { color: #291749; }
.result[data-state='empty'] .result-title { font-size: clamp(1.125rem, 3vw, 1.8rem); }

.result-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 9px; }
.result-actions a, .result-actions button { display: inline-flex; min-height: 44px; align-items: center; padding: 5px 12px; border: 1px solid #c9b9e6; border-radius: 10px; color: #382567; background: #f7f1ff; font: inherit; font-size: .875rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.result-actions :is(a, button):hover { background: #efe6fc; }
.copy-status { margin: 8px 0 0; color: #46375f; font-size: .875rem; text-align: center; }
.recent { margin-top: 12px; border: 1px solid #ded9e9; border-radius: 14px; background: #fdfcfb; }
.recent summary { padding: 11px 14px; min-height: 44px; color: #382d53; font-weight: 720; cursor: pointer; }
.recent ol { margin: 0; padding: 0 15px 7px 2.25rem; }
.recent li { padding: 7px 0; border-top: 1px solid #eeebf4; overflow-wrap: anywhere; }
.recent li span { color: #5a4b75; margin-inline-start: .55rem; }
.chart-details p { margin: 0 14px 10px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.chart-details a { color: var(--accent-deep); font-weight: 700; }
.chart-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.recent summary:focus-visible, .result-actions :focus-visible { outline: 2px solid #603bd0; outline-offset: 2px; }

@media (hover: hover) {
  .chip:hover input:not(:checked) + .chip-face { border-color: #a991dd; background: #f3eefc; }
  .reset-button:hover:enabled { background: var(--accent-light); }
  .draw-button:hover { background: var(--accent-deep); }
}

@media (max-width: 760px) {
  :root { --radius: 22px; }
  .shell { width: calc(100% - 28px); max-width: 540px; }
  .site-header { min-height: 53px; }
  .wordmark { gap: 7px; font-size: .9375rem; }
  .wordmark-icon { width: 28px; height: 28px; border-radius: 9px; }
  .header-label { font-size: .8125rem; }
  main.shell { padding-bottom: 28px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 29%); gap: 5px; min-height: 132px; padding: 7px 0 10px 2px; }
  .hero h1 { font-size: clamp(1.875rem, 7.8vw, 3.5rem); }
  .hero h1 span { margin-top: 1px; }
  .hero p { margin-top: 9px; font-size: .875rem; line-height: 1.35; }
  .hero-art { width: 100%; height: min(23vw, 132px); justify-self: end; }
  .tool-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 14px; }
  .card h2 { font-size: 1.125rem; }
  .card-header { min-height: 32px; margin-bottom: 9px; }
  .reset-button { min-height: 32px; }
  .singer-fieldset { margin-top: 11px; }
  legend { margin-bottom: 6px; }
  .chips { gap: 6px; }
  .chip-face { gap: 5px; }
  .chip-check { width: 12px; height: 12px; }
  .draw-controls { margin-top: 13px; }
  .draw-button { min-height: 48px; }
  .candidate-note { margin-top: 9px; }
  .result { min-height: 132px; }
  .result-body { flex-direction: row-reverse; justify-content: space-between; gap: 10px; padding-block: 9px 2px; }
  .record { width: 59px; }
  .result-text { flex: 1; text-align: start; }
  .result-title { font-size: 1.25rem; }
  .result-detail { margin-top: 4px; font-size: .875rem; }
  .result-genre { margin-top: 8px; }
  .result-actions { justify-content: start; }
  .copy-status { text-align: start; }
}

@media (max-width: 350px) {
  .chip-face { padding-inline: 1px; gap: 4px; }
  .hero p { font-size: .8125rem; }
}

@media (max-width: 375px) and (max-height: 650px) {
  .site-header { min-height: 48px; }
  .hero { min-height: 0; padding-block: 7px; }
  .tool-layout { gap: 8px; }
  .card { padding: 12px; }
  .card-header { margin-bottom: 5px; }
  .singer-fieldset { margin-top: 9px; }
  legend { margin-bottom: 4px; }
  .draw-controls { margin-top: 9px; }
  .candidate-note { margin-top: 7px; }
  .result { min-height: 0; }
  .result h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .result-body { padding-block: 4px 2px; }
  .record { width: 50px; }
}

@media (forced-colors: active) {
  .chip input:checked + .chip-face { border: 2px solid Highlight; }
  .chip input:checked + .chip-face .chip-check::after { border-color: ButtonText; }
}
