/* Stray Kids Song Finder — シンプルな画面 */
:root {
  --paper: #f4f5f7;     /* 背景 */
  --surface: #ffffff;   /* 選択肢などの面 */
  --ink: #15172a;       /* 文字 */
  --muted: #5d6278;     /* 補助の文字 */
  --rule: #dcdee5;      /* 区切り線 */
  --blue: #2d45ff;      /* 主ボタン・順位・選択中 */
  --on-blue: #ffffff;
  --peak: #c8105a;      /* 好みと合っている点 */

  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.5rem, 6.4vw, 2.75rem);
}
:root:lang(ko) { --font: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", "Zen Kaku Gothic New", sans-serif; }
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12131f;
    --surface: #1b1d2d;
    --ink: #eceef6;
    --muted: #9a9fb5;
    --rule: #2e3146;
    --blue: #7183ff;
    --on-blue: #0d0f1c;
    --peak: #ff6aa2;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: var(--step-0); line-height: 1.75;
  min-height: 100vh; display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
h1, h2, p { margin: 0; }

/* ヘッダー */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 640px; width: 100%; margin: 0 auto; padding: 16px;
}
.brand { text-decoration: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-name { font-weight: 700; }
.brand-note { font-size: var(--step--1); color: var(--muted); }
.lang-switch { display: flex; gap: 2px; flex: none; }
.lang-switch button {
  border: 0; background: transparent; border-radius: 6px; min-height: 36px; min-width: 40px;
  padding: 0 8px; font-size: var(--step--1); font-weight: 700; color: var(--muted); cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { color: var(--ink); background: var(--rule); }

main { flex: 1; max-width: 640px; width: 100%; margin: 0 auto; padding: 24px 16px 56px; }

/* はじめの画面 */
.hero-title {
  font-size: var(--step-3); font-weight: 700; line-height: 1.35; letter-spacing: -.01em;
  margin-bottom: 16px; white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere;
  text-align: center;
}
.lead { color: var(--muted); margin-bottom: 28px; max-width: 34em; }
.note { color: var(--muted); font-size: var(--step--1); margin-top: 12px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 1.5px solid var(--rule); background: var(--surface); border-radius: 10px;
  padding: 8px 20px; cursor: pointer; font-weight: 700; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn-primary:hover { border-color: var(--blue); filter: brightness(1.08); }
.btn-large { width: 100%; min-height: 56px; font-size: var(--step-1); }
.btn-text {
  border: 0; background: none; padding: 8px 0; min-height: 44px; cursor: pointer; font-weight: 700;
  color: var(--muted); text-decoration: underline; text-underline-offset: 4px;
}
.btn-text:hover { color: var(--ink); }

/* 質問 */
.progress { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.progress-bar { height: 100%; width: 0; background: var(--blue); transition: width .25s ease; }
.q-count { color: var(--muted); font-size: var(--step--1); font-weight: 700; margin-bottom: 6px; }
.q-text {
  font-size: var(--step-2); font-weight: 700; line-height: 1.5; margin-bottom: 20px;
  word-break: keep-all; overflow-wrap: anywhere;
}
.q-text:focus { outline: none; }
.scale { display: grid; gap: 8px; margin-bottom: 12px; }
.scale button {
  display: flex; align-items: center; gap: 12px; min-height: 52px; text-align: left;
  border: 1.5px solid var(--rule); background: var(--surface); border-radius: 10px;
  padding: 10px 16px; cursor: pointer;
}
.scale button:hover { border-color: var(--blue); }
.scale button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); font-weight: 700; }
.mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--rule); flex: none; }
.scale button:hover .mark { border-color: var(--blue); }
.scale button[aria-pressed="true"] .mark { border: 5px solid var(--blue); }

