/* 主、結果、探す側（ux C） */
#panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; color: var(--ink); text-align: center; }
#panel.full { top: 44px; }
#panel h2 { font-size: 20px; line-height: 1.25; }
#panel button { font-size: 14px; line-height: 1.25; padding: 4px 10px; }
#panel button.quiet { background: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }
#panel .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#panel .actions.big > button { flex: 1 1 0; min-height: 50px; font-size: 15px; font-weight: 700; border: 2px solid var(--main); }
#panel .actions.small { gap: 6px; }
#panel .actions.small > button { background: #E4D6BB; box-shadow: none; font-size: 13px; }
#panel .actions.small > button.quiet { background: transparent; }
#panel textarea { width: 100%; font: inherit; font-size: 13px; padding: 8px; border-radius: 8px; border: 2px solid var(--ink); background: #FFFDF6; color: var(--ink); user-select: text; -webkit-user-select: text; resize: none; word-break: break-all; }

/* 結果の画面 */
#panel[data-screen="result"] { display: flex; flex-direction: column; background: var(--desk); }
.eye { position: relative; flex: 1 1 0; min-height: 150px; overflow: hidden; }
.eye-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.eye-cap { position: absolute; left: 8px; top: 8px; max-width: calc(100% - 176px); line-height: 1.35; padding: 4px 10px; border-radius: 8px; background: #1B100BD0; color: var(--paper); font-size: 12px; font-weight: 700; pointer-events: none; word-break: keep-all; overflow-wrap: anywhere; }
/* 人形は絵の真ん中に立つので、見出しは左上、ボタンは右下の空きに置く */
.eye .eye-cap { max-width: calc(50% - 46px); }
#panel .eye button { position: absolute; right: 6px; bottom: 6px; max-width: calc(50% - 44px); padding: 4px 8px; font-size: 12px; min-height: 44px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#panel .eye button.on { background: #FFE45C; }
.result-card, .share-card { position: relative; flex: none; display: flex; flex-direction: column; gap: 7px; background: var(--paper); border-radius: 16px 16px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px #0007; max-height: 74%; overflow-y: auto; }
#panel .headline { font-size: 23px; font-weight: 900; }
#panel .headline.found { color: #A63E1C; }
#panel .headline.passed { color: #2F6B52; }
.titles { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 2px 8px; }
.title-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.title-why { font-size: 11px; line-height: 1.3; opacity: .85; }
.title-tag { background: #FFE9A6; border: 1.5px solid var(--ink); border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 800; transform: rotate(-1.5deg); }
.meter { display: flex; align-items: center; gap: 8px; text-align: left; }
.meter-main { flex: 1; min-width: 0; }
.meter-row { display: flex; align-items: baseline; gap: 8px; }
.meter-row .label { font-size: 12px; font-weight: 700; }
.meter-row .num { font-size: 38px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.meter-row .best { margin-left: auto; font-size: 11px; opacity: .8; }
.bar { position: relative; height: 12px; margin: 3px 2px 16px; border-radius: 6px; background: #D5C4A3; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: var(--main); }
.bar .mark { position: absolute; top: -2px; width: 2px; height: 16px; background: #35271F80; }
.bar .mark small { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); font-size: 10px; }
.bar .mark.now { top: -5px; width: 4px; height: 22px; margin-left: -1px; background: var(--ink); }
.bar .mark.now small { top: 21px; font-weight: 900; font-size: 11px; }
.meter .need { font-size: 11px; margin-top: 2px; }
.result-card .line { font-size: 15px; font-weight: 800; line-height: 1.4; text-wrap: balance; }
.unlock { background: #CFE3C8; border-radius: 8px; padding: 4px 8px; font-size: 13px; font-weight: 800; }

/* 3人の主の並び: やりすごした主に印、今の主を強く、まだの主を薄く */
.seekers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.seeker-chip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 2px 2px; border: 2px solid transparent; border-radius: 10px; min-width: 0; }
.seeker-chip.now { background: #FFFDF6; border-color: var(--ink); }
.seeker-chip.later > :not(i) { opacity: .55; }
.seeker-chip-face { width: 35px; }
.seeker-chip.now .seeker-chip-face { width: 42px; }
.seeker-chip-face svg { display: block; width: 100%; height: auto; overflow: visible; }
.seeker-chip-name { display: flex; flex-direction: column; font-size: 11px; line-height: 1.25; font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.seeker-chip.now .seeker-chip-name { font-weight: 900; }
.seeker-chip-name small { font-size: 10px; font-weight: 700; }
/* 印は緑の丸に白のチェック（字は読み上げ用） */
.seeker-chip-done { position: absolute; right: 4px; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: #2F6B52; border: 2px solid var(--paper); font-size: 0; }
.seeker-chip-done::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #FFFDF6; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.meter .need.cleared { font-size: 12px; font-weight: 900; color: #2F6B52; }
.result-card .tip { font-size: 12px; line-height: 1.4; background: #FFE9A6; border-radius: 8px; padding: 4px 8px; text-wrap: balance; }
.next-note { font-size: 11px; margin-top: -3px; opacity: .85; text-wrap: balance; }
#panel button.done { background: #CFE3C8; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* 送る札 */
.share-card { gap: 9px; }
.share-text { background: #FFFDF6; border-radius: 10px; padding: 9px 12px; font-size: 15px; font-weight: 700; line-height: 1.45; }
.share-note { font-size: 12px; opacity: .8; white-space: pre-line; }
.share-actions { display: flex; gap: 8px; }
#panel .share-actions button { flex: 1; min-height: 52px; font-size: 16px; }
#panel .share-actions button:not(.main) { border: 2px solid var(--ink); }
.share-status:empty { display: none; }
/* 読み上げ用の1行だけの時は場所を取らない（下のボタンが動かない） */
.share-status:has(> .sr-only) { position: absolute; }
.copied { font-size: 15px; font-weight: 800; color: #2F6B52; }
.hint { font-size: 12px; margin-top: 4px; }

/* 探す側: 入口と壊れたリンク */
.seek-veil { position: absolute; inset: 0 0 0 0; display: flex; align-items: center; justify-content: center; padding: 20px; cursor: pointer; }
.paper-card { width: min(100%, 320px); display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--paper); border-radius: 16px; padding: 18px 18px 14px; box-shadow: 0 6px 0 #0005, 0 12px 30px #0007; cursor: default; }
.doll-icon { width: 62px; height: 100px; background: #8E7766; border-radius: 12px; padding: 6px; }
.paper-card .lead { font-size: 18px; font-weight: 900; line-height: 1.45; text-wrap: balance; }
.paper-card .sub { font-size: 14px; }
.paper-card .fine { font-size: 12px; opacity: .75; }
#panel .paper-card button.main { align-self: stretch; min-height: 56px; font-size: 20px; }
#panel[data-screen="broken"] { background: var(--desk); }

/* 探している間: 上の帯の時計と、下の1段 */
.seek-top { position: absolute; left: 62px; right: 104px; top: 0; height: 44px; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--paper); pointer-events: none; white-space: nowrap; }
.seek-clock { font-size: 22px; font-variant-numeric: tabular-nums; }
.seek-misses { font-size: 13px; }
.seek-plus { font-style: normal; font-weight: 900; color: #FFD93D; width: 22px; opacity: 0; }
.seek-plus.on { opacity: 1; animation: seek-plus 1s ease-out; }
@keyframes seek-plus { from { transform: translateY(8px); } to { transform: translateY(-3px); } }
#panel[data-screen="seek"] { height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--desk); }
.seek-note { color: var(--paper); font-size: 13px; min-height: 20px; }
#panel button.give { min-width: 160px; }
#panel button.give.locked { opacity: .45; }

/* 探した結果: 札は人形の反対側へ */
#panel[data-screen="seekResult"] { display: flex; justify-content: center; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); pointer-events: none; }
#panel[data-screen="seekResult"] > * { pointer-events: auto; }
#panel[data-screen="seekResult"].high { bottom: auto; top: 48px; }
.seek-banner { align-self: center; margin-bottom: 30px; background: var(--paper); border-radius: 999px; padding: 10px 26px; font-size: 24px; font-weight: 900; box-shadow: 0 4px 0 #0006; animation: pop .35s cubic-bezier(.2, 1.7, .5, 1); }
.seek-banner.gave { font-size: 18px; }
.seek-card { width: min(100%, 440px); display: flex; flex-direction: column; gap: 7px; background: var(--paper); border-radius: 16px; padding: 10px 12px; box-shadow: 0 4px 18px #0008; }
.seek-score { display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.seek-score .big { font-size: 38px; line-height: 1; font-weight: 900; }
.seek-card .line { font-size: 15px; font-weight: 800; }

/* 主 */
.seeker-intro { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; }
.seeker-intro[hidden] { display: none; }
.seeker-intro-card { width: min(78%, 280px); display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 14px 12px 12px; box-shadow: 0 6px 0 #0005, 0 12px 30px #0007; text-align: center; animation: pop .25s cubic-bezier(.2, 1.7, .5, 1); }
.seeker-intro-card svg { width: 196px; max-width: 100%; height: auto; overflow: visible; }
.seeker-intro-card p { font-size: 18px; font-weight: 900; line-height: 1.35; white-space: pre-line; text-wrap: balance; }
.seeker-intro-card small { font-size: 13px; font-weight: 700; }
.seeker-peek { position: absolute; z-index: 3; pointer-events: none; filter: drop-shadow(0 4px 0 #0004); }
.seeker-peek svg { display: block; width: 100%; height: auto; overflow: visible; }
.seeker-peek.pop { transform: translateY(5px) scale(1.06); transform-origin: 50% 0; }
.seeker-say { position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); width: max-content; max-width: 92%; text-align: center; background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 14px; font-size: 14px; font-weight: 800; box-shadow: 0 3px 0 #0005; pointer-events: none; }
.seeker-say.hm { font-size: 20px; }
.seeker-say.found { font-size: 24px; background: #FFD93D; animation: pop .35s cubic-bezier(.2, 1.7, .5, 1); }
@keyframes pop { from { scale: .5; } to { scale: 1; } }
#seeker-face svg { display: block; width: 100%; height: 100%; overflow: visible; }
.seeker-mini { position: absolute; left: 62px; top: 7px; width: 42px; height: 30px; pointer-events: none; }
/* 「見回しを飛ばす」は上の帯の左の空き。結果の札も見本の札も上の帯には来ないので、同じ所を押し続けても下に押せる物が出ない。
   その間と結果の間は、中央の数えのボタン（見回しの後は何もしない）を隠す */
.seeker-dock { position: absolute; z-index: 7; left: 58px; top: 0; height: 44px; display: flex; align-items: center; }
.seeker-dock[hidden] { display: none; }
#panel .seeker-dock button, .seeker-dock button { font-size: 13px; height: 40px; min-height: 40px; padding: 2px 10px; white-space: nowrap; }
#app:has(> .seeker-dock:not([hidden])) #hud-center, #app:has(> #panel:is([data-screen="result"], [data-screen="seekResult"]):not([hidden])) #hud-center { visibility: hidden; }

@media (max-height: 700px) {
  .result-card { gap: 5px; padding-top: 8px; }
  #panel .headline { font-size: 20px; }
  .meter-row .num { font-size: 30px; }
  .result-card .line { font-size: 14px; }
  #panel .actions.big > button { min-height: 46px; font-size: 14px; }
  .eye { min-height: 132px; }
  .titles { flex-direction: column; align-items: center; gap: 2px; }
  .title-item { flex-direction: row; gap: 6px; }
  .title-tag { white-space: nowrap; }
  .title-why { text-align: left; font-size: 10px; }
  .seeker-chip { padding: 1px 1px 0; gap: 0; }
  .seeker-chip-face { width: 28px; }
  .seeker-chip.now .seeker-chip-face { width: 35px; }
  .seeker-chip-name { line-height: 1.2; }
  .seeker-chip-done { width: 18px; height: 18px; }
  .seeker-chip-done::after { left: 4px; top: 1px; }
  .bar { margin-bottom: 14px; }
  .meter .need, .meter .need.cleared { margin-top: 0; }
  .result-card .tip { padding: 2px 6px; font-size: 11px; }
  .unlock { padding: 2px 8px; font-size: 12px; }
  .next-note { font-size: 10px; margin-top: -2px; }
  .seek-card { gap: 4px; padding: 6px 10px; }
  .seek-score .big { font-size: 28px; }
  .seek-card .line { font-size: 13px; }
  #panel .seek-card > button { min-height: 44px; }
  #panel .seek-card .actions.small > button { min-height: 44px; font-size: 12px; padding: 2px 8px; }
  #panel[data-screen="seekResult"].high { top: 46px; }
  .result-card { max-height: calc(100% - 116px); }
  .eye { min-height: 116px; }
  /* 回が終わった札は行が多いので、絵を低くし、一言は省く（まとめと合計を優先） */
  .result-card.run-done { max-height: calc(100% - 96px); }
  #panel:has(.run-done) .eye { min-height: 96px; }
  .run-done .line { display: none; }
  /* 称号が2つの時は横に並べ、理由の行は省く */
  .result-card .titles:has(.title-item + .title-item) { flex-direction: row; justify-content: center; gap: 8px; }
  .result-card .titles:has(.title-item + .title-item) .title-why { display: none; }
  .result-card .tip.move { display: none; }
  .run-sum { padding: 2px 6px; }
  .run-row { min-height: 20px; }
  .run-face { width: 28px; }
}
@media (prefers-reduced-motion: reduce) { .seeker-intro-card, .seek-banner, .seeker-say.found, .seek-plus.on { animation: none; } }
/* 横向きのスマホ: 結果は絵と札を左右に。探す側は部屋を左いっぱいに、道具と札を右の列に（paint.css の塗りの画面と同じ分け方） */
@media (orientation: landscape) and (max-height: 500px) {
  /* 高さが足りない分は場所の記録だけを下に回し、行き先のボタンは先に全部見せる */
  .result-card .places { order: 1; }
  /* 高さが足りないので、主は顔と名前を横に並べ、称号は理由ごと詰める */
  .result-card { padding-top: 4px; padding-bottom: 4px; }
  #panel .result-card .headline { font-size: 17px; line-height: 1.15; }
  .result-card .titles { flex-direction: row; flex-wrap: wrap; gap: 0 8px; }
  .result-card .title-tag { font-size: 11px; padding: 0 5px; }
  .result-card .title-why { font-size: 9px; }
  .result-card .seekers { grid-template-columns: repeat(3, auto); justify-content: space-between; }
  .result-card .seeker-chip { flex-direction: row; justify-content: center; gap: 3px; padding: 0 4px; }
  .result-card .seeker-chip .seeker-chip-face { width: 28px; flex: none; }
  .result-card .seeker-chip-name { text-align: left; font-size: 10px; line-height: 1.15; }
  .result-card .seeker-chip-name small { font-size: 9px; }
  .result-card .seeker-chip-done { top: -4px; right: auto; left: -5px; width: 14px; height: 14px; }
  .result-card .seeker-chip-done::after { left: 3px; top: 1px; width: 3px; height: 5px; border-width: 0 2px 2px 0; }
  .result-card .meter-row .num { font-size: 24px; }
  .result-card .bar { height: 9px; margin: 1px 2px 11px; }
  .result-card .bar .mark small, .result-card .bar .mark.now small { top: 11px; font-size: 9px; }
  .result-card .bar .mark.now { top: -3px; height: 15px; }
  .result-card .meter .need { font-size: 10px; }
  .result-card .line { font-size: 13px; line-height: 1.25; }
  .result-card .tip, .result-card .unlock { font-size: 10px; line-height: 1.25; padding: 1px 6px; }
  .result-card .next-note { font-size: 9px; margin-top: -3px; }
  #panel .result-card .actions.big > button { min-height: 44px; font-size: 13px; padding: 2px 8px; }
  #panel .result-card .actions.small > button { min-height: 44px; font-size: 12px; padding: 2px 8px; }
  #app:has(> #panel[data-screen="result"]:not([hidden])) { max-width: none; }
  #panel[data-screen="result"] { flex-direction: row; }
  #panel[data-screen="result"] .eye { min-height: 0; }
  #panel[data-screen="result"] .result-card, #panel[data-screen="result"] .share-card { width: 380px; max-height: 100%; border-radius: 16px 0 0 0; gap: 4px; }
  #panel[data-screen="result"] .share-card h2 { font-size: 17px; }
  #panel[data-screen="result"] .share-actions button { min-height: 44px; }
  #app:has(> #panel[data-screen="seek"]:not([hidden])), #app:has(> #panel[data-screen="seekResult"]:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) 372px; grid-template-rows: 44px minmax(0, 1fr); max-width: none; min-width: 0; }
  #app:has(> #panel[data-screen="seek"]:not([hidden])) > :is(#stage), #app:has(> #panel[data-screen="seekResult"]:not([hidden])) > #stage { grid-column: 1; grid-row: 1 / 3; }
  #app:has(> #panel[data-screen="seek"]:not([hidden])) > #hud-top, #app:has(> #panel[data-screen="seekResult"]:not([hidden])) > #hud-top { grid-column: 2; grid-row: 1; }
  #app:has(> #panel[data-screen="seek"]:not([hidden])) > #hud-bottom, #app:has(> #panel[data-screen="seekResult"]:not([hidden])) > #hud-bottom { display: none; }
  #panel[data-screen="seek"] { position: static; grid-column: 2; grid-row: 2; align-self: end; background: transparent; }
  #panel[data-screen="seekResult"], #panel[data-screen="seekResult"].high { position: static; grid-column: 2; grid-row: 2; align-self: center; align-items: center; }
  .seek-top { left: auto; right: 104px; width: 210px; }
  .seek-veil { padding: 8px; }
  .paper-card { gap: 4px; padding: 10px 14px; }
  .paper-card .doll-icon { height: 62px; width: 44px; }
  #panel .paper-card button.main { min-height: 44px; font-size: 17px; }
}
/* 押し抜けの守り（result-guard.js）の間は、札も押しを受けない。部屋と下の道具は paint.css。見た目は変えない */
#app[data-arming] :is(#panel, .seeker-dock), #app[data-arming] :is(#panel, .seeker-dock) * { pointer-events: none !important; }

/* 回のまとめ: 使った場所を順に、合計と最高 */
.run-sum { background: #FFFDF6; border: 2px solid var(--ink); border-radius: 10px; padding: 4px 8px; text-align: left; }
.run-list { list-style: none; margin: 0; padding: 0; }
.run-row { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 13px; font-weight: 800; }
.run-row + .run-row { border-top: 1px dashed #35271F40; }
.run-face { flex: none; width: 28px; }
.run-face svg { display: block; width: 100%; height: auto; overflow: visible; }
.run-place { flex: 1; min-width: 0; }
.run-m { font-size: 16px; font-variant-numeric: tabular-nums; }
.run-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 12px; border-top: 2px solid var(--ink); padding-top: 2px; font-size: 12px; }
.run-total { font-size: 15px; }
.run-new { background: #FFE45C; border-radius: 6px; padding: 0 6px; }
#panel .actions.small > button[data-act="new-run"] { border: 2px solid var(--main); font-weight: 800; }

/* この部屋の場所の記録: 小さな札。点は猫、ふくろう、やぎ */
.places-head { font-size: 11px; font-weight: 800; margin-bottom: 3px; }
.place-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 4px; }
.place-chip { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 3px; min-width: 0; padding: 4px 0; background: #E4D6BB; border: 2px solid transparent; border-radius: 8px; }
.place-chip.fresh { background: transparent; border: 2px dashed #35271F80; }
.place-chip.now { background: #FFE9A6; border: 3px solid var(--ink); }
.place-name { flex: 1; display: flex; align-items: center; text-align: center; font-size: 9.5px; letter-spacing: -0.02em; font-weight: 800; line-height: 1.2; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.place-marks { display: flex; gap: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #35271F90; }
.dot.on { border-color: var(--ink); }
.dot.on.d1 { background: #D99A55; }
.dot.on.d2 { background: #8C6A58; }
.dot.on.d3 { background: #FFFDF6; box-shadow: inset 0 0 0 2px #A88F68; }
.place-used { position: absolute; top: -6px; right: -3px; font-style: normal; font-size: 9px; font-weight: 900; line-height: 1.3; padding: 0 3px; border-radius: 5px; background: #2F6B52; color: #FFFDF6; }
#panel .places-toggle { display: none; }
@media (max-height: 700px) {
  .places-head { display: none; }
  #panel .places-toggle { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; gap: 8px; background: transparent; box-shadow: none; border: 1.5px dashed #35271F80; border-radius: 8px; font-size: 12px; font-weight: 800; }
  .places:not(.open) .place-list { display: none; }
  .places.open .place-list { margin-top: 8px; }
  .places-caret { width: 7px; height: 7px; flex: none; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .places.open .places-caret { transform: rotate(-135deg); }
}
/* 回の終わり: 行と合計は result-run.js が順に出す。丸の凡例は色の丸と主の顔の組 */
.run-row, .run-total, .run-new { transition: opacity .18s ease-out, transform .18s ease-out; }
.run-total { font-variant-numeric: tabular-nums; }
.place-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 9px; margin-top: 3px; font-size: 10px; line-height: 1.3; font-weight: 700; }
.legend-item { display: inline-flex; align-items: center; gap: 2px; }
.legend-face { width: 28px; }
.legend-face svg { display: block; width: 100%; height: auto; overflow: visible; }
@media (max-height: 700px) { .places:not(.open) .place-legend { display: none; } }
@media (prefers-reduced-motion: reduce) { .run-row, .run-total, .run-new { transition: none; } }
/* 横向きの回の終わり: 場所の記録まで札に収める。見出しと重なる「やりすごした」の1行は省き、まとめの行を詰める */
@media (orientation: landscape) and (max-height: 500px) {
  .result-card.run-done { gap: 3px; }
  .result-card.run-done .meter .need.cleared { display: none; }
  .run-done .run-sum { padding: 0 6px; }
  .run-done .run-row { min-height: 18px; font-size: 12px; line-height: 1.2; }
  .run-done .run-face { width: 22px; }
  .run-done .run-m { font-size: 14px; }
  .run-done .run-total { font-size: 13px; }
}
/* 周回3: 見つかった札は、数の横に理由と次の1手 */
.why-row { display: flex; align-items: center; gap: 9px; }
.why-row .score { flex: none; display: flex; flex-direction: column; align-items: center; max-width: 76px; }
.why-row .score .label { font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center; }
.why-row .score .num { font-size: 36px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.why-row .why { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.why-row .why .line { text-wrap: pretty; }
.why-row .why .tip { text-wrap: pretty; }
.meter.found .bar { margin-top: 5px; }
.need-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 8px; }
.need-row .best { font-size: 11px; opacity: .8; }
/* 今の場所の点: まぎれ具合 ×倍率 → 点。勝ち負けの目盛りとは線で分ける */
.place-points { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1.5px solid var(--ink); border-radius: 9px; background: #FFFDF6; padding: 3px 9px; text-align: left; }
.place-points-name { display: flex; flex-direction: column; min-width: 0; font-size: 13px; font-weight: 900; line-height: 1.25; }
.place-points-name small { font-size: 10px; font-weight: 700; opacity: .75; }
.place-points-calc { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.place-points-calc > small { font-size: 9px; font-weight: 700; line-height: 1.2; }
.run-calc { flex: none; display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-calc .run-m { font-size: 14px; }
.run-mult { font-size: 13px; font-weight: 900; color: #8A3A12; }
.run-arrow { font-size: 12px; opacity: .6; }
.run-points { font-size: 18px; min-width: 2.1em; text-align: right; }
.place-points-calc .run-points { min-width: 0; }
.run-max { font-size: 11px; font-weight: 700; opacity: .75; margin-left: -7px; }
.place-mult { font-size: 12px; font-weight: 900; line-height: 1.15; color: #8A3A12; font-variant-numeric: tabular-nums; }
.why-row :is(.line, .tip), .next-note { word-break: auto-phrase; }
@media (max-height: 700px) {
  .why-row { gap: 7px; }
  .why-row .score .num { font-size: 30px; }
  .meter.found .bar { margin-top: 3px; }
  .place-points { padding: 1px 8px; }
  .place-points-name { font-size: 12px; }
  .place-points-name small { font-size: 9px; }
  /* たたんだ形でも、場所の名前と倍率は見せる（次の場所を選ぶ前に目に入る）。丸と凡例は開いた時だけ */
  .places { display: flex; flex-direction: column; }
  .places:not(.open) .place-list { display: grid; }
  .places:not(.open) .place-marks { display: none; }
  .places:not(.open) .place-list { order: -1; margin-top: 4px; }
  .places:not(.open) .place-chip { padding: 1px 0; gap: 0; }
  .places:not(.open) .place-chip.used { background: #CFE3C8; padding-top: 4px; }
  .places:not(.open) .place-used { top: -9px; font-size: 8px; line-height: 1.2; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .why-row .score .num { font-size: 24px; }
  .place-points-calc > small { display: none; }
}

/* 周回4: 行き先は小さい画面でもスクロールなし。入り切らない物（場所の記録）は指で引けて、下に続きがある事が分かる */
.result-card { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; max-height: calc(100% - 158px); }
.result-card > * { flex-shrink: 0; touch-action: pan-y; }
#panel .result-card button { touch-action: pan-y; }
.result-card.more::after { content: "▼"; order: 9; position: sticky; bottom: calc(-10px - env(safe-area-inset-bottom)); flex: none; height: 20px; margin: -27px -12px 0; display: flex; align-items: flex-end; justify-content: center; font-size: 11px; line-height: 1.2; color: var(--ink); background: linear-gradient(#0000, var(--paper) 65%); pointer-events: none; }
/* 光る升の後ろ: 絵の左下の押している間のボタンと、替わっている間の見出し */
#panel .eye button.behind-hold { right: auto; left: 6px; border: 2.5px solid #1F8C9E; font-weight: 800; }
#panel .eye button.behind-hold.on { background: #7FF0FF; }
.eye .eye-cap.behind { background: #7FF0FF; color: #12262B; }
/* 丸に主の顔が入る */
.slots { flex: none; display: flex; gap: 3px; }
/* やりすごした札は主の並びを省く（今の主は場所の丸に入り、次の主は行き先の下の1行にある） */
.result-card.passed:has(.place-points) .seekers { display: none; }
.slot { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 2px dashed #35271F70; }
.slot.on { border: 2px solid var(--ink); }
.slot.s1 { background: #F3D3A8; }
.slot.s2 { background: #CDB6A8; }
.slot.s3 { background: #D9C7A4; }
.slot svg { display: block; width: 24px; height: 17px; overflow: visible; }
.slot.new { animation: slot-ring .7s .95s ease-out both; }
.slot.new svg { animation: slot-in .6s .5s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes slot-in { from { transform: translateY(-46px) scale(2.4); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes slot-ring { from { box-shadow: 0 0 0 0 #FFB300; } 40% { box-shadow: 0 0 0 5px #FFD93D; } to { box-shadow: 0 0 0 2px #FFD93D; } }
.place-points .place-points-name { flex: 1; }
.place-points-name small { font-size: 11px; font-weight: 800; opacity: 1; color: #2F6B52; line-height: 1.25; }
.run-row .slot { width: 28px; height: 24px; border-radius: 12px; }
.run-row .slot svg { width: 24px; height: 17px; }
.dot { width: 11px; height: 11px; }
.dot.on.new { animation: dot-in .8s .9s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes dot-in { from { transform: scale(3.2); opacity: 0; } 35% { opacity: 1; } to { transform: none; opacity: 1; } }
/* 倍率と丸の意味: 読める大きさで、1つずつの行 */
.places .mult-note { font-size: 12px; font-weight: 800; line-height: 1.35; color: #8A3A12; margin-top: 5px; text-wrap: balance; }
.place-legend { gap: 0 10px; font-size: 12px; font-weight: 800; }
.legend-item .dot { width: 11px; height: 11px; }
@media (prefers-reduced-motion: reduce) { .slot.new, .slot.new svg, .dot.on.new { animation: none; } .slot.new { box-shadow: 0 0 0 2px #FFD93D; } }

@media (max-height: 700px) {
  .result-card, .result-card.run-done { max-height: calc(100% - 108px); gap: 4px; padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .result-card.more::after { margin-top: -24px; bottom: calc(-6px - env(safe-area-inset-bottom)); }
  .eye, #panel:has(.run-done) .eye { min-height: 108px; }
  #panel .eye button { min-height: 40px; }
  /* 見つかった札は絵を優先する（今の主の名前は絵の見出しにある） */
  .result-card.found .seekers { display: none; }
  /* 主は顔と名前を横に並べて低くする */
  .result-card .seeker-chip { flex-direction: row; justify-content: center; gap: 3px; padding: 0 2px; }
  .result-card .seeker-chip .seeker-chip-face { width: 28px; flex: none; }
  .result-card .seeker-chip-name { text-align: left; font-size: 10px; line-height: 1.15; }
  .result-card .seeker-chip-name small { display: none; }
  .result-card .seeker-chip-done { top: -4px; right: auto; left: -3px; width: 14px; height: 14px; }
  .result-card .seeker-chip-done::after { left: 3px; top: 1px; width: 3px; height: 5px; border-width: 0 2px 2px 0; }
  .result-card .titles .title-why { line-height: 1.2; }
  #panel .result-card .actions.big > button { min-height: 44px; }
  #panel .result-card .actions.small { flex-wrap: nowrap; align-items: stretch; }
  #panel .result-card .actions.small > button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 2px 4px; font-size: 12px; line-height: 1.2; text-wrap: balance; }
  .slot { width: 28px; height: 28px; }
  .slot svg { width: 24px; height: 17px; }
  .run-row .slot { width: 26px; height: 20px; }
  .run-row .slot svg { width: 21px; height: 15px; }
  /* 場所の記録: 名前と倍率の1段と、倍率の意味の1行（押すと丸と凡例が開く） */
  .places .mult-note { display: none; }
  .places.open .places-head { display: block; margin-top: 4px; }
  #panel .places-toggle { min-height: 36px; height: auto; padding: 2px 6px; font-size: 12px; line-height: 1.25; text-wrap: balance; }
  .toggle-text { color: #8A3A12; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #panel[data-screen="result"] .result-card { max-height: 100%; gap: 3px; }
  .result-card.found .seekers { display: none; }
  .slot { width: 26px; height: 26px; }
  .slot svg { width: 22px; height: 16px; }
  .run-row .slot { width: 24px; height: 18px; }
  .run-row .slot svg { width: 20px; height: 14px; }
}
/* 日本語は文節で折り返す */
.result-card .tip, #panel .result-card .actions button, .places .mult-note { word-break: auto-phrase; }
#panel .result-card .actions button { text-wrap: balance; }
