/* トップページのヒーロー（scripts/hero.mjs）。クラスは hx- で始める */
.hx {
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --hx-paper: color-mix(in srgb, var(--gold) 7%, var(--bg));
  position: relative; overflow: clip; isolation: isolate;
  padding: 26px 0 34px;
  background:
    radial-gradient(1100px 520px at 88% -8%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 68%),
    radial-gradient(800px 460px at -12% 108%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%),
    var(--hx-paper);
  border-bottom: 1px solid var(--line);
}
.hx-glow { position: absolute; inset: auto -10% -30% 40%; height: 70%; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 14%, transparent), transparent); filter: blur(10px); pointer-events: none; }
.hx-in { display: grid; gap: 28px; align-items: center; }

/* ── タイトル ── */
.hx-h1 { margin: 0 0 18px; font-weight: 400; line-height: 1; letter-spacing: 0; }
.hx-pre { display: flex; align-items: center; gap: 12px; font-family: var(--mincho); font-weight: 600; font-size: clamp(15px, 4.2vw, 19px); letter-spacing: .32em; color: var(--brand-d); margin: 0 0 12px; }
.hx-pre::before { content: ""; width: 34px; height: 1px; background: currentColor; opacity: .7; }
.hx-name { display: block; font-family: var(--mincho); font-weight: 800; font-size: clamp(50px, 15.2vw, 96px); line-height: 1.08; letter-spacing: .04em; color: var(--ink); white-space: nowrap; font-feature-settings: "palt" 1; margin-left: -.04em; }
.hx-name-b { position: relative; display: inline-block; }
.hx-name-b::after { content: ""; position: absolute; left: .06em; right: .02em; bottom: .02em; height: .06em; min-height: 3px; background: linear-gradient(90deg, var(--gold), color-mix(in srgb, var(--gold) 30%, transparent)); border-radius: 2px; transform-origin: left; animation: hx-line 1.2s .5s cubic-bezier(.6, 0, .2, 1) both; }
@keyframes hx-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hx-sub { display: block; margin-top: 18px; font-family: var(--jp); font-weight: 800; font-size: clamp(18px, 5vw, 25px); line-height: 1.55; letter-spacing: .04em; color: var(--ink); }
.hx-sub > span { display: inline-block; white-space: nowrap; }
.hx-lead { font-size: 15px; line-height: 1.95; color: var(--ink2); margin: 0 0 22px; max-width: 34em; }
.hx-cta { display: grid; gap: 10px; }
.hx-btn { min-height: 52px; }
@media (min-width: 560px) { .hx-cta { display: flex; flex-wrap: wrap; } }

