/* HIT DIAL — 机の上の古いラジオ。基準はスマホ 390×844（上 55% がラジオ・下 45% がシート・下の帯 56px）。 */
:root {
  --nav-h: 56px;
  --scene-h: 58dvh;
  --ctl-h: 124px;
  --ink: #2a1d14;
  --paper: #f7f0e1;
  --paper-2: #efe4cc;
  --accent: #d2452c;
  --accent-ink: #ffffff;
  --brass: #c9a25a;
  --wood-1: #8a5530;
  --wood-2: #5d3519;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  --room-light: rgba(255, 255, 255, 0.04);
  /* 表示窓（時代のモジュールが上書きする） */
  --win-bg: #05080a; --win-ink: #5ff7e4; --win-dim: #2fae9f; --win-glow: transparent; --win-font: monospace; --win-weight: 700; --win-tracking: 0; --win-radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: #1b130e; overflow: hidden; -webkit-tap-highlight-color: transparent; font-size: 16px; line-height: 1.55; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- 操作の帯の部品 ---- */
body.booting:not(.lit) #window { opacity: 0.25; }

.needle { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #d2241c; box-shadow: 0 0 6px rgba(210, 36, 28, 0.6); transform-origin: 50% 100%; }
.needle::before { content: ""; position: absolute; left: -5px; top: -2px; border: 6.5px solid transparent; border-top-color: #d2241c; }
body.tuned .needle { animation: wobble 0.5s ease-out; }
/* 思い出の日に着いた: 針が落ちるように、上から沈んで弾む */
body.landed .needle { animation: needle-drop 0.6s cubic-bezier(0.3, 0.7, 0.4, 1); }
@keyframes needle-drop { 0% { transform: translateY(-9px) scaleY(0.9); } 45% { transform: translateY(2px) scaleY(1.02); } 70% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes wobble { 0% { transform: rotate(0); } 25% { transform: rotate(4deg); } 55% { transform: rotate(-2.5deg); } 80% { transform: rotate(1deg); } 100% { transform: rotate(0); } }

/* ---- ピッチ ---- */

/* ---- 下の帯 ---- */

/* ---- 起動 ---- */
#boot { position: fixed; inset: 0; z-index: 40; }
.boot-dark { position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 30%, rgba(10, 7, 5, 0.55), rgba(6, 4, 3, 0.92)); }
.quiet #boot { display: none; }
.boot-panel { position: absolute; left: 0; right: 0; top: var(--scene-h); bottom: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px 18px; color: #f6e6c8; text-align: center; }
.boot-name { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: 0.08em; color: #ffd79a; text-shadow: 0 0 18px rgba(255, 170, 60, 0.45); }
.boot-lead { margin: 0; font-size: 16px; font-weight: 700; }
.boot-lead span { display: inline-block; }
.boot-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 6px; width: 100%; max-width: 360px; }
.boot-on { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
#start-sound, #start-reload, #start-memory { width: 100%; border-radius: 999px; font-weight: 900; }
#start-muted { min-height: 48px; padding: 0 24px; border: 2px solid rgba(246, 230, 200, 0.5); border-radius: 999px; background: transparent; color: #f6e6c8; font-weight: 800; }
.boot-ago { margin: 4px 0 0; font-size: 14px; color: #e8cfa6; max-width: 100%; }
/* 起動画面の言語の切り替え（相手の言語で「English」／「日本語」）: 画面の右上に常に見える小さな囲みのボタン（押せる高さ 44px）。
   起動の板の外に置くので、板の中の物は動かない。主のボタン（橙の塗り）より控えめに、塗りは暗く・枠は細く（PO 2026-11-27「起動画面に English を目立たせて 1 回で切り替えられるように」） */
.boot-lang { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); z-index: 52; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid rgba(246, 230, 200, 0.6); border-radius: 22px; background: rgba(20, 14, 9, 0.62); color: #f6e6c8; font-size: 15px; font-weight: 700; text-decoration: none; }
.boot-lang:hover { background: rgba(20, 14, 9, 0.8); border-color: #f6e6c8; }
.boot-lang:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
/* 「20 年前の今週の 1 位」を押すと、その週の部屋に入って鳴る（ボタンの形。主のボタンより控えめ） */
.boot-ago-go { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 6px 16px; border: 1px solid rgba(232, 207, 166, 0.55); border-radius: 999px; background: rgba(255, 236, 200, 0.08); color: #f6e6c8; font: inherit; font-size: 14px; line-height: 1.35; text-align: left; cursor: pointer; }
.boot-ago-go:hover { background: rgba(255, 236, 200, 0.16); }
.boot-ago-go:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
.boot-ago-play { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f2c76b; color: #2a1608; font-size: 11px; padding-left: 2px; box-sizing: border-box; }
#boot.leaving { opacity: 0; transition: opacity 0.45s; pointer-events: none; }

/* ---- ダイアログ・カード ---- */
#overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 6, 3, 0.7); display: flex; align-items: flex-end; justify-content: center; }
#dialog { position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--paper); border-radius: 18px 18px 0 0; padding: 16px 16px 22px; box-shadow: 0 -8px 30px rgba(0,0,0,0.5); }
#dialog h2 { margin: 0 48px 10px 0; font-size: 19px; line-height: 1.35; }
#dialog-close { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 24px; color: #6a5a4a; z-index: 2; }
#dialog p { margin: 6px 0; }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 12px); transform: translateX(-50%); z-index: 80; background: #2a1d14; color: #fff3df; padding: 10px 16px; border-radius: 12px; font-size: 16px; font-weight: 700; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity 0.2s; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
#toast.show { opacity: 1; }

/* ---- 広い画面（PC 1440×900）: ラジオは机の上の中央、シートは右の板 ---- */
@media (min-width: 900px) {
  #overlay { align-items: center; }
  #dialog { border-radius: 18px; max-height: 88dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  #window.tuning #win-noise { animation: none; }
}

/* ---- 起動: データより先に押された時 ---- */
body.starting .boot-buttons { opacity: 0.55; pointer-events: none; }

.boot-dark { background: radial-gradient(ellipse at 50% 35%, rgba(59,32,15,.34), rgba(6,4,3,.94) 76%); }
body.booting.lit .boot-dark { background: radial-gradient(ellipse at 50% 35%, rgba(151,85,33,.18), rgba(6,4,3,.94) 76%); }

/* ---- 直し（critic・user-lens） ---- */
/* 共有リンクで着いた後の大きなボタン: 操作の帯の下（世界を見てから触る順） */
/* 起動画面: 共有リンクで着いた時の主のボタン「生まれた日を入れる」・読めなかった時の「再読み込み」 */
/* 知らせの「もう一度」 */
#toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 10px; }
.toast-action { min-height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: var(--accent); color: #fff; font-weight: 800; }
/* カード: 画像を画面に収め、「閉じる」を下に留める（390×660 でも隠れない） */
/* 下の帯は流れる中身の外に置く（中身に重ねない）。ダイアログは「流れる中身＋下の帯」の縦並び */
#dialog { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
#dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 16px; }
#dialog .dialog-foot { flex: none; margin: 0; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(60, 40, 20, 0.15); }
/* 低い画面（360×600・320×568）: 回す枠を低く、ラジオを小さく、吹き出しを画面の中に */
@media (max-height: 620px) and (max-width: 899px) {
  #tape { height: 44px; }
}

/* ---- 画面の言葉の直しに合わせた形（B9・B17・B18・B19） ---- */
/* 音が入の時はボタンを塗る（入・切を字だけでなく形で） */

/* ---- ラジオの上端の帯（短い形・曲名だけ流れる）と、表示窓の名義（2 行まで） ---- */
.ago-label { flex: none; font-weight: 700; }
.ago-clip { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ago-clip.flow { text-overflow: clip; }
.ago-clip.flow .ago-title { display: inline-block; animation: ago-flow 2.4s ease-in-out 1s 2 alternate; /* 5 秒以内に止まる（MD-21） */ }
@keyframes ago-flow { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--over, 0px)); } }

.boot-panel { justify-content: flex-start; padding-top: 18px; gap: 8px; }
.boot-name { font-size: 22px; letter-spacing: 0.06em; }
.boot-lead { font-size: 16px; color: #f0dfc0; }
.boot-buttons { gap: 8px; margin-top: 4px; }
/* ボタンは控えめに（縁取り＋淡い面。押せる大きさ 44px 以上は保つ） */
#start-sound, #start-reload, body.arrived #start-memory { width: 100%; min-height: 48px; font-size: 16px; background: rgba(255, 178, 74, 0.26); border: 2px solid #ffb24a; color: #ffe2b0; box-shadow: 0 0 18px rgba(255, 170, 70, 0.55); }
/* 主はスイッチ（灯の光）。思い出の日は細い枠（PM 2026-11-28） */
#start-memory { width: auto; min-height: 44px; padding: 0 24px; font-size: 16px; background: transparent; border: 2px solid rgba(246, 230, 200, 0.5); color: #f6e6c8; font-weight: 800; box-shadow: none; }
#start-muted { min-height: 44px; font-size: 16px; }
/* 着いた後の大きなボタンも、赤一色をやめて縁取り＋淡い面 */
@media (min-width: 900px) {
  .boot-panel { justify-content: center; }
}

#ago-line.gone { visibility: hidden; }

/* ---- 狭い幅（320px 前後）: 表示窓の市場の表記を短く（JP）、電池の印と重ねない ---- */
@media (max-width: 340px) {
  #win-band .band-long { display: none; }
  #win-band .band-short { display: inline; }
  .win-meta { padding-right: 26px; }
}
/* ---- さらに狭い幅（200% ズーム相当）: はみ出さず折り返す ---- */
@media (max-width: 300px) {
  #arrival { white-space: normal; width: 100%; padding: 6px 12px; }
  .boot-buttons, #start-sound, #start-memory { white-space: normal; }
}

/* ---- 試聴（押した時だけ Apple に問い合わせる）: 表示窓の右下の外のボタン・再生中の印・ピッチが揺れる ---- */
/* 試聴の間は、表示窓の上の段の市場の表記の場所に「♪ 試聴中」 */

/* ==== 2026-11-23 作り直し（PO 承認「この方向で」review/redesign-v6/board.png）====
   上: 時代の絵（部屋と机の上の機械。14 枚）。表示窓のある機械には、今の曲の文字を時代の表示の見た目で重ねる。
   下: 時代の素材の操作盤（中身は全時代で同じ: 日付・目盛り・曲名と名前・思い出の日／さがす／おまかせ／音）。
   画面は 1 本の縦の列（最大 520px）。広い画面では、両脇に今の時代の絵をぼかして広げる。 */
:root { --col-w: min(100vw, 520px); --ctl-h: 290px; }
body { background: #15110d; }
#backdrop { position: fixed; inset: 0; display: none; overflow: hidden; }
#backdrop img { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(26px) brightness(0.62) saturate(1.08); }
@media (min-width: 560px) { #backdrop { display: block; } }
#stage { position: fixed; top: 0; bottom: 0; left: 50%; width: var(--col-w); transform: translateX(-50%); display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0, 0, 0, 0.45); }
#scene { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #2a2018; }
.era-img { position: absolute; left: 0; top: 0; width: 100%; height: auto; max-width: none; opacity: 0; transition: opacity 0.35s ease, filter 0.6s ease; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.era-img.on { opacity: 1; }
.era-img.now { transition: none; }
body.booting:not(.lit) .era-img { filter: brightness(0.4); }
/* 所作の絵（媒体の周りだけが替わる。同じカメラなので、上に重ねて切り替える） */
#era-act { z-index: 1; transition: none; }

/* 表示窓（絵の機械の画面に重ねる）。媒体の所（#media）より上に置く（押せないので下の媒体に押下は届く。媒体の揺れ・乗せた時の光の切り抜きで字を隠さない）。位置・歪み・色・書体・字の大きさは、絵ごとの値（scenes.js の DISPLAYS）を main.js が変数で渡す。
   窓の中は絵の画素の大きさの箱で組み、matrix3d で画面の 4 点へ写す（文字も同じ変換で斜めに乗る）。はみ出しは窓で切る */
#window { position: absolute; left: 0; top: 0; z-index: 3; overflow: hidden; pointer-events: none; transform-origin: 0 0; backface-visibility: hidden; border-radius: var(--win-radius, 3px); background: var(--win-bg); color: var(--win-ink); --dim: var(--win-dim); font-family: var(--win-font); text-shadow: var(--win-glow); letter-spacing: var(--win-track, 0); transition: opacity 0.18s; }
#window[data-kind="lcd"] { box-shadow: inset 0 0 6px rgba(40, 60, 20, 0.35); }
.win-text { position: relative; height: 100%; box-sizing: border-box; padding: var(--win-pad, 3px 6px); display: flex; flex-direction: column; justify-content: center; gap: 1px; transition: opacity 0.16s; }
#window[data-align="end"] .win-text { justify-content: flex-end; }
.win-text p { margin: 0; }
.win-meta { display: flex; justify-content: space-between; gap: 6px; font-size: var(--win-meta, 12px); line-height: 1.25; color: var(--dim); white-space: nowrap; overflow: hidden; flex: none; }
.win-meta span:first-child { overflow: hidden; text-overflow: ellipsis; }
#win-title { font-size: var(--win-title, 16px); font-weight: 800; line-height: 1.2; overflow: hidden; line-break: strict; display: -webkit-box; -webkit-line-clamp: var(--win-lines, 2); -webkit-box-orient: vertical; flex: none; }
#win-artist { font-size: var(--win-artist, 12px); line-height: 1.25; opacity: 0.9; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: var(--win-artist-lines, 1); -webkit-box-orient: vertical; flex: none; }
/* 1 行の窓: 曲名は 1 行。長い時は窓の中で横へ送る（main.js の flowTitle）。送らない時は … で切る */
#window[data-lines="one"] #win-title { display: block; white-space: nowrap; text-overflow: ellipsis; }
/* カタカナと英数の語は途中で折らない（main.js の titleSpan） */
#win-title .nb { white-space: nowrap; }
#window[data-lines="one"] #win-artist { display: block; white-space: nowrap; text-overflow: ellipsis; }
#window[data-lines="one"] #win-title.flow { text-overflow: clip; }
/* 窓に納まらない行は出さない（main.js の placeWindow が決める。1 行の窓の display: block より後に置く） */
#window[data-meta="off"] .win-meta, #window[data-artist="off"] #win-artist { display: none; }
/* 2 往復送ったら止める（流れ続けると気が散る。曲・時代が替わると main.js の flowTitle が最初から送り直す） */
#win-title.flow > span { display: inline-block; animation: win-flow var(--flow-s, 6s) ease-in-out 0.8s 4 alternate; }
@keyframes win-flow { 0%, 18% { transform: translateX(0); } 82%, 100% { transform: translateX(var(--over, 0px)); } }
#win-band .band-short { display: none; }
#win-playing { flex: none; font-weight: 800; }
body.previewing #win-band { display: none; }
#win-noise { position: absolute; inset: 0; opacity: 0; background-size: 160px 160px; mix-blend-mode: screen; transition: opacity 0.12s; }
#window.tuning #win-noise { opacity: 0.55; animation: noise 0.18s steps(4) infinite; }
#window.tuning .win-text { opacity: 0.35; filter: blur(0.6px); }
@keyframes noise { 0% { background-position: 0 0; } 25% { background-position: -40px 30px; } 50% { background-position: 50px -20px; } 75% { background-position: -20px -50px; } }
/* 着く瞬間の文（思い出の日）: 曲名の所に出す。日付の行は隠す */
#window.reveal .win-meta { visibility: hidden; }
/* 日付を伏せた思い出の日の流れ: 日付の数字をぼかす（表示窓の日付・操作盤の日付・目盛り） */
body.mask-dates .win-meta, body.mask-dates #pnl-date, body.mask-dates #tape-canvas, body.mask-dates #ov-labels { filter: blur(7px); }
/* 媒体を押した瞬間: 表示窓が消えて、次の曲で点く */
body.media-swap .win-text { opacity: 0; transition-duration: 0.12s; }
/* スマホの画面（絵の切り替えの無い時代）: 画面がめくれるように、表示窓が横へ流れて戻る */
body.media-swap #window[data-kind="screen"] .win-text { transform: translateX(-30%); transition: opacity 0.14s, transform 0.3s ease-in; }
#window[data-kind="screen"] .win-text { transition: opacity 0.2s, transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1); }

/* 音が切の時に試聴・媒体を押した: 窓の上に短く出し、「音」のボタンを軽く光らせる */
#mute-hint { position: absolute; z-index: 5; margin: 0; transform: translate(-50%, -50%); padding: 6px 14px; border-radius: 999px; background: rgba(20, 14, 10, 0.82); color: #ffe2b0; font-size: 15px; font-weight: 800; white-space: nowrap; pointer-events: none; }
#mute-hint[hidden] { display: none; }
#nav-sound.nudge { animation: nudge 0.9s ease-in-out 2; }
@keyframes nudge { 0%, 100% { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); } 50% { box-shadow: 0 0 0 4px var(--pn-accent), 0 0 18px var(--pn-accent); } }
@media (prefers-reduced-motion: reduce) { #nav-sound.nudge { animation: none; box-shadow: 0 0 0 3px var(--pn-accent); } }

/* 媒体の所（押せる透明のボタン。揺れの時だけ、同じ絵の切り抜きが小さく揺れる） */
#media { position: absolute; z-index: 2; padding: 0; border: 0; border-radius: 10px; background-color: transparent; background-repeat: no-repeat; cursor: pointer; }
#media.wiggle { background-image: var(--crop); animation: wiggle 0.9s cubic-bezier(0.3, 0.7, 0.4, 1); }
#media:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
/* PC で乗せた時: 枠は描かず、その部品（同じ絵の切り抜き）が少し光る。縁はぼかして絵になじませる */
@media (hover: hover) { #media:hover:not(.wiggle) { background-image: var(--crop); filter: brightness(1.16) saturate(1.08); -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent); mask-image: radial-gradient(closest-side, #000 72%, transparent); } }

/* 絵の中の押せる所（再生の印・送り・つまみ。main.js の placeHot）。押せる範囲（.hot）の中に、部品そのものの切り抜き（.hot-face） */
#hot { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hot { position: absolute; padding: 0; border: 0; border-radius: 10px; background: transparent; pointer-events: auto; cursor: pointer; }
.hot-face { position: absolute; background-repeat: no-repeat; opacity: 0; pointer-events: none; transition: opacity 0.15s; filter: brightness(1.4) saturate(1.1); -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent); mask-image: radial-gradient(closest-side, #000 70%, transparent); }
@media (hover: hover) { .hot:hover .hot-face { opacity: 1; } }
.hot:active .hot-face, .hot:focus-visible .hot-face, body.previewing .hot-play .hot-face { opacity: 1; }
.hot:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
/* つまみ: 切り抜きをいつも重ね、音量に合わせて回す（100 の時に絵と同じ向き） */
.hot-knob { cursor: grab; touch-action: none; }
.hot-knob .hot-face { opacity: 1; filter: none; border-radius: 50%; transform: rotate(calc((var(--vol, 100) - 100) * 2.7deg)); -webkit-mask-image: radial-gradient(circle closest-side, #000 94%, transparent); mask-image: radial-gradient(circle closest-side, #000 94%, transparent); transition: transform 0.08s; }
@media (hover: hover) { .hot-knob:hover .hot-face { filter: brightness(1.18); } }
body.booting .hot, body.media-swap .hot { pointer-events: none; }
/* 媒体の無い機械（無線スピーカー）: 音に合わせて膨らむように、小さく脈打つ */
body[data-scene="12"] #media.wiggle { animation: speaker-pulse 0.9s ease-out; }
@keyframes speaker-pulse { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.025); } 30% { transform: scale(0.99); } 45% { transform: scale(1.018); } 65% { transform: scale(0.995); } }
@keyframes wiggle { 0% { transform: translateY(0); } 18% { transform: translateY(3px) scale(0.985); } 40% { transform: translateY(-2px); } 62% { transform: translateY(1px); } 100% { transform: translateY(0); } }

/* 試聴が鳴っている間だけ、絵の右下に「Apple Music で聴く」（Apple の試聴の条件: 購入・配信の印の近くで鳴らす。操作盤の高さは変えない） */
.am-link { position: absolute; z-index: 5; right: 8px; bottom: 8px; display: inline-flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 2px 12px; border-radius: 14px; background: rgba(24, 16, 10, 0.78); color: #fff3df; font-size: 13px; font-weight: 700; line-height: 1.3; text-decoration: none; white-space: nowrap; }
.am-link[style*="left"] { right: auto; bottom: auto; }
.am-link .am-by { font-size: 12px; font-weight: 500; opacity: 0.85; }
.am-link.am-top { position: relative; inset: auto; align-self: flex-start; margin: 8px 12px 0; z-index: 3; }
.am-link[hidden] { display: none; }
.am-link .ext { font-size: 11px; opacity: 0.8; }
.am-link:focus-visible { outline: 3px solid #ffb547; outline-offset: 2px; }
/* 時代をまたいだ瞬間: 新しい部屋が置かれるように、上から小さく沈んで止まる（main.js の eraMoment）。表示窓の matrix3d と重ならないよう translate だけを動かす */
#scene.era-in .era-img.on, #scene.era-in #era-act, #scene.era-in #window, #scene.era-in #media, #scene.era-in #hot { animation: era-in 0.42s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes era-in { 0% { translate: 0 -7px; } 55% { translate: 0 1.5px; } 100% { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { #scene.era-in .era-img.on, #scene.era-in #era-act, #scene.era-in #window, #scene.era-in #media, #scene.era-in #hot { animation: none; } }
/* 20 年前の今週（絵の左上に小さく） */
#ago-line { position: absolute; z-index: 4; top: 8px; left: 8px; max-width: 70%; margin: 0; padding: 3px 9px; border-radius: 8px; background: rgba(24, 16, 10, 0.62); color: #f6e6c8; font-size: 14px; line-height: 1.35; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
#ago-line:empty { display: none; }
#ago-line.gone, body.booting #ago-line { visibility: hidden; }

/* ---- 下の操作盤（素材だけ時代で変わる。中身と並びは全時代で同じ） ---- */
#controls { flex: none; position: relative; z-index: 5; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--pn-bg); color: var(--pn-ink); box-shadow: inset 0 2px 0 var(--pn-edge), 0 -6px 16px rgba(0, 0, 0, 0.35); transition: color 0.4s; }
.pnl-date { margin: 0; text-align: center; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; color: var(--pn-sub); font-family: var(--pn-font, var(--font)); }
.ctl-tune { display: flex; align-items: center; gap: 2px; }
/* 音量の摘み（試聴の音だけに効く）: 日付の行の右端に、回す丸い摘み。色は操作盤の素材（--pn-*）に合わせる */
.pnl-head { position: relative; }
/* 日付の行（4・5 番）: 日付と国のボタンを、音量のつまみを除いた幅の中央に */
.pnl-row { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; margin: -8px 0 0; padding-right: 53px; }
.pnl-date { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnl-date[data-lines="2"] { white-space: pre-line; line-height: 1.25; }
.pnl-mk { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 5.7em; height: 26px; padding: 0 9px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: var(--pn-sub); font: 700 14px var(--pn-font, var(--font)); cursor: pointer; }
.pnl-mk::before { content: ''; position: absolute; inset: -11px -4px; }
.pnl-mk:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 「ほかの年 ›」（8 番） */
#boot-ago { display: flex; align-items: center; justify-content: center; gap: 6px; }
#boot-ago .boot-ago-go { min-width: 0; }
.more-years { position: relative; flex: none; min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#ago-line .more-years { min-height: 0; padding: 0 0 0 2px; }
#ago-line .more-years::before { content: ''; position: absolute; inset: -12px -9px; }
/* 背の低い画面: 起動の板を下へ（1 番） */
@media (max-width: 899px) { .boot-panel { top: auto; } }
.quiet body.booting #window { visibility: hidden; }
.vol { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 3px; height: 44px; padding: 0 6px; color: var(--pn-sub); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.vol[hidden] { display: none; }
.vol:active { cursor: grabbing; }
.vol svg { flex: none; }
.vol .vol-x { display: none; }
.vol.muted .vol-x { display: inline; }
.vol.muted .vol-w { display: none; }
.vol-cap { position: relative; width: 28px; height: 28px; border-radius: 50%; background: var(--pn-key); border: 1px solid var(--pn-key-edge); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3); transform: rotate(calc(var(--vol, 100) * 2.7deg - 135deg)); }
.vol-cap::after { content: ""; position: absolute; left: 50%; top: 3px; width: 3px; height: 10px; margin-left: -1.5px; border-radius: 2px; background: var(--pn-key-ink); }
.vol.muted .vol-cap::after { opacity: 0.45; }
.vol:focus-visible { outline: 3px solid var(--pn-accent); outline-offset: -2px; border-radius: 22px; }
.tape-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#tape { position: relative; height: 48px; border-radius: 8px; overflow: hidden; touch-action: none; cursor: grab; box-shadow: 0 0 0 2px var(--pn-dial-edge), inset 0 3px 8px rgba(0, 0, 0, 0.25); }
#overview { position: relative; height: 30px; touch-action: none; cursor: pointer; --pos: 0.5; }
#overview::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; }
.ov-track { position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 2px; background: var(--pn-edge); }
.ov-marker { position: absolute; top: 0; width: 4px; height: 12px; margin-left: -2px; left: calc(var(--pos) * 100%); background: #d2241c; border-radius: 2px; }
/* 全体の帯の年代の数字（1960…2020）。スマホでも出す */
@media (max-width: 340px) { #ov-labels:has(span:nth-child(7)) span { font-size: 12px; letter-spacing: -0.03em; } }
#ov-labels span { position: absolute; top: 14px; font-size: 14px; line-height: 1; color: var(--pn-sub); transform: translateX(-50%); pointer-events: none; font-variant-numeric: tabular-nums; }
#tape:active, #tape.grabbing { cursor: grabbing; }
#tape-canvas { width: 100%; height: 100%; display: block; }
.step { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--pn-sub); opacity: 0.8; }
.step:disabled { opacity: 0.3; }
/* 曲名の行: 左の空き（縮む）・題・つまみの場所。短い題は画面の軸で中央 */
.pnl-song::before, .pnl-song::after { content: ""; flex: 0 1000 56px; }
.pnl-song::after { flex-shrink: 0; }
.pnl-tx { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pnl-song { display: flex; align-items: center; justify-content: center; min-height: 56px; margin: 2px 0; padding: 6px 8px; border: 0; border-top: 1px solid var(--pn-rule); border-bottom: 1px solid var(--pn-rule); border-radius: 0; background: transparent; color: var(--pn-ink); text-align: center; }
/* シートの部品を待っている間（曲名を押した印。main.js の waitForSheet） */
.pnl-song[aria-busy="true"] { opacity: 0.55; cursor: progress; }
.pnl-title { font-size: 21px; font-weight: 900; line-height: 1.25; font-family: var(--pn-font, var(--font)); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pnl-artist { font-size: 16px; font-weight: 700; color: var(--pn-sub); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pnl-ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pnl-ops button { min-height: 48px; padding: 0 4px; border: 1px solid var(--pn-key-edge); border-radius: var(--pn-key-r, 8px); background: var(--pn-key); color: var(--pn-key-ink); font-size: 16px; font-weight: 800; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25); white-space: nowrap; }
.pnl-ops button:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.pnl-ops button[aria-pressed="true"] { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--pn-accent); transform: translateY(1px); }
#nav-sound { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
#nav-sound svg { flex: none; }
#nav-sound .snd-x { display: none; }
#nav-sound[aria-pressed="false"] .snd-x { display: inline; }
#nav-sound[aria-pressed="false"] .snd-w { display: none; }
#nav-sound[aria-pressed="false"] svg { opacity: 0.7; }
#nav-sound[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--pn-accent), 0 0 14px var(--pn-accent), inset 0 1px 0 rgba(255, 255, 255, 0.25); transform: none; }
#nav-sound[aria-pressed="true"] svg { color: var(--pn-accent); filter: drop-shadow(0 0 3px var(--pn-accent)); }
/* おまかせの再生中の点は、おまかせの間だけ（ラジオで鳴っている印は「音」のボタンの光） */
#nav-auto[aria-pressed="true"].playing::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--pn-accent); vertical-align: middle; }
#arrival { align-self: center; min-height: 48px; margin-top: 2px; padding: 0 24px; border: 2px solid var(--pn-accent); border-radius: 999px; background: transparent; color: var(--pn-ink); font-size: 16px; font-weight: 900; white-space: nowrap; }

/* 素材（14 の時代を 6 種に。見本: 木と真鍮／黒い樹脂／銀） */
body, body[data-panel="wood"] { --pn-bg: repeating-linear-gradient(92deg, rgba(0,0,0,0.06) 0 2px, rgba(255,255,255,0.03) 2px 7px), linear-gradient(180deg, #5d3519, #3a200f); --pn-edge: rgba(255, 214, 160, 0.28); --pn-ink: #f6e3bd; --pn-sub: #e2c58f; --pn-rule: rgba(226, 197, 143, 0.45); --pn-key: radial-gradient(circle at 40% 30%, #f1d48d, #b08537 70%); --pn-key-ink: #2a1608; --pn-key-edge: #6d4b1c; --pn-key-r: 22px; --pn-dial-edge: #c9a25a; --pn-accent: #f2c76b; --pn-font: "Hiragino Mincho ProN", "Yu Mincho", serif; }
body[data-panel="metal"] { --pn-bg: repeating-linear-gradient(90deg, #8f9499 0 1px, #9fa4a9 1px 3px), linear-gradient(180deg, #a9aeb3, #7d8287); --pn-edge: rgba(255, 255, 255, 0.5); --pn-ink: #16181b; --pn-sub: #2c3035; --pn-rule: rgba(20, 22, 25, 0.35); --pn-key: linear-gradient(180deg, #e4e6e8, #b9bdc1); --pn-key-ink: #1b1d20; --pn-key-edge: #6a6f74; --pn-key-r: 4px; --pn-dial-edge: #3a3d41; --pn-accent: #d0442a; --pn-font: var(--font); }
body[data-panel="black"] { --pn-bg: linear-gradient(180deg, #26292d, #141518); --pn-edge: rgba(255, 255, 255, 0.12); --pn-ink: #eee6d6; --pn-sub: #c9bfae; --pn-rule: rgba(255, 255, 255, 0.16); --pn-key: linear-gradient(180deg, #e2ddd2, #b7b1a5); --pn-key-ink: #1c1c1c; --pn-key-edge: #55524c; --pn-key-r: 5px; --pn-dial-edge: #0b0c0e; --pn-accent: #d63a2a; --pn-font: var(--font); }
body[data-panel="silver"] { --pn-bg: linear-gradient(180deg, #d6d9dc, #b3b7bb); --pn-edge: rgba(255, 255, 255, 0.85); --pn-ink: #1e2227; --pn-sub: #3b4148; --pn-rule: rgba(30, 34, 39, 0.25); --pn-key: linear-gradient(180deg, #f6f7f8, #d3d6d9); --pn-key-ink: #23272c; --pn-key-edge: #8d9298; --pn-key-r: 8px; --pn-dial-edge: #7f858b; --pn-accent: #3d7fd6; --pn-font: var(--font); }
body[data-panel="white"] { --pn-bg: linear-gradient(180deg, #f1f0ec, #dddcd6); --pn-edge: #ffffff; --pn-ink: #2a2a2a; --pn-sub: #55554f; --pn-rule: rgba(0, 0, 0, 0.14); --pn-key: linear-gradient(180deg, #ffffff, #ecebe6); --pn-key-ink: #2a2a2a; --pn-key-edge: #c2c1ba; --pn-key-r: 14px; --pn-dial-edge: #c2c1ba; --pn-accent: #e0702c; --pn-font: var(--font); }
body[data-panel="glass"] { --pn-bg: linear-gradient(180deg, #1d2027, #0f1115); --pn-edge: rgba(255, 255, 255, 0.14); --pn-ink: #f4f4f7; --pn-sub: rgba(244, 244, 247, 0.72); --pn-rule: rgba(255, 255, 255, 0.14); --pn-key: rgba(255, 255, 255, 0.1); --pn-key-ink: #f4f4f7; --pn-key-edge: rgba(255, 255, 255, 0.2); --pn-key-r: 12px; --pn-dial-edge: rgba(255, 255, 255, 0.25); --pn-accent: #8ab4ff; --pn-font: var(--font); }

/* ---- シート（曲名の所を押して開く） ---- */
#sheet.styling, #overlay.styling { opacity: 0; animation: none; }
#sheet { position: fixed; z-index: 30; left: 50%; bottom: 0; width: var(--col-w); max-height: 82dvh; transform: translateX(-50%); overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes sheet-up { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 起動: 上の絵はそのまま、下の操作盤の所に起動の案内 */
body.booting #controls { opacity: 0; pointer-events: none; }
body.booting #media { pointer-events: none; }
#boot { z-index: 46; }
.boot-panel { position: fixed; z-index: 50; left: 50%; bottom: 0; width: var(--col-w); min-height: max(var(--ctl-h), 250px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px)); color: #f6e6c8; text-align: center; background: linear-gradient(180deg, rgba(20, 14, 9, 0), rgba(20, 14, 9, 0.88) 22%); }
.boot-dark { background: radial-gradient(ellipse at 50% 30%, rgba(40, 22, 10, 0.25), rgba(6, 4, 3, 0.8) 80%); }
body.booting.lit .boot-dark { background: linear-gradient(180deg, rgba(6, 4, 3, 0.05), rgba(6, 4, 3, 0.1) 45%, rgba(6, 4, 3, 0.55)); }
#toast { bottom: calc(var(--ctl-h) + 12px); }
body.hide-dates #stage, body.hide-dates #sheet, body.hide-dates #backdrop { filter: blur(10px); }
@media (max-height: 640px) {
  #controls { gap: 4px; padding-top: 6px; }
  #tape { height: 44px; }
  .pnl-title { font-size: 18px; -webkit-line-clamp: 2; }
  .pnl-song { min-height: 86px; } /* 題 2 行＋名義 */
  .pnl-ops button { min-height: 44px; }
}
/* 狭い画面: 「Apple Music で聴く」の印は折り返して幅を狭く（絵の媒体の所に重ならないように） */
@media (max-width: 340px) { .pnl-ops { grid-template-columns: repeat(2, 1fr); gap: 6px; } .am-link { white-space: normal; max-width: 124px; } }
@media (max-width: 300px) { .pnl-ops { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { #win-title.flow > span { animation: none; } #sheet { animation: none; } #media.wiggle { animation: none; } .era-img { transition: none; } body.media-swap #window[data-kind="screen"] .win-text { transform: none; } }

/* ---- 横長の配置（幅 1024px 以上。PO「パソコン版の画面」）: 左に時代の部屋の絵（縦いっぱい・縦横比を保つ。足りない左右はぼかした同じ絵）、右に操作盤の列 ----
   幅 481〜1023px は縦の列（最大 520px）、PC の端の細い窓（360〜480px）とスマホは今のまま */
@media (min-width: 1024px) {
  /* 右の列は広めに（部品を大きく）、左の絵の両脇のぼけの余りを減らす */
  :root { --side-w: clamp(420px, 36vw, 560px); }
  #backdrop { display: block; right: var(--side-w); }
  #stage { left: 0; right: 0; width: auto; transform: none; flex-direction: row; box-shadow: none; }
  #scene { flex: 1 1 auto; background: transparent; }
  /* 絵の左右の縁は、ぼかした同じ絵へなじませる */
  .era-img { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%); }
  /* 縦に配る（上下に空きを溜めない）。日付と曲名を大きく */
  #controls { flex: 0 0 var(--side-w); width: var(--side-w); justify-content: space-evenly; gap: 12px; padding: 36px 36px calc(36px + env(safe-area-inset-bottom, 0px)); box-shadow: inset 2px 0 0 var(--pn-edge), -10px 0 30px rgba(0, 0, 0, 0.4); }
  .pnl-date { font-size: 22px; }
  #tape { height: 72px; }
  .pnl-song { min-height: 150px; padding: 18px 8px; }
  .pnl-song::before, .pnl-song::after { flex-basis: 70px; }
  .pnl-tx { gap: 8px; }
  .pnl-title { font-size: 40px; -webkit-line-clamp: 4; }
  .pnl-artist { font-size: 20px; -webkit-line-clamp: 2; }
  .pnl-ops { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .pnl-ops button { min-height: 64px; font-size: 18px; }
  #arrival { align-self: stretch; }
  #sheet { left: auto; right: 0; top: 0; bottom: 0; width: var(--side-w); max-height: none; transform: none; border-radius: 0; animation: sheet-side 0.24s cubic-bezier(0.2, 0.8, 0.3, 1); }
  @keyframes sheet-side { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  .boot-panel { left: auto; right: 0; top: 0; bottom: 0; width: var(--side-w); height: auto; min-height: 0; transform: none; background: rgba(20, 14, 9, 0.9); }
  #toast { left: calc((100vw - var(--side-w)) / 2); bottom: 24px; }
}
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) { #sheet { animation: none; } }