/* 結果 */
.result-title { font-size: var(--step-2); font-weight: 700; line-height: 1.45; margin-bottom: 8px; word-break: keep-all; overflow-wrap: anywhere; }
#result-lead { margin-bottom: 20px; }
.prefs { margin: 4px 0 24px; }
.prefs-label { font-size: var(--step--1); font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tags li {
  border: 1.5px solid var(--peak); color: var(--peak); border-radius: 999px;
  padding: 2px 12px; font-size: var(--step--1); font-weight: 700; line-height: 1.7;
}
.tags-small { gap: 6px; margin-top: 6px; }
.tags-small li { border: 1px solid var(--rule); color: var(--muted); padding: 0 10px; font-weight: 500; }
.tracklist { list-style: none; padding: 0; margin: 0 0 16px; counter-reset: rank; }
.tracklist[start="6"] { counter-reset: rank 5; }
.track-item {
  counter-increment: rank; display: grid; grid-template-columns: 1.75rem 64px 1fr; gap: 0 12px; align-items: start;
  padding: 18px 0; border-top: 1px solid var(--rule);
}
.track-item::before {
  content: counter(rank); font-size: var(--step-2); font-weight: 700; line-height: 1.2;
  color: var(--blue); font-variant-numeric: tabular-nums;
}
.track-main { min-width: 0; }
.artwork {
  width: 64px; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--rule);
}
.artwork img { display: block; width: 100%; height: 100%; object-fit: cover; }
.track-item:first-child { grid-template-columns: 1.75rem 96px 1fr; }
.track-item:first-child .artwork { width: 96px; }
.tracklist[start="6"] .track-item:first-child { grid-template-columns: 1.75rem 64px 1fr; }
.tracklist[start="6"] .track-item:first-child .artwork { width: 64px; }
.track-title { font-size: var(--step-1); font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.track-meta { display: flex; flex-wrap: wrap; gap: 0 12px; color: var(--muted); font-size: var(--step--1); }
.labels { margin-top: 6px; color: var(--muted); font-size: var(--step--1); }
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; margin-top: 8px; }
.listen .btn { min-height: 40px; padding: 6px 14px; font-size: var(--step--1); margin-right: 4px; }
.listen a.svc {
  display: inline-flex; align-items: center; min-height: 40px; font-size: var(--step--1); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); text-decoration-thickness: 1.5px;
}
.listen a.svc:hover { color: var(--blue); text-decoration-color: var(--blue); }
.embed { position: relative; aspect-ratio: 16 / 9; margin-top: 12px; border-radius: 10px; overflow: hidden; background: #000; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 24px; }
.share-msg { color: var(--muted); font-size: var(--step--1); min-height: 1.75em; margin-top: 8px; overflow-wrap: anywhere; }
.loading { color: var(--muted); font-weight: 700; padding: 48px 0; }
.error { color: var(--peak); font-weight: 700; }

.site-footer { text-align: center; max-width: 640px; width: 100%; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: var(--step--1); line-height: 1.7; }
.site-footer .disclaimer { padding-top: 14px; border-top: 1px solid var(--rule); white-space: pre-line; }
.footer-link { font-size: var(--step--1); min-height: 40px; }

/* 管理者についてのモーダル */
.about {
  width: min(94vw, 560px); max-height: 88vh; overflow-y: auto; border: 0; border-radius: 14px; padding: 28px;
  background: var(--surface); color: var(--ink);
}
.about::backdrop { background: rgb(10 12 24 / .5); }
.about-title { font-size: var(--step-2); font-weight: 700; line-height: 1.45; margin: 0 0 14px; }
.about-notes { margin: 0 0 24px; padding-left: 1.25em; display: grid; gap: 10px; }
.about-notes li { white-space: pre-line; overflow-wrap: anywhere; }
.about-notes a, .about-contact a { color: var(--blue); text-underline-offset: 3px; }
.about-sub { font-size: var(--step-0); font-weight: 700; margin: 0 0 6px; padding-top: 18px; border-top: 1px solid var(--rule); }
.about-contact { list-style: none; margin: 12px 0 20px; padding: 0; display: grid; gap: 4px; font-weight: 700; }
.about-contact a { color: var(--blue); text-underline-offset: 3px; overflow-wrap: anywhere; }
.about form { display: flex; justify-content: flex-end; }

.hero-title, .q-text, .result-title { text-wrap: balance; }
.lead { text-wrap: pretty; }

@media (min-width: 560px) {
  .btn-large { display: flex; width: fit-content; margin-inline: auto; padding: 0 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
}

/* はじめの画面は全部中央揃え */
#view-start { text-align: center; }
#view-start .lead { margin-inline: auto; }
