/* 配色は3案。<html data-theme="rose|blue|amber"> で切り替える（build.py の THEME） */
:root {
  --paper: #100B12; --ink: #FBF1F5; --rose: #FF2E74; --violet: #FF9CBD; --muted: #AC97A4;
  --surface: #1D1421; --line: #362632;
  --cta-bg: #FF2E74; --cta-fg: #FFFFFF;
  --glow: radial-gradient(900px 420px at 12% -90px, rgba(255,46,116,.24), transparent 70%),
          radial-gradient(700px 380px at 92% -60px, rgba(151,71,255,.16), transparent 70%);
  --display: "Bricolage Grotesque", "Zen Kaku Gothic New", "IBM Plex Sans KR", system-ui, sans-serif;
  --body: "Zen Kaku Gothic New", "Bricolage Grotesque", system-ui, sans-serif;
  --sale: #FF4D5E;
  color-scheme: dark;
}
[data-theme="blue"] {
  --paper: #090E1C; --ink: #EEF3FF; --rose: #4FB4FF; --violet: #9CC8FF; --muted: #8E9BB8;
  --surface: #121A30; --line: #232E4A;
  --cta-bg: #3B82FF; --cta-fg: #FFFFFF;
  --glow: radial-gradient(900px 420px at 12% -90px, rgba(59,130,255,.26), transparent 70%),
          radial-gradient(700px 380px at 92% -60px, rgba(120,87,255,.18), transparent 70%);
}
[data-theme="amber"] {
  --paper: #110E09; --ink: #F8F1E3; --rose: #FFB02E; --violet: #FFD48A; --muted: #A99A82;
  --surface: #1C1710; --line: #352C1D;
  --cta-bg: #FFB02E; --cta-fg: #1A1204;
  --glow: radial-gradient(900px 420px at 12% -90px, rgba(255,176,46,.20), transparent 70%),
          radial-gradient(700px 380px at 92% -60px, rgba(255,92,46,.12), transparent 70%);
}
.lang-en { --body: "Bricolage Grotesque", system-ui, sans-serif; }
.lang-ko { --body: "IBM Plex Sans KR", "Bricolage Grotesque", system-ui, sans-serif;
           --display: "Bricolage Grotesque", "IBM Plex Sans KR", system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--paper); background-image: var(--glow); background-repeat: no-repeat; color: var(--ink); font-family: var(--body);
       font-size: 1rem; line-height: 1.75; word-break: normal; overflow-wrap: anywhere; }
.lang-ko, .lang-ko h1, .lang-ko h3 { word-break: keep-all; }
a { color: var(--violet); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 30; }

/* ヘッダー */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 18px 24px;
       max-width: 1200px; margin: 0 auto; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; gap: 20px; flex: 1; }
.nav a { color: var(--ink); text-decoration: none; font-size: 0.9375rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current] { border-bottom-color: var(--rose); }
.nav a:hover { border-bottom-color: var(--line); }
.langs { display: flex; gap: 4px; font-size: 0.875rem; }
.langs a { color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 999px; }
.langs a[aria-current] { background: var(--ink); color: var(--paper); }

main { margin: 0 auto; padding: 0 24px 72px; }
main.wide { max-width: 1200px; }
main.narrow { max-width: 720px; }

/* トップ */
.hero { padding: 56px 0 40px; max-width: 46rem; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 6.2vw, 4rem); line-height: 1.12;
     letter-spacing: -0.02em; margin: 0 0 20px; text-wrap: balance; }
.lang-ja h1 { font-family: var(--body); font-weight: 700; letter-spacing: 0; line-height: 1.25; }
.lead { font-size: 1.125rem; margin: 0 0 12px; max-width: 38rem; }
.stamp { color: var(--muted); font-size: 0.875rem; margin: 0; }
h2 { font-family: var(--display); font-weight: 600; font-size: 1.125rem; margin: 48px 0 0; padding-bottom: 12px;
     border-bottom: 2px solid var(--ink); }
.lang-ja h2 { font-family: var(--body); font-weight: 700; }

/* チャート：カードにせず、行で並べる。主役は順位の数字 */
.chart { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 28px;
       padding: 22px 0; border-bottom: 1px solid var(--line); }
