/* 隠しギミック①④・②の補足：既存の石の画面（experience.css）に合わせた乾いた石・墨・古金 */
.kwc-trace-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.kwc-trace-tab[aria-pressed="true"] { border-color: #d1aa5b !important; color: #f0dca8 !important; background: #2c1d12 !important; }
.kwc-trace-canvas { display: block; width: min(100%, 62dvh, 460px); aspect-ratio: 1; margin: 0 auto; border: 1px solid #5c4128; touch-action: none; background: #17100b; cursor: crosshair; }
.kwc-stones-field { position: relative; width: min(100%, 400px); aspect-ratio: 1.6; margin: 4px auto 6px; }
.kwc-stones-flower { position: absolute; inset: -12% 0; width: 100%; height: 124%; pointer-events: none; object-fit: contain; }
.kwc-stones-row { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; }
.kwc-echo-stone { position: relative; aspect-ratio: 1; min-width: 0; padding: 4px !important; border-radius: 46% 54% 50% 50% / 56% 50% 50% 44% !important; background: radial-gradient(circle at 38% 30%, #4a3a2c, #1a120c 70%) !important; border: 1px solid #5d4329 !important; box-shadow: inset 0 -6px 12px #0009, 0 3px 10px #0008; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: box-shadow .18s, border-color .18s; }
.kwc-echo-stone .kwc-echo-mark { width: 34%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #8f6d38; }
.kwc-echo-stone[data-i="1"] .kwc-echo-mark { border-radius: 2px; transform: rotate(45deg) scale(.8); }
.kwc-echo-stone[data-i="2"] .kwc-echo-mark { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #8f6d38; border: 0; }
.kwc-echo-stone .kwc-echo-name { font-size: .72rem; color: #b3a38b; }
.kwc-echo-stone.is-lit { border-color: #e6c174 !important; box-shadow: inset 0 0 22px #d2a35288, 0 0 18px #d2a35255; }
.kwc-echo-stone.is-lit .kwc-echo-mark { border-color: #f0d18a; }
.kwc-stones-dots { display: flex; justify-content: center; gap: 10px; margin: 2px 0 0; }
.kwc-stones-dots span { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #8f6d38; }
.kwc-stones-dots span.on { background: #c79c50; }
.kwc-afterglow { margin-top: 14px; padding-top: 12px; border-top: 1px solid #3a2a1a; }
.kwc-afterglow[hidden], .kwc-wing[hidden] { display: none; }
.kwc-afterglow button { width: 100%; }
.kwc-wing { display: block; width: min(100%, 360px); margin: 12px auto 0; }
.kwc-ritual-chip { position: fixed; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 12; min-height: 44px; padding: 10px 16px; font-family: var(--ui, serif); font-size: .82rem; color: #e4d8be; background: rgba(20,13,9,.86); border: 1px solid #8a6a3a; border-radius: 2px; cursor: pointer; letter-spacing: .06em; max-width: calc(100vw - 32px); }
.kwc-ritual-chip[hidden], body.kwc-modal-open .kwc-ritual-chip { display: none; }
.kwc-ritual-chip:focus-visible { outline: 2px solid #e6c174; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .kwc-echo-stone { transition: none; } }
/* 音のゲーム：外3・内8の円（3対8・120 BPM） */
.kwc-poly-legend { text-align: center; color: #b3a38b; font-size: .78rem !important; margin-bottom: 6px !important; }
.kwc-poly { position: relative; width: min(100%, 340px, 52dvh); aspect-ratio: 1; margin: 6px auto 10px; }
.kwc-poly-ring { position: absolute; border-radius: 50%; pointer-events: none; }
.kwc-poly-ring.o { inset: 4%; border: 1px solid #4d3a22; background: radial-gradient(circle, #1a120c 0 58%, #120c08 59% 100%); }
.kwc-poly-ring.i { inset: 21%; border: 1px solid #3c2b1b; background: #160f0a; }
.kwc-poly-center { position: absolute; inset: 36%; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 40% 35%, #2a1d13, #120c08); border: 1px solid #5c4128; color: #d5bc82; pointer-events: none; }
.kwc-poly-center b { font-weight: 400; font-size: clamp(1.2rem, 7vw, 2rem); line-height: 1; letter-spacing: .04em; }
.kwc-poly-center span { font-size: .72rem; color: #a8997c; margin-top: 2px; }
.kwc-poly-hand { position: absolute; left: 50%; top: 50%; width: 2px; height: 46%; margin-left: -1px; transform-origin: 50% 0; pointer-events: none; transition: opacity .2s; }
.kwc-poly-hand { top: 4%; height: 46%; transform-origin: 50% 100%; background: linear-gradient(to top, transparent, rgba(226,189,107,.55)); }
.kwc-poly-hand.i { top: 21%; height: 29%; opacity: 0; background: linear-gradient(to top, transparent, rgba(179,74,51,.6)); }
.kwc-poly-dot { position: absolute; width: 44px; height: 44px; min-height: 44px !important; margin: -22px 0 0 -22px; padding: 0 !important; border-radius: 50% !important; display: grid; place-items: center; font-size: 1.05rem !important; line-height: 1 !important; color: #8e7e64 !important; background: #1e140e !important; border: 1px solid #5d4329 !important; box-shadow: inset 0 -3px 6px #0008; touch-action: manipulation; }
.kwc-poly-dot.inner { width: 40px; height: 40px; min-height: 40px !important; margin: -20px 0 0 -20px; }
.kwc-poly-dot[data-tone="1"], .kwc-poly-chip[data-tone="1"] { color: #d0614a !important; border-color: #8b2f20 !important; }
.kwc-poly-dot[data-tone="2"], .kwc-poly-chip[data-tone="2"] { color: #e0b25d !important; border-color: #9b7536 !important; }
.kwc-poly-dot[data-tone="3"], .kwc-poly-chip[data-tone="3"] { color: #efe3c4 !important; border-color: #b9ab8c !important; }
.kwc-poly-dot.is-playing { box-shadow: 0 0 0 2px #e6c174, 0 0 14px #e6c17488 !important; }
.kwc-poly-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 6px; }
.kwc-poly-chip { min-height: 44px; padding: 6px 4px !important; font-size: .74rem !important; min-width: 0; }
@media (max-width: 360px) { .kwc-poly-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kwc-poly-dot.inner { width: 36px; height: 36px; min-height: 36px !important; margin: -18px 0 0 -18px; } }
@media (prefers-reduced-motion: reduce) { .kwc-poly-hand { display: none; } }
.kwc-circuit-port.is-glow { color: #ffe2a0; text-shadow: 0 0 10px #e0b25d; }
#bubble { white-space: pre-line; }
/* 石の4つの巡りをすべて解いた時の地震（約2.3秒。最初に強く、だんだん収まる） */
@keyframes kwcQuake { 0%{transform:translate(0,0)} 5%{transform:translate(-7px,4px) rotate(-.3deg)} 10%{transform:translate(6px,-5px) rotate(.3deg)} 15%{transform:translate(-8px,-3px)} 20%{transform:translate(7px,5px) rotate(.25deg)} 30%{transform:translate(-6px,3px) rotate(-.2deg)} 40%{transform:translate(5px,-4px)} 50%{transform:translate(-4px,3px) rotate(.15deg)} 60%{transform:translate(4px,-2px)} 70%{transform:translate(-3px,2px)} 80%{transform:translate(2px,-2px)} 90%{transform:translate(-1px,1px)} 100%{transform:translate(0,0)} }
html.kwc-quake body { animation: kwcQuake 2.3s linear 1; }
.kwc-poly-goRow { margin-top: 10px; } .kwc-poly-go { font-size: 1.02rem; padding: 12px 14px; border-color: #d2a352 !important; color: #ffe2a0 !important; background: linear-gradient(#3a1a10, #1d0c07) !important; box-shadow: 0 0 14px rgba(210,163,82,.35); }
/* 赤い世界のまま「脱」から最初の画面へ戻った時：画面が赤く染まり、上下左右が逆さ（180°回転）に映る */
html.kwc-red-intro #intro { transform: rotate(180deg); filter: grayscale(1) contrast(1.2) brightness(1.05); }
html.kwc-red-intro body.at-intro::after { content: ""; position: fixed; inset: 0; z-index: 10; pointer-events: none; background: #d0141a; mix-blend-mode: multiply; }
html.kwc-red-intro body.at-intro::before { content: ""; position: fixed; inset: 0; z-index: 10; pointer-events: none; background: radial-gradient(ellipse at center, rgba(255,60,30,.18), rgba(40,0,0,.55)); }
html.kwc-red-intro body.at-intro #langBtn, html.kwc-red-intro body.at-intro #snd { transform: rotate(180deg); }
/* 回路：入口（1の左）と出口（6の右）を、線の高さに合わせて盤の横に */
.kwc-circuit-board { position: relative; padding: 0 58px; max-width: 520px; margin: 0 auto; }
.kwc-circuit-board .kwc-circuit-port { position: absolute; margin: 0; white-space: nowrap; font-size: .8rem; letter-spacing: .08em; transform: translateY(-50%); }
.kwc-circuit-board .kwc-circuit-port:not(.kwcout) { left: 0; top: calc(25% + 2px); }
.kwc-circuit-board .kwc-circuit-port.kwcout { right: 0; top: calc(75% - 2px); text-align: left; }
@media (max-width: 380px) { .kwc-circuit-board { padding: 0 44px; } .kwc-circuit-board .kwc-circuit-port { font-size: .7rem; } }
/* 一覧：作品／ミニゲーム・ギミックのタブと、遊び・仕掛けの一覧 */
.l-tabs { display: flex; gap: 8px; max-width: 1100px; margin: 0 auto 14px; }
.l-tabs button { flex: 0 1 auto; padding: 8px 16px; background: #120c09; color: #b7a88f; border: 1px solid #4a3522; letter-spacing: .12em; font: inherit; font-size: .85rem; cursor: pointer; }
.l-tabs button[aria-selected="true"] { color: #f0d79a; border-color: #c49a4a; background: #24170e; box-shadow: 0 0 10px rgba(196,154,74,.25); }
.l-games { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.l-games h3 { grid-column: 1 / -1; margin: 10px 0 0; font-weight: 400; letter-spacing: .3em; color: #d0a94e; font-size: .9rem; border-bottom: 1px solid #3a2a1c; padding-bottom: 6px; }
.l-game { background: rgba(18,12,9,.92); border: 1px solid #3c2b1c; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.l-game.done { border-color: #a8823e; box-shadow: inset 0 0 0 1px rgba(224,178,93,.15); }
.l-game p { margin: 0; }
.l-game .g-name { color: #eadcc0; font-size: .98rem; letter-spacing: .08em; }
.l-game .g-where { color: #b08c46; font-size: .76rem; letter-spacing: .06em; }
.l-game .g-how { color: #a99c86; font-size: .8rem; line-height: 1.75; }
.l-game .g-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.l-game .g-st { color: #8a7a62; font-size: .76rem; letter-spacing: .1em; }
.l-game.done .g-st { color: #e0b75f; }
.l-game .g-row button { padding: 6px 16px; background: #2a1810; color: #f0d79a; border: 1px solid #b8862e; font: inherit; font-size: .82rem; cursor: pointer; }
#l-grid[hidden], #l-experiences[hidden], #l-rooms[hidden], #l-games[hidden], #l-note[hidden] { display: none !important; }
/* 監査対応：横持ち（例 844×390）でも点が重ならない最小の大きさ＋パネル内スクロール、× は常に見える所に */
.kwc-stone-panel .kwc-close { position: sticky; float: right; top: 0; z-index: 3; margin: -12px -12px 0 8px; background: rgba(18,12,8,.92); }
@media (orientation: landscape) and (max-height: 520px) {
  .kwc-stone-panel { max-height: calc(100dvh - 16px); padding: 14px 18px; overscroll-behavior: contain; }
  .kwc-poly { width: max(280px, min(100%, 340px, 62dvh)); }
  .kwc-stone-panel h2 { font-size: 1.05rem; margin-bottom: 6px; }
  .kwc-stone-panel p { line-height: 1.6; margin-bottom: 8px; }
}
/* 一覧の手がかり（段階的に明かす） */
.l-game .g-hint { color: #d6c39a; font-size: .84rem; letter-spacing: .08em; font-style: normal; margin: 2px 0 4px; }
.l-game .g-more { font-size: .76rem; padding: 6px 10px; min-height: 36px; }
.l-guide { max-width: 1100px; margin: -6px auto 14px; color: #a99c86; font-size: .78rem; line-height: 1.7; letter-spacing: .04em; }
#l-shiori[hidden] { display: none !important; }
