/* 添付の和室・襖デザインを再現する表示層。出題・採点・保存は変更しない。 */
:root, :root:has(.app[data-difficulty]) {
  color-scheme: only light;
  --ink: #361b10; --ink-soft: #715139; --cream: #f4e4c6; --cream-deep: #e6d3af;
  --card: #fff9ec; --scene-ground: #eddbb6; --mint: #ffd261; --mint-deep: #c57c21;
  --good: #dce8c4; --good-deep: #6d8352; --bad: #f2d5be; --bad-deep: #a6634b;
  --far-sky: #ffedb7; --tap: 44px;
}
html, body { height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #39291e; font-family: ui-rounded, 'Hiragino Maru Gothic ProN', 'Yu Gothic', system-ui, sans-serif; }
#app { isolation: isolate; position: relative; display: block; width: min(100vw, 32rem); height: 100dvh; min-height: 0; max-height: 100dvh; margin: auto; padding: 0; border: 0; border-radius: 0; overflow: auto; background: #edd6aa; box-shadow: 0 0 60px #160c09a0; }
#app .app__dots, #app .topbar::before, #app .topbar-spacer { display: none; }
#app button { touch-action: manipulation; }
#app button:focus-visible, #app summary:focus-visible { outline: 3px solid #33796e; outline-offset: 3px; }
#app .topbar { position: relative; display: grid; grid-template-columns: 44px 44px minmax(0, 1fr) 44px; grid-template-rows: 44px; align-items: start; gap: 8px; min-height: 0; height: calc(env(safe-area-inset-top) + clamp(205px, 31dvh, 265px)); padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 14px) 0 calc(env(safe-area-inset-left) + 14px); border: 0; background: none; }
#app .game-back, #app .settings-button { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 10px; border: 1px solid #8b6137; border-radius: 50%; color: #48271b; background: #fff3daed; box-shadow: 0 2px 5px #3e291a33; }
#app .game-back svg, #app .settings-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#app .settings-button { grid-column: 4; grid-row: 1; }
#app:not([data-screen="game"]) .game-back { visibility: hidden; }
#app:not([data-screen="home"]) .settings-button { display: none; }
#app .masthead-home { grid-area: auto; position: absolute; top: calc(env(safe-area-inset-top) + clamp(85px, 12dvh, 110px)); left: 10%; right: 10%; width: 80%; max-width: none; height: clamp(112px, 18dvh, 155px); min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; background: none; aspect-ratio: auto; }
#app .masthead-art { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: auto; background: none; }
#app .masthead-art img { display: block; min-width: 0; min-height: 0; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
#app .masthead-art img[hidden], #app .masthead-art__fallback[hidden] { display: none; }
#app .masthead-art__fallback { display: block; max-width: 100%; color: #381e13; font-size: clamp(1.5rem, 7vw, 2.5rem); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; text-shadow: 0 1px 0 #fff3d7; }
#app .hud, #app .hud__mode { display: none; }
#app .screen { padding: 0; }
#app .home { display: flex; flex-direction: column; min-height: 360px; height: calc(100dvh - env(safe-area-inset-top) - clamp(205px, 31dvh, 265px)); padding: 0 10% max(12px, env(safe-area-inset-bottom)); gap: 0; }
#app .home__intro { display: block; text-align: center; }
#app .home-art { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
#app .home-art picture { display: block; width: 100%; height: 100%; }
#app .home-art img { display: block; width: 100%; height: 100%; min-height: 100%; object-fit: cover; object-position: center; }
#app .home__tagline { margin: 0; color: #361c10; font-size: clamp(.95rem, 4.1vw, 1.25rem); font-weight: 900; line-height: 1.45; letter-spacing: .04em; text-shadow: 0 1px 6px #fff6e0; }
#app .home__setup { display: block; margin-top: auto; padding-top: 16px; }
#app .menu { display: flex; flex-direction: column; align-items: center; gap: 9px; margin: 0; }
#app .menu__item { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 68px; margin: 0; padding: 9px 18px; border: 2px solid #4d2d18; border-radius: 999px; color: #32190e; background: linear-gradient(#ffdf70, #ffc447); box-shadow: inset 0 2px 1px #fff7c5, 0 4px 0 #b87927, 0 5px 8px #49311e38; }
#app .menu__item:active { transform: translateY(2px); box-shadow: inset 0 2px 1px #fff7c5, 0 1px 0 #b87927; }
#app .menu__body { flex: 0 1 auto; }
#app .menu__body strong { display: block; color: inherit; font-size: clamp(1.75rem, 8vw, 2.5rem); font-weight: 900; line-height: 1.2; }
#app .menu__arrow { display: none; }
#app .menu__icon { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 0; color: #ad5429; background: none; box-shadow: none; }
#app .menu__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; }
#app .menu__paw svg, #app .menu__paw svg * { fill: currentColor; stroke: none; }
#app .menu__paw { width: 30px; height: 30px; margin-right: 3px; color: #df932b; }
#app .menu__item--howto, #app .menu__item--highscore { width: 68%; min-width: 190px; min-height: 44px; padding: 7px 14px; color: #402012; background: #f7e9d8f5; box-shadow: inset 0 1px 0 #fff, 0 2px 3px #50332235; }
#app .menu__item--howto .menu__body strong, #app .menu__item--highscore .menu__body strong { font-size: clamp(.9rem, 4.2vw, 1.15rem); line-height: 1.3; }
#app .menu__item--highscore .menu__icon { color: #5a331a; }
#app .home__slogan { margin: 13px auto 0; width: 88%; color: #343530; font-size: .77rem; font-weight: 750; line-height: 1.5; text-align: center; text-shadow: 0 1px 4px #fff5da; }
#app .sites-error { background: #fff7e6; font-size: .85rem; }
/* プレイ: 上段の得点・ロゴ・ライフ、襖、四択、下端の時計。 */
#app[data-screen="game"] { display: grid; grid-template-rows: calc(112px + env(safe-area-inset-top)) minmax(0, 1fr); overflow: hidden; padding-bottom: env(safe-area-inset-bottom); background: #f0dbb6; }
#app[data-screen="game"] .topbar { height: auto; padding-top: calc(env(safe-area-inset-top) + 4px); border-bottom: 9px solid #704221; background: linear-gradient(#b6814e 0 3px, #ead3a7 3px 100%); }
#app[data-screen="game"] .masthead-home { z-index: 2; top: calc(env(safe-area-inset-top) + 50px); left: 28%; right: 28%; width: 44%; height: 49px; }
#app[data-screen="game"] .masthead-art__fallback { font-size: clamp(.9rem, 4vw, 1.35rem); }
#app[data-screen="game"] .hud { position: absolute; inset: calc(env(safe-area-inset-top) + 49px) 12px 5px; display: grid; grid-template-columns: minmax(60px, 24%) minmax(0, 1fr) minmax(60px, 24%); gap: 6px; margin: 0; padding: 0; border: 0; background: none; pointer-events: none; }
#app .hud__score, #app .hud__lives { display: grid; align-content: center; justify-items: center; margin: 0; min-width: 0; padding: 3px 5px; border: 1px solid #b59165; border-radius: 9px; color: #351d10; background: #fff4d9; box-shadow: 0 2px 3px #6e462529; text-align: center; }
#app .hud__score { grid-column: 1; grid-row: 1; justify-self: stretch; }
#app .hud__lives { grid-column: 3; grid-row: 1; }
#app .hud__score span { display: block; font-size: .7rem; line-height: 1.1; font-weight: 800; }
#app .hud__score output { display: block; font-size: 1.5rem; line-height: 1.05; font-weight: 900; font-variant-numeric: tabular-nums; }
#app .hud__count { position: absolute; top: -34px; left: 100px; right: 64px; margin: 0; text-align: center; }
#app .hud__count strong { font-size: .7rem; font-weight: 800; line-height: 1.2; }
#app #lives-hearts { display: flex; gap: .08rem; color: #db4545; font-size: clamp(1rem, 4.5vw, 1.5rem); line-height: 1.05; text-shadow: 0 1px 0 #a22121; }
#app #lives-hearts i[data-lost="true"] { color: #ad9e8d; opacity: 1; text-shadow: none; }
#app #lives-label { order: -1; font-size: .65rem; line-height: 1.2; font-weight: 800; }
#app[data-screen="game"] .hud__mode { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 10px); display: block; max-width: 64px; padding: 3px 0; font-size: .65rem; line-height: 1.2; text-align: right; overflow-wrap: anywhere; border: 0; background: none; color: #644326; }
#app[data-screen="game"] main { display: grid; min-height: 0; }
#app[data-screen="game"] .game { display: grid; grid-template-rows: 0 minmax(120px, 1fr) auto; gap: 0; height: 100%; min-width: 0; min-height: 0; }
#app .meter { height: 0; min-height: 0; margin: 0; padding: 0; border: 0; overflow: hidden; }
#app .scanner { display: grid; grid-template-rows: minmax(0, 1fr) 25px; gap: 0; min-width: 0; min-height: 0; padding: 0 9px; background: repeating-linear-gradient(0deg, #bdb583 0 1px, #c8be8e 1px 3px); border-inline: 5px solid #81532e; }
#app .scanner__window { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; background: radial-gradient(ellipse, #fff9da, #f5d789); isolation: isolate; box-shadow: none; }
#app .scanner__window::after { content: ''; position: absolute; z-index: 2; inset: 0; pointer-events: none; border: 3px solid #3c3025; }
#app .scanner__panel { width: calc((100% - var(--gap-w)) / 2); z-index: 1; border: 0; background: #dfc69a url('../assets/scenes/fusuma-panel.webp') right center / cover no-repeat; box-shadow: 2px 0 4px #3e281733; }
#app .scanner__panel--right { transform: scaleX(-1); }
#app .scanner__item { z-index: 0; }
#app .scanner__item, #app .scanner__item .object-icon { opacity: 1; filter: none; }
#app .scanner__guide { width: .9rem; height: .9rem; opacity: .4; }
#app .scanner__guide i { height: 2px; background: #815c34; }
#app .scanner__prompt { display: block; align-self: center; margin: 0; color: #52442a; font-size: .65rem; line-height: 1.2; text-align: center; }
#app .scanner__count { border: 2px solid #6b462b; border-radius: 50%; color: #624021; background: #fff2d1; box-shadow: 0 4px 18px #35231145; }
#app .scanner__feedback { z-index: 3; top: calc(50% - 1.2rem); width: calc(100% - 2rem); max-width: 24rem; min-height: 0; max-height: calc(100% - 4.5rem); overflow: auto; grid-template-columns: minmax(0, 1fr); padding: .5rem .65rem; border: 1px solid #96734c; border-radius: 12px; color: #3d2413; background: #fff7e9f5; box-shadow: 0 4px 14px #38271d35; font-size: .83rem; }
#app .scanner__feedback:has(img) { grid-template-columns: 3rem minmax(0, 1fr); }
#app .round-feedback__icon { width: 3rem; height: 3rem; }
#app .next-round-button { z-index: 3; top: auto; bottom: .7rem; min-height: 44px; padding: .4rem 1rem; border: 1px solid #885c2f; border-radius: 99px; color: #422719; background: #ffdc70; box-shadow: 0 3px 0 #ad702d; transform: translateX(-50%); }
#app .next-round-button:active { transform: translate(-50%, 2px); box-shadow: 0 1px 0 #ad702d; }
#app .answer { display: grid; grid-template-rows: auto auto auto auto; gap: 0; min-width: 0; padding: 10px 12px 5px; background: linear-gradient(90deg,#ead0ac80,transparent 22% 78%,#ead0ac80), #f5e1c2; }
#app .answer__head { display: block; margin: 0 0 9px; text-align: center; }
#app .answer__head h2 { margin: 0; min-width: 0; color: #371d11; font-size: clamp(.86rem, 3.6vw, 1.15rem); line-height: 1.4; font-weight: 900; }
#app .choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(2,clamp(50px,8.3dvh,75px)); gap: 9px; }
#app .choice { display: grid; grid-template: minmax(0,1fr)/minmax(0,1fr); place-items: center; min-width: 0; min-height: 44px; height: 100%; padding: 6px; border: 1px solid #b3916c; border-radius: 12px; color: #382010; background: #fff8eb; box-shadow: inset 0 2px 0 #fffdf8,0 2px 5px #71472038; }
#app .choice:disabled:not([data-state]) { background: #f3e5cf; box-shadow: inset 0 1px 0 #fff9ec; }
#app .choice:not(:disabled):hover { background: #ffefd0; border-color: #8d6334; }
#app .choice:not(:disabled):active { transform: translateY(2px); box-shadow: inset 0 1px 3px #85613455; }
#app .choice__name { padding: 0 2px; color: inherit; font-size: clamp(.82rem,4.1vw,1.4rem); font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
#app .choice::after { display: none; }
#app .choice .object-icon { display: block; min-width: 0; min-height: 0; width: min(78%,5.4rem); height: 100%; max-height: 5.4rem; object-fit: contain; }
#app .choice[data-state="correct"] { background: #dfedc7; border-color: #7b914b; box-shadow: 0 2px 0 #78904f; }
#app .choice[data-state="wrong"] { background: #f4d7c5; border-color: #ba795a; box-shadow: 0 2px 0 #b77f5b; }
#app .choice[data-state="correct"]::before, #app .choice[data-state="wrong"]::before { position: absolute; top: 0; right: 5px; content: '✓'; color: #3e6433; font-size: 1rem; font-weight: 900; }
#app .choice[data-state="wrong"]::before { content: '×'; color: #9a4932; }
#app .answer-clock { display: flex; align-items: center; gap: 5px; min-height: 43px; margin-top: 10px; padding: 5px 8px; border: 1px solid #b59670; border-radius: 10px; background: #fff5de; box-shadow: 0 2px 3px #6e462520; }
#app .answer-clock svg { width: 22px; height: 26px; flex-shrink: 0; fill: none; stroke: #3c281c; stroke-width: 2.2; stroke-linecap: round; }
#app .answer__timer { min-width: 56px; max-width: 38%; margin: 0; padding: 0; border: 0; border-radius: 0; color: #352012; background: none; font-size: .9rem; line-height: 1.15; font-weight: 900; text-align: left; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#app .answer-clock__track { flex: 1; height: 19px; min-width: 24px; border: 1px solid #96734e; border-radius: 99px; overflow: hidden; background: #c1a589; box-shadow: inset 0 2px 2px #64422728; }
#app .answer-clock__track i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(#ffe990,#ffc852); box-shadow: inset 0 1px 0 #fff4be; transform: scaleX(var(--answer-remaining,1)); transform-origin: left; }
#app .game-status { display: block; min-height: 2.5em; margin: 5px 0 0; padding: 0; border: 0; color: #75543a; font-size: .65rem; line-height: 1.25; text-align: center; }
#app .answer__footer { display: none; }
/* Dialogs keep the reference home uncluttered while preserving all settings. */
#app dialog { width: min(calc(100% - 28px),26rem); max-height: calc(90dvh - env(safe-area-inset-top)); margin: auto; padding: 20px; overflow: auto; border: 2px solid #765334; border-radius: 18px; color: #432817; background: #fff5e2; box-shadow: 0 20px 70px #24160c80; }
#app dialog::backdrop { background: #21150dc0; }
#app .dialog__head, #app .howto-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
#app .dialog__head h2, #app .howto-dialog__head h2 { margin: 0; font-size: 1.35rem; font-weight: 900; }
#app .dialog__close, #app .howto-dialog__x { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; padding: 0; border: 1px solid #a78b65; border-radius: 50%; color: #51321e; background: #f0dfc0; font-size: 1.4rem; }
#app .difficulty-select, #app .answer-style { margin: 18px 0 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
#app .difficulty-select h2, #app .answer-style__title { margin: 0 0 8px; font-size: .95rem; font-weight: 800; }
#app .difficulty-rule, #app .answer-style__note { display: block; margin: 8px 0; color: #796044; font-size: .75rem; line-height: 1.5; }
#app .difficulty-options { display: grid; grid-template-columns: repeat(auto-fit,minmax(90px,1fr)); gap: 7px; margin: 0; }
#app .difficulty-options button { display: grid; align-content: center; gap: 4px; min-height: 70px; padding: 8px; border: 1px solid #baa079; border-radius: 12px; color: #614a31; background: #f5e8cc; text-align: center; box-shadow: none; }
#app .difficulty-options strong { font-size: .95rem; line-height: 1.2; }
#app .difficulty-options small { font-size: .7rem; line-height: 1.4; }
#app .difficulty-options button[aria-pressed="true"] { border-color: #846032; background: #ffd96d; color: #422817; }
#app .difficulty-options button:disabled { color: #968774; background: #e9e0d0; }
#app .answer-style .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 3px; border: 1px solid #c6ae89; border-radius: 12px; background: #e9dcc3; }
#app .tabs button { min-height: 44px; min-width: 0; padding: 6px; border: 0; border-radius: 9px; color: #6f573c; background: none; box-shadow: none; font-size: .82rem; font-weight: 800; }
#app .tabs button[aria-pressed="true"] { color: #422b19; background: #fff8e9; box-shadow: 0 1px 4px #76603e30; }
#app .sites-best { margin: 20px 0; color: #614020; font-size: 1.4rem; font-weight: 900; text-align: center; }
#app .howto-dialog form { padding: 0; }
#app .howto-steps { display: grid; gap: 12px; margin: 20px 0; padding-left: 25px; font-weight: 750; line-height: 1.5; }
#app .howto-dialog__rule { color: #796044; font-size: .85rem; line-height: 1.6; }
#app .howto-dialog__close { width: 100%; }
#app .button { min-height: 48px; padding: 9px 16px; border: 1px solid #987143; border-radius: 99px; color: #523519; background: #fff3d7; box-shadow: 0 3px 0 #b2966c; }
#app .button--go { background: #ffda6d; color: #3b2213; box-shadow: 0 3px 0 #b67b29; }
#app[data-screen="result"] .topbar { height: 115px; }
#app[data-screen="result"] .masthead-home { top: 55px; height: 55px; left: 23%; right: 23%; width: 54%; }
#app .result { min-height: 0; padding: 25px 22px calc(28px + env(safe-area-inset-bottom)); }
#app .result__stamp { border: 2px solid #b39a67; color: #776131; background: #fff1c2; box-shadow: none; }
#app .result__score { color: #704b1e; }
#app .result__stats { border-color: #bca178; border-radius: 14px; background: #fff2d9; }
@media (orientation: landscape) {
  #app { width: min(100vw,60rem); }
  #app:not([data-screen="game"]):not([data-screen="result"]) .topbar { height: calc(90px + env(safe-area-inset-top)); }
  #app[data-screen="home"] .masthead-home { top: calc(95px + env(safe-area-inset-top)); left: 7%; right: auto; justify-self: start; width: 43%; height: 100px; }
  #app .home { min-height: 280px; height: calc(100dvh - 90px - env(safe-area-inset-top)); padding: 0 6% 12px; display: grid; grid-template-columns: 1.05fr 1fr; grid-template-rows: minmax(0,1fr); align-content: stretch; align-items: end; gap: 5%; }
  #app .home__intro { align-self: start; padding-top: 108px; }
  #app .home__tagline { font-size: .84rem; }
  #app .home__setup { margin: 0; padding: 0; }
  #app .home-art img { object-position: center 58%; }
  #app .menu__item { min-height: 58px; }
  #app .menu__item--howto, #app .menu__item--highscore { min-height: 44px; }
  #app .menu__body strong { font-size: 1.5rem; }
  #app[data-screen="game"] { grid-template-rows: calc(101px + env(safe-area-inset-top)) minmax(0,1fr); }
  #app[data-screen="game"] .topbar { border-bottom-width: 6px; }
  #app[data-screen="game"] .masthead-home { top: calc(env(safe-area-inset-top) + 47px); left: 35%; right: 35%; width: 30%; height: 45px; }
  #app[data-screen="game"] .hud { top: calc(env(safe-area-inset-top) + 45px); left: 18%; right: 18%; grid-template-columns: 24% 1fr 24%; }
  #app .hud__count { left: 100px; right: 100px; }
  #app[data-screen="game"] .game { grid-template-columns: minmax(0,1.1fr) minmax(250px,1fr); grid-template-rows: minmax(0,1fr); }
  #app .meter { display: none; }
  #app .scanner { grid-column: 1; grid-row: 1; }
  #app .answer { grid-column: 2; grid-row: 1; grid-template-rows: auto minmax(0,1fr) auto auto; min-height: 0; padding: 8px 10px 4px; }
  #app .choices { min-height: 0; grid-template-rows: repeat(2,minmax(44px,1fr)); gap: 7px; }
  #app .choice__name { font-size: clamp(.85rem,2vw,1.3rem); }
  #app .answer__head { margin-bottom: 6px; }
  #app .answer__head h2 { font-size: .86rem; }
  #app .answer-clock { min-height: 34px; margin-top: 7px; padding-block: 3px; }
  #app .game-status { min-height: 2.5em; font-size: .6rem; margin-top: 3px; }
  #app .scanner__feedback { font-size: .76rem; }
}
@media (orientation: portrait) {
  #app .home__tagline { margin-top: 24px; }
}
@media (max-height: 620px) and (orientation: portrait) {
  #app .home { min-height: 335px; }
  #app .menu__item { min-height: 56px; }
  #app .menu__item--howto, #app .menu__item--highscore { min-height: 44px; }
  #app .answer { padding-top: 7px; }
  #app .choices { grid-template-rows: repeat(2,54px); gap: 7px; }
  #app .answer__head h2 { font-size: .82rem; }
  #app .answer-clock { margin-top: 7px; min-height: 35px; }
  #app .game-status { font-size: .6rem; }
}
@media (min-width: 960px) and (min-height: 561px) {
  #app { width: min(calc(100vw - 48px),58rem); height: min(calc(100dvh - 30px),900px); max-height: calc(100dvh - 30px); border: 4px solid #815b35; border-radius: 6px; }
  #app .topbar { margin: 0; }
  #app .home { height: calc(min(100dvh - 30px,900px) - 98px); padding-bottom: 30px; }
  #app .home__setup { margin-bottom: 10%; }
  #app .home__intro { padding-top: 220px; }
  #app[data-screen="home"] .masthead-home { top: calc(125px + env(safe-area-inset-top)); height: 165px; }
  #app .menu__item { min-height: 78px; }
  #app .menu__item--howto, #app .menu__item--highscore { min-height: 50px; }
  #app .home__slogan { font-size: .9rem; margin-top: 20px; }
  #app .home-art img { object-position: center 58%; }
  #app[data-screen="game"] { height: min(calc(100dvh - 30px),900px); padding: 0; }
  #app .answer { padding: 18px 16px 12px; }
  #app .answer__head h2 { font-size: 1.05rem; }
  #app .choices { grid-template-rows: repeat(2,minmax(70px,1fr)); }
  #app .answer-clock { min-height: 48px; margin-top: 15px; }
  #app .game-status { margin-top: 10px; font-size: .75rem; }
  #app .result { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { #app *, #app *::before, #app *::after { animation: none !important; transition: none !important; } }
/* Safariの二段ツールバー等で縦が足りない横画面は、四択を潰さずスクロール。 */
@media (orientation: landscape) and (max-height: 360px) {
  #app[data-screen="game"] { grid-template-rows: calc(101px + env(safe-area-inset-top)) minmax(240px,1fr); overflow-y: auto; overflow-x: hidden; }
  #app[data-screen="game"] main, #app[data-screen="game"] .game { min-height: 240px; }
  #app .answer { min-height: 240px; }
}
/* 難易度と回答方法はホームで直接選ぶ。設定は端末オプションだけ。 */
#app .home-options { flex: 0 0 auto; display: grid; gap: 8px; margin-top: 12px; }
#app .home-options .difficulty-select, #app .home-options .answer-style { margin: 0; }
#app .home-options .difficulty-select h2, #app .home-options .answer-style__note { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#app .home-options .difficulty-options { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
#app .home-options .difficulty-options:has([data-difficulty="oni"]) { grid-template-columns: repeat(4,minmax(0,1fr)); }
#app .home-options .difficulty-options:has([data-difficulty="oni"]) strong { font-size: clamp(.65rem,2.8vw,.84rem); }
#app .home-options .difficulty-options button { position: relative; min-height: 56px; padding: 10px 6px; border: 2px solid transparent; border-radius: 13px; background: transparent url('../assets/controls/difficulty-beginner.webp') center / 100% 100% no-repeat; box-shadow: 0 2px 3px #47331828; color: #4a2b18; }
#app .home-options .difficulty-options button[data-difficulty="intermediate"] { background-image: url('../assets/controls/difficulty-intermediate.webp'); }
#app .home-options .difficulty-options button[data-difficulty="advanced"] { background-image: url('../assets/controls/difficulty-advanced.webp'); }
#app .home-options .difficulty-options button[data-difficulty="oni"] { background-image: url('../assets/controls/difficulty-oni.webp'); }
#app .home-options .difficulty-options button[aria-pressed="true"] { border-color: #37766a; box-shadow: 0 0 0 1px #fffcdf,0 3px 0 #315f5140; }
#app .home-options .difficulty-options button:disabled { color: #675949; filter: saturate(.4); opacity: .83; }
#app .home-options .difficulty-options strong { font-size: clamp(.75rem,3.25vw,.95rem); line-height: 1.2; text-shadow: 0 1px 2px #fff5d8; }
#app .home-options .difficulty-options small { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#app .difficulty-lock { position: absolute; right: 4px; bottom: 4px; width: 13px; height: 13px; color: #725034; }
#app .difficulty-lock svg { display: block; width: 100%; height: 100%; fill: #fff7df; stroke: currentColor; stroke-width: 1.7; }
#app .home-unlock-hint { margin: 4px 0 0; color: #63452d; font-size: .62rem; font-weight: 750; line-height: 1.25; text-align: center; text-shadow: 0 1px 3px #fff7e5; }
#app .home-options .answer-style { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,3.2fr); align-items: center; gap: 8px; }
#app .home-options .answer-style__title { min-width: 0; overflow-wrap: anywhere; margin: 0; font-size: .7rem; font-weight: 800; line-height: 1.25; color: #563b25; text-shadow: 0 1px 3px #fff5dd; }
#app .home-options .answer-style .tabs { gap: 2px; padding: 2px; border-color: #8f6d43; background: #ddc49eeb; }
#app .home-options .tabs button { min-height: 44px; padding: 5px; font-size: .72rem; line-height: 1.2; overflow-wrap: anywhere; }
#app .home-options .tabs button[aria-pressed="true"] { background: #fff5d9; color: #422615; }
@media (orientation: portrait) {
  #app[data-screen="home"] { --home-scene-height: max(100dvh,740px); }
  #app .home { position: relative; height: auto; min-height: calc(var(--home-scene-height,100dvh) - env(safe-area-inset-top) - clamp(205px,31dvh,265px)); }
  #app .home__setup { margin-top: 144px; }
  #app .home-art { top: calc(-1 * (env(safe-area-inset-top) + clamp(205px,31dvh,265px))); bottom: 0; height: auto; min-height: var(--home-scene-height,100dvh); }
}
@media (orientation: landscape) {
  #app .home { height: auto; grid-template-rows: auto auto; align-content: space-between; row-gap: 12px; min-height: max(360px,calc(100dvh - 90px - env(safe-area-inset-top))); }
  #app .home__intro { grid-column: 1; grid-row: 1 / 3; align-self: start; }
  #app .home-options { grid-column: 2; grid-row: 1; margin-top: 0; }
  #app .home__setup { grid-column: 2; grid-row: 2; align-self: end; }
  #app .home-art { height: max(100dvh,450px); bottom: auto; }
  #app .home-options .difficulty-options button { min-height: 54px; }
  #app .home-options .difficulty-options strong { font-size: .85rem; }
}

@media (min-width: 960px) and (min-height: 561px) {
  #app .home { min-height: calc(min(100dvh - 30px,900px) - 98px); }
}

@media (orientation: portrait) and (max-width: 360px) {
  #app .home__tagline { margin-top: 0; font-size: .78rem; }
  #app .home-art img { object-position: center top; }
  #app .home__setup { margin-top: 180px; }
}
/* 音設定はBGMとSEを一括切替。プレイ中も進行を捨てずに消音できる。 */
#app .sound-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding-block: 14px; border-top: 1px solid #d4bf9e; }
#app .sound-setting h3 { margin: 0 0 4px; font-size: 1rem; }
#app .sound-setting p { margin: 0; color: #796044; font-size: .8rem; }
#app .sound-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 100px; min-height: 48px; padding: 8px; border: 1px solid #aa8c65; border-radius: 12px; color: #4d3320; background: #fff8e9; font-size: .9rem; font-weight: 800; }
#app .sound-toggle__track { display: block; width: 36px; height: 22px; padding: 3px; border-radius: 99px; background: #a8987f; }
#app .sound-toggle__track i { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fffaf1; }
#app .sound-toggle[aria-checked="true"] .sound-toggle__track { background: #508274; }
#app .sound-toggle[aria-checked="true"] .sound-toggle__track i { transform: translateX(14px); }
#app .audio-credits { margin-top: 12px; color: #705338; font-size: .72rem; line-height: 1.5; }
#app .audio-credits summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 750; }
#app .audio-credits summary::after { content: "⌄"; margin-left: auto; font-size: 1rem; }
#app .audio-credits[open] summary::after { content: "⌃"; }
#app .audio-credits a { color: #36685f; text-underline-offset: 2px; }
#app .audio-credits p { overflow-wrap: anywhere; }
#app .sound-game-toggle { display: none; }
#app[data-screen="game"] .sound-game-toggle { grid-column: 4; grid-row: 1; display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 11px; border: 1px solid #8b6137; border-radius: 50%; color: #48271b; background: #fff3daed; box-shadow: 0 2px 5px #3e291a33; }
#app .sound-game-toggle svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#app .sound-game-toggle[aria-checked="false"] { opacity: .75; }
#app[data-screen="game"] .hud__count .hud__mode { position: static; display: block; max-width: 100%; margin: 2px 0 0; padding: 0; color: #765637; font-size: .6rem; line-height: 1.15; text-align: center; }