.row.ranked { grid-template-columns: 5.5rem 1fr auto; }
.num { font-family: var(--display); font-weight: 800; font-size: 4.25rem; line-height: 0.9; color: var(--rose);
       letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.row.ranked:first-child { padding: 32px 0; }
.row.ranked:first-child .num { font-size: 6.5rem; }
.row.ranked:first-child h3 { font-size: 1.625rem; }
.row.ranked:first-child { grid-template-columns: 7.5rem 1fr auto; }
.row h3 { font-size: 1.1875rem; font-weight: 700; line-height: 1.45; margin: 0 0 4px; }
.lang-en .row h3 { font-weight: 600; }
.row h3 a { color: var(--ink); text-decoration: none; }
.row h3 a:hover { text-decoration: underline; text-decoration-color: var(--rose); text-decoration-thickness: 2px; }
.by { margin: 0; color: var(--muted); font-size: 0.875rem; }
.meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.meta > span + span { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.mf-short { display: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.price.on-sale { display: inline-flex; align-items: baseline; gap: 6px; position: relative; }
.price .was { color: var(--muted); font-size: 0.85em; text-decoration-thickness: 1px; }
.price .now { color: var(--sale); font-weight: 700; }
.meta .mf { color: var(--rose); font-weight: 700; }

.go { display: inline-block; background: var(--cta-bg); color: var(--cta-fg); text-decoration: none; font-weight: 700;
      font-size: 0.9375rem; padding: 11px 20px; border-radius: 10px; white-space: nowrap; text-align: center; }
.go:hover { filter: brightness(1.15); }
.go.big { font-size: 1.0625rem; padding: 15px 30px; margin-top: 8px; }

.fine { color: var(--muted); font-size: 0.875rem; margin: 20px 0 0; max-width: 40rem; }

/* 作品ページ */
.work { padding-top: 48px; }
.work h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); }
.mfline { color: var(--rose); font-weight: 700; margin: 0 0 10px; }
.desc { font-size: 1.125rem; margin: 0 0 28px; }
.facts { margin: 0 0 20px; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 8rem 1fr; padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.875rem; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 24px; }
.tags li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: 0.875rem; }

.work .go.big { margin: 0 0 28px; }
.work .facts { margin-top: 0; }
/* 自分のX投稿の埋め込み：PCは右の列、スマホはボタンのすぐ下 */
.work.has-x { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 0 56px; align-items: start; }
.x-label { color: var(--muted); font-size: 0.875rem; margin: 0 0 8px; }
.x-embed { min-height: 220px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
           display: grid; place-items: center; padding: 16px; }
.x-embed.loaded { border: 0; background: none; padding: 0; min-height: 0; display: block; }
.x-embed blockquote { margin: 0; }
.x-embed .twitter-tweet { margin: 0 !important; }
main.wide > section[aria-labelledby="s-others"] { max-width: 720px; }
@media (max-width: 900px) {
  .work.has-x { display: flex; flex-direction: column; align-items: stretch; }
  .work.has-x .work-main { display: contents; }
  .work.has-x .mfline { order: 1; } .work.has-x h1 { order: 2; } .work.has-x .desc { order: 3; }
  .work.has-x .go.big { order: 4; } .work.has-x .work-x { order: 5; margin-bottom: 28px; }
  .work.has-x .facts { order: 6; } .work.has-x .tags { order: 7; } .work.has-x .fine { order: 8; }
}

/* トップの埋め込み：スマホは行の下、PC（幅1000px以上）は右の固定枠 */
.row-x { grid-column: 1 / -1; width: 100%; max-width: 400px; margin-top: 4px; }
.x-panel { display: none; }
@media (min-width: 1000px) {
  .board { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 0 56px; align-items: start; }
  .board .row-x { display: none; }
  .x-panel { display: block; position: sticky; top: 16px; margin-top: 48px;
             max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; }
  .x-panel-title { margin: 0 0 12px; font-weight: 700; line-height: 1.45; min-height: 1.45em; }
  .x-stage .x-embed[hidden] { display: none; }
  .row { position: relative; }
  .row.is-active::before { content: ""; position: absolute; left: -16px; top: 22px; bottom: 22px; width: 3px;
                           border-radius: 2px; background: var(--rose); }
}
/* 埋め込みの四隅が白くなるのを防ぐ（ページがダーク指定だと iframe に白い下地が付くため） */
.x-embed iframe { color-scheme: light; border-radius: 13px; }
@media (max-width: 640px) { .row-x { max-width: none; } }

/* 読みものページ */
.prose { padding-top: 48px; }
.prose h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); }
.prose h2 { border-bottom: none; padding-bottom: 0; margin: 40px 0 8px; font-size: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 8px 0; }
.prose li { margin: 6px 0; }
.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2.5rem 1fr; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.steps li::before { content: counter(s); font-family: var(--display); font-weight: 800; font-size: 1.5rem; color: var(--rose); line-height: 1; }

.foot { max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px; color: var(--muted); font-size: 0.8125rem; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

/* 年齢確認 */
.gate { position: fixed; inset: 0; background: rgba(5, 3, 6, 0.92); display: grid; place-items: center; padding: 24px; z-index: 50; }
.gate[hidden] { display: none; }
.gate-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; max-width: 26rem; text-align: center; }
.gate-box h2 { border: none; margin: 0 0 8px; padding: 0; font-size: 1.5rem; }
.gate-box p { margin: 0 0 24px; }
.gate-box button { display: block; width: 100%; background: var(--cta-bg); color: var(--cta-fg); border: 0; border-radius: 10px;
                   font: inherit; font-weight: 700; padding: 14px; cursor: pointer; margin-bottom: 14px; }