/* 数字の列 */
.hx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--line); }
.hx-stats > div { padding: 12px 8px 4px 0; border-bottom: 1px solid var(--line); }
.hx-stats dt { font-size: 11.5px; font-weight: 700; color: var(--ink3); letter-spacing: .06em; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-stats dd { margin: 2px 0 0; display: flex; align-items: baseline; gap: 3px; line-height: 1.1; }
.hx-num { font-family: var(--en); font-weight: 700; font-size: clamp(24px, 6.6vw, 32px); letter-spacing: -.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hx-stats small { font-size: 12px; font-weight: 700; color: var(--ink2); }
.hx-free { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 16px 0 0; font-size: 13.5px; font-weight: 800; color: var(--ink2); letter-spacing: .04em; }
.hx-free .ic { width: 18px; height: 18px; color: var(--ok); stroke-width: 2.6; margin-right: 6px; }
.hx-free span + span::before { content: "・"; color: var(--ink3); margin: 0 .2em; }

/* ── 動く絵 ── */
.hx-visual { min-width: 0; }
.hx-stage {
  position: relative; aspect-ratio: 3 / 2; border-radius: 22px; overflow: hidden; container-type: inline-size;
  background: #f3e3c8; box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 18px 50px -18px rgba(70, 40, 10, .35), 0 4px 14px rgba(70, 40, 10, .08);
  --mx: 0; --my: 0; --sy: 0; transform: translateZ(0);
}
.hx-stage::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(120, 80, 30, .14), inset 0 -40px 60px -30px rgba(60, 30, 5, .18); pointer-events: none; z-index: 9; }
.hx-layer { position: absolute; will-change: transform; transform: translate3d(calc(var(--mx) * var(--d) * 1cqw), calc(var(--my) * var(--d) * .7cqw + var(--sy) * var(--d) * -1.4cqw), 0); }
.hx-layer img { display: block; width: 100%; height: auto; max-width: none; user-select: none; -webkit-user-drag: none; }
.hx-room { --d: .5; inset: -4% -4% -4% -4%; }
.hx-room .hx-img-room { width: 100%; height: 100%; object-fit: cover; }
.hx-people { --d: 1.1; left: -3%; width: 106%; bottom: -1.5%; }
.hx-owl { --d: 1.8; right: 1.5%; bottom: 20.5%; width: 25%; }
.hx-front { --d: 2.8; inset: 0; pointer-events: none; }
.hx-board { --d: 1.4; top: 4.5%; right: 3.5%; left: 40%; display: flex; justify-content: flex-end; }

/* 窓の光 */
.hx-rays { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; overflow: hidden; }
.hx-rays i { position: absolute; top: -20%; left: 2%; width: 16%; height: 150%; background: linear-gradient(180deg, rgba(255, 236, 190, .0), rgba(255, 236, 190, .55) 30%, rgba(255, 230, 175, .0) 85%); transform-origin: top left; transform: rotate(-32deg); filter: blur(10px); opacity: .5; animation: hx-ray 9s ease-in-out infinite alternate; }
.hx-rays i:nth-child(2) { left: 14%; width: 9%; animation-duration: 7s; animation-delay: -3s; }
.hx-rays i:nth-child(3) { left: 24%; width: 13%; animation-duration: 11s; animation-delay: -6s; opacity: .35; }
@keyframes hx-ray { 0% { opacity: .25; translate: 0 0; } 100% { opacity: .7; translate: 2% 0; } }

/* ほこりの粒 */
.hx-dust i { position: absolute; left: var(--x); top: var(--y); width: calc(var(--s) * .32cqw); height: calc(var(--s) * .32cqw); min-width: 2px; min-height: 2px; border-radius: 50%; background: radial-gradient(circle, #fffbe8 0 35%, rgba(255, 240, 200, .0) 70%); box-shadow: 0 0 6px rgba(255, 236, 180, .9); opacity: 0; animation: hx-dust 14s linear infinite; animation-delay: calc(var(--t) * -1.3s); }
@keyframes hx-dust { 0% { opacity: 0; transform: translate(0, 0); } 15% { opacity: .95; } 50% { transform: translate(2.2cqw, -2.6cqw); } 85% { opacity: .8; } 100% { opacity: 0; transform: translate(4cqw, -1cqw); } }

/* ふくろう先生：小さな上下とまばたき */
.hx-owl-in { position: relative; transform-origin: 50% 100%; animation: hx-bob 4.2s ease-in-out infinite; }
@keyframes hx-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2.2%) rotate(-1.2deg); } }
.hx-lid { position: absolute; width: 12.2%; height: 12.4%; border-radius: 50%; overflow: hidden; pointer-events: none; }
.hx-lid-l { left: 38.1%; top: 23.9%; }
.hx-lid-r { left: 59.1%; top: 28%; transform: rotate(6deg); }
.hx-lid::before { content: ""; position: absolute; inset: -6%; border-radius: 0 0 50% 50% / 0 0 46% 46%; background: #f6e5c6; box-shadow: inset 0 -2px 0 #7a4a24, inset 0 -3.5px 0 rgba(122, 74, 36, .35); transform: translateY(-104%); animation: hx-blink 5.6s infinite; }
.hx-lid-r::before { animation-delay: .02s; }
.hx-lid::after { content: ""; position: absolute; left: 18%; width: 64%; top: 36%; height: 26%; border-bottom: max(1.5px, .5cqw) solid #6b3f1d; border-radius: 0 0 50% 50% / 0 0 100% 100%; opacity: 0; animation: hx-lash 5.6s infinite; }
@keyframes hx-lash { 0%, 91.5%, 96%, 100% { opacity: 0; } 92.5%, 95% { opacity: 1; } }
@keyframes hx-blink { 0%, 90%, 100% { transform: translateY(-104%); } 93%, 94.5% { transform: translateY(-3%); } }

/* 手前の物 */
.hx-front > img, .hx-mug { position: absolute; }
.hx-front .hx-books { left: 37%; bottom: -1.5%; width: 15%; }
.hx-front .hx-plant { left: -2.5%; bottom: -5%; width: 18%; }
.hx-mug { left: 55%; bottom: 1%; width: 9%; }
.hx-steam { position: absolute; left: 6%; bottom: 84%; width: 80%; height: auto; overflow: visible; fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 3.2; stroke-linecap: round; filter: blur(.6px); }
.hx-steam path { opacity: 0; animation: hx-steam 4.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.hx-steam path:nth-child(2) { animation-delay: -1.4s; }
.hx-steam path:nth-child(3) { animation-delay: -2.8s; }
@keyframes hx-steam { 0% { opacity: 0; transform: translateY(18%) scaleY(.7); } 30% { opacity: .75; } 100% { opacity: 0; transform: translateY(-34%) scaleY(1.05) scaleX(1.25); } }

/* 英語の札 */
.hx-panel { position: relative; max-width: 100%; padding: 1.2cqw 1.6cqw 1.5cqw; border-radius: 1.8cqw; background: color-mix(in srgb, #fffdf8 74%, transparent); -webkit-backdrop-filter: blur(6px) saturate(1.1); backdrop-filter: blur(6px) saturate(1.1); box-shadow: 0 .6cqw 2.4cqw rgba(70, 40, 10, .16), inset 0 0 0 1px rgba(255, 255, 255, .7); }
.hx-note { margin: 0 0 1.5cqw; font-size: clamp(9.5px, 1.75cqw, 14px); font-weight: 800; color: #6b5a44; letter-spacing: .04em; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .3s; }
.hx-note.is-out { opacity: 0; }
.hx-sent { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9cqw .7cqw; margin: 0; min-height: 5.6cqw; }
.hx-card { --c: var(--N); position: relative; display: inline-flex; align-items: center; padding: .55cqw 1.15cqw .5cqw; border-radius: .9cqw; background: #fff; border: max(1px, .2cqw) solid color-mix(in srgb, var(--c) 60%, #fff); box-shadow: 0 .35cqw 0 color-mix(in srgb, var(--c) 28%, #fff); color: #1c2333; will-change: transform; }
.hx-card b { font-family: var(--en); font-weight: 700; font-size: clamp(12px, 2.9cqw, 24px); line-height: 1.25; white-space: nowrap; }
.hx-card i { position: absolute; top: -1.05cqw; left: .8cqw; font: 800 clamp(7.5px, 1.25cqw, 10.5px)/1 var(--en); font-style: normal; color: #fff; background: var(--c); padding: .2cqw .5cqw; border-radius: 99px; letter-spacing: .02em; }
.hx-card[data-r="S"] { --c: #2563c9; } .hx-card[data-r="V"] { --c: #d43d3d; } .hx-card[data-r="O"] { --c: #2b8a3e; } .hx-card[data-r="C"] { --c: #c77700; } .hx-card[data-r="M"] { --c: #7a6a94; }
.hx-card[data-r="A"] { --c: #d43d3d; border-style: dashed; }
.hx-card.is-new b { animation: hx-pop .7s .25s both; }
@keyframes hx-pop { 0% { color: #1c2333; } 40% { color: var(--c); } 100% { color: #1c2333; } }
.hx-p { font: 700 clamp(13px, 3cqw, 25px)/1.3 var(--en); color: #1c2333; margin-left: -.3cqw; padding-bottom: .4cqw; }

/* 色の見方（絵の下） */
.hx-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; margin: 12px 0 0; font-size: 12px; font-weight: 700; color: var(--ink3); }
.hx-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hx-legend i { font: 800 10.5px/1 var(--en); font-style: normal; color: #fff; padding: 3px 6px; border-radius: 99px; background: var(--c); }
.hx-legend [data-r="S"] { --c: var(--S); } .hx-legend [data-r="V"] { --c: var(--V); } .hx-legend [data-r="O"] { --c: var(--O); } .hx-legend [data-r="C"] { --c: var(--C); } .hx-legend [data-r="M"] { --c: var(--M); }

/* 一時停止（画面の外・タブが裏） */
.hx.is-paused *, .hx.is-paused *::before, .hx.is-paused *::after { animation-play-state: paused !important; }

/* ── PC ── */
@media (min-width: 600px) { .hx-lead { font-size: 16px; } }
@media (min-width: 960px) {
  .hx { padding: 56px 0 60px; }
  .hx-in { grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); gap: 52px; }
  .hx-stage { border-radius: 28px; }
  .hx-stats { grid-template-columns: repeat(3, 1fr); }
  .hx-name { font-size: clamp(54px, 6.3vw, 92px); }
}
@media (min-width: 1200px) { .hx-in { gap: 64px; } }
@media (min-width: 700px) { .hx-board { left: 36%; } .hx-card b { font-size: clamp(12px, 3.3cqw, 26px); } .hx-p { font-size: clamp(13px, 3.4cqw, 27px); } .hx-note { font-size: clamp(9.5px, 1.9cqw, 15px); } }

/* ── ダークモード ── */
:root[data-theme="dark"] .hx { --hx-paper: #12161f; }
:root[data-theme="dark"] .hx-stage { background: #2a2016; box-shadow: 0 0 0 1px rgba(242, 189, 75, .18), 0 24px 60px -20px rgba(0, 0, 0, .8); }
:root[data-theme="dark"] .hx-stage::after { box-shadow: inset 0 0 0 1px rgba(255, 220, 160, .08), inset 0 -60px 80px -40px rgba(0, 0, 0, .45); background: linear-gradient(180deg, rgba(18, 22, 31, .10), rgba(18, 22, 31, .22)); }
:root[data-theme="dark"] .hx-layer img { filter: brightness(.9) saturate(.95); }
:root[data-theme="dark"] .hx-panel { background: rgba(255, 252, 244, .86); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hx { --hx-paper: #12161f; }
  :root:not([data-theme="light"]) .hx-stage { background: #2a2016; box-shadow: 0 0 0 1px rgba(242, 189, 75, .18), 0 24px 60px -20px rgba(0, 0, 0, .8); }
  :root:not([data-theme="light"]) .hx-stage::after { box-shadow: inset 0 0 0 1px rgba(255, 220, 160, .08), inset 0 -60px 80px -40px rgba(0, 0, 0, .45); background: linear-gradient(180deg, rgba(18, 22, 31, .10), rgba(18, 22, 31, .22)); }
  :root:not([data-theme="light"]) .hx-layer img { filter: brightness(.9) saturate(.95); }
  :root:not([data-theme="light"]) .hx-panel { background: rgba(255, 252, 244, .86); }
}

/* ── 動きを減らす設定 ── */
@media (prefers-reduced-motion: reduce) {
  .hx *, .hx *::before, .hx *::after { animation: none !important; transition: none !important; }
  .hx-layer { transform: none !important; }
  .hx-dust, .hx-steam { display: none; }
  .hx-lid::before { transform: translateY(-104%); }
}