.gate-box button:hover { filter: brightness(1.15); }
.gate-box a { color: var(--muted); font-size: 0.9375rem; }
body.gated { overflow: hidden; }

/* 入口 */
.pick { padding-top: 22vh; text-align: center; }
.langs.big { justify-content: center; font-size: 1.125rem; gap: 12px; }
.langs.big a { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 22px; }

@media (max-width: 640px) {
  .top { padding: 14px 16px; gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; gap: 18px; }
  .langs { margin-left: auto; }
  main { padding: 0 16px 56px; }
  .hero { padding: 32px 0 24px; }
  .row, .row.ranked, .row.ranked:first-child { grid-template-columns: 1fr; gap: 12px; }
  .row.ranked, .row.ranked:first-child { grid-template-columns: 3.25rem 1fr; }
  .row.ranked:first-child { grid-template-columns: 4.25rem 1fr; }
  .num { font-size: 3rem; align-self: start; }
  .row.ranked:first-child .num { font-size: 4.25rem; }
  .row.ranked:first-child h3 { font-size: 1.3125rem; }
  .row .go { grid-column: 1 / -1; }
  .go.big { display: block; }
  .facts div { grid-template-columns: 6.5rem 1fr; }
  .foot { padding: 20px 16px 40px; }
}
@media (prefers-reduced-motion: no-preference) {
  .go { transition: filter 120ms ease; }
}

/* ── スマホ・タブレット（幅999px以下）：カテゴリーの中は横スワイプのカードにする ── */
:root { --gut: 24px; }
@media (max-width: 640px) { :root { --gut: 16px; } }
.row-cover { display: none; }
@media (max-width: 999px) {
  .chart { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
           scroll-snap-type: x mandatory; scroll-padding-inline: var(--gut); scrollbar-width: none;
           margin: 16px calc(-1 * var(--gut)) 0; padding: 0 var(--gut) 8px; }
  .chart::-webkit-scrollbar { display: none; }
  .chart > .row, .chart > .row.ranked, .chart > .row.ranked:first-child {
    flex: 0 0 min(88vw, 400px); scroll-snap-align: start; display: grid; grid-template-columns: 1fr; gap: 12px;
    padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
  .chart > .row.ranked, .chart > .row.ranked:first-child { grid-template-columns: 3rem 1fr; }
  .chart > .row .num, .chart > .row.ranked:first-child .num { font-size: 3rem; align-self: start; }
  .chart > .row h3, .chart > .row.ranked:first-child h3 { font-size: 1.125rem; }
  /* 長さ・価格・順位をカードの横幅いっぱいに1行で並べる */
  .chart > .row.ranked .what { display: contents; }
  .chart > .row.ranked .num { grid-row: span 2; }
  .chart > .row.ranked h3, .chart > .row.ranked .by { grid-column: 2; }
  .chart > .row.ranked .by { margin-top: -8px; }
  .chart > .row .meta { grid-column: 1 / -1; flex-wrap: nowrap; white-space: nowrap; margin: 0;
                        font-size: clamp(0.75rem, 3.4vw, 0.875rem); }
  .chart > .row .meta > span + span { margin-left: 9px; padding-left: 9px; }
  .chart > .row .mf-long { display: none; }
  .chart > .row .mf-short { display: inline; }
  .chart > .row .go { grid-column: 1 / -1; }
  .chart > .row .row-x, .chart > .row .row-cover { grid-column: 1 / -1; max-width: none; margin: 0 -10px; width: auto; }
  .chart > .row .x-embed { background: var(--paper); }
  .chart > .row .x-embed.loaded { background: none; }
  .row-cover { display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden;
               aspect-ratio: 4 / 3; border-radius: 12px; padding: 16px;
               background: radial-gradient(120% 90% at 88% 8%, hsl(var(--h) 75% 48% / .6), transparent 62%),
                           linear-gradient(160deg, hsl(var(--h) 45% 21%), hsl(calc(var(--h) + 40) 50% 9%)); }
  .cv-time { position: absolute; top: 10px; left: 16px; font-family: var(--display); font-weight: 800;
             font-size: 2.5rem; letter-spacing: -0.03em; color: #fff; opacity: .22; }
  .cv-tag { font-family: var(--display); font-weight: 800; font-size: 1.75rem; line-height: 1.2; color: #fff; }
  .lang-ja .cv-tag { font-family: var(--body); font-weight: 700; }
  .cv-sub { font-size: 0.875rem; color: #fff; opacity: .78; }
}
