/* 116 ミイラころがし：夜空の藍の石に階段の角、砂の文字、土の赤のボタン。パネルは 1 枚だけ（題名・結果・ランキング）。色はここだけに書く。 */
@font-face { font-family: "MRDela"; src: url("dela.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "MRBody"; src: url("mplus2.woff2") format("woff2"); font-display: swap; }
:root { --sky: #1D3557; --ink: #17213A; --sand: #E9C46A; --linen: #F4EFE6; --clay: #C4553B; --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--sky); overflow: hidden; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; font-family: "MRBody", "Hiragino Sans", "Noto Sans JP", sans-serif; color: var(--linen); }
#lg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
[hidden] { display: none !important; }
button, a, input { font: inherit; }

/* パネル：階段の角（ピラミッド）の 1 枚の石 */
.panel { position: fixed; left: 50%; top: calc(var(--safe-t) + 20px); transform: translateX(-50%); width: min(88vw, 420px); max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 24px); padding: 26px 24px 22px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; background: var(--sand); clip-path: polygon(0 16px, 8px 16px, 8px 8px, 16px 8px, 16px 0, calc(100% - 16px) 0, calc(100% - 16px) 8px, calc(100% - 8px) 8px, calc(100% - 8px) 16px, 100% 16px, 100% calc(100% - 16px), calc(100% - 8px) calc(100% - 16px), calc(100% - 8px) calc(100% - 8px), calc(100% - 16px) calc(100% - 8px), calc(100% - 16px) 100%, 16px 100%, 16px calc(100% - 8px), 8px calc(100% - 8px), 8px calc(100% - 16px), 0 calc(100% - 16px)); }
.panel::before { content: ""; position: absolute; inset: 3px; z-index: 0; background: var(--sky); clip-path: inherit; }
.panel > * { position: relative; z-index: 1; }

h1 { font: 400 clamp(28px, 9.4vw, 38px)/1.1 "MRDela", sans-serif; color: var(--sand); text-align: center; padding-top: 6px; white-space: nowrap; }
.how { font-weight: 700; font-size: 17px; line-height: 1.55; text-align: center; }
.big { min-height: 72px; padding: 8px 16px; background: var(--clay); color: var(--linen); border: 3px solid var(--ink); border-radius: 3px; font: 400 clamp(28px, 8vw, 34px)/1.1 "MRDela", sans-serif; box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform 60ms ease-out, box-shadow 60ms ease-out; }
.big:active { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.sub { display: flex; align-items: center; justify-content: center; flex: 1 1 0; min-height: 52px; padding: 8px 10px; background: var(--sand); color: var(--ink); border: 3px solid var(--ink); border-radius: 3px; font-weight: 800; font-size: 17px; text-decoration: none; cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
.sub:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.link { align-self: center; min-height: 44px; padding: 8px 16px; background: none; border: 0; color: var(--sand); font-weight: 700; font-size: 16px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row { display: flex; gap: 10px; }

/* 遊ぶ：距離とひとやすみだけ */
#hud { position: fixed; left: 16px; right: 16px; top: calc(var(--safe-t) + 10px); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
#dist { font-family: "MRDela", sans-serif; color: var(--ink); -webkit-text-stroke: 7px var(--linen); paint-order: stroke fill; line-height: 1; display: flex; align-items: baseline; gap: 6px; }
#dist b { font-weight: 400; font-size: clamp(34px, 13vw, 52px); font-variant-numeric: tabular-nums; }
#dist small { font-size: clamp(18px, 6vw, 26px); }
#dist.long b { font-size: clamp(30px, 10.5vw, 46px); }
#pause-btn { white-space: nowrap; pointer-events: auto; min-height: 44px; padding: 8px 12px; background: var(--sky); color: var(--linen); border: 2px solid var(--sand); border-radius: 3px; font-weight: 700; font-size: 14px; cursor: pointer; }

/* 結果：大きな距離＋名前＋一言 */
.num { color: var(--sand); font-family: "MRDela", sans-serif; text-align: center; line-height: 1.5; padding-top: 2px; }
.num b { font-weight: 400; font-size: clamp(52px, 17vw, 84px); font-variant-numeric: tabular-nums; }
.num small { font-size: clamp(24px, 6vw, 30px); margin-left: 6px; }
.num { white-space: nowrap; }
h2 { font-weight: 800; font-size: 26px; line-height: 1.25; text-align: center; color: var(--linen); }
.stop { font-weight: 800; font-size: 19px; line-height: 1.25; text-align: center; color: var(--sand); }
.small { font-weight: 700; font-size: 14px; line-height: 1.3; text-align: center; color: var(--sand); margin-bottom: 6px; }
.line { font-weight: 700; font-size: 17px; line-height: 1.35; text-align: center; }
#flash { position: fixed; inset: 0; z-index: 15; background: var(--linen); opacity: 0; pointer-events: none; }
#flash.on { animation: fl 280ms ease-out; }
@keyframes fl { from { opacity: 1; } to { opacity: 0; } }

/* ランキング */
.tabs { display: flex; gap: 8px; padding-top: 12px; }
.tab { flex: 1 1 0; min-height: 44px; background: none; color: var(--sand); border: 2px solid var(--sand); border-radius: 3px; font-weight: 800; font-size: 17px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--sand); color: var(--ink); }
#name-form { display: flex; gap: 8px; }
#name { flex: 1 1 auto; min-width: 0; height: 52px; padding: 0 10px; background: var(--linen); color: var(--ink); border: 3px solid var(--ink); border-radius: 3px; font-size: 17px; font-weight: 700; user-select: text; -webkit-user-select: text; }
#name-form .sub { flex: 0 0 auto; padding: 8px 16px; }
#rows { list-style: none; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; touch-action: pan-y; }
#rows li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px dashed rgba(233, 196, 106, .5); font-size: 17px; font-weight: 700; }
#rows li.me { color: var(--sand); }
#rows .r { font-family: "MRDela", sans-serif; text-align: right; }
#rows .n { overflow-wrap: anywhere; line-height: 1.2; }
#rows .s { font-variant-numeric: tabular-nums; }
#rows-msg { text-align: center; font-weight: 700; padding: 12px 0; }

/* 読み込み */
#load { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--sky); transition: opacity .25s ease; }
#load.done { opacity: 0; pointer-events: none; }
#load p { font: 400 clamp(26px, 8vw, 40px)/1.1 "MRDela", sans-serif; color: var(--sand); }
#bar { width: min(60vw, 260px); height: 12px; border: 2px solid var(--sand); border-radius: 2px; }
#fill { width: 4%; height: 100%; background: var(--clay); transition: width .12s linear; }
#err { font: 700 14px/1.5 sans-serif; color: var(--linen); padding: 0 24px; text-align: center; }

@media (min-width: 1024px) { .panel { width: 420px; top: calc(var(--safe-t) + 6vh); } }
/* 題名だけ：パネルは下（遠くのピラミッドとメムが見える）。PC は左 */
@media (orientation: portrait) { #title { top: auto; bottom: calc(var(--safe-b) + 18px); } }
@media (min-width: 1024px) { #title { left: 5vw; transform: none; } }
/* 背の低い縦画面：パネルを詰めて、ジャハとメムの顔を隠さない */
@media (max-height: 640px) and (orientation: portrait) {
  .panel { top: calc(var(--safe-t) + 8px); padding: 14px 24px 10px; gap: 6px; }
  .num b { font-size: clamp(44px, 15vw, 62px); } .num { line-height: 1.3; }
  h2 { font-size: 20px; } .stop { font-size: 16px; } .line { font-size: 14px; } .small { font-size: 13px; margin: 0; }
  .sub { min-height: 46px; font-size: 15px; } .link { min-height: 40px; padding: 4px 16px; font-size: 14px; }
  h1 { padding-top: 42px; } .how { font-size: 15px; line-height: 1.4; }
  .mini { top: 12px; right: 14px; }
  .big { min-height: 58px; }
}
/* スマホ横持ち：パネルは左に。主役は右に見える */
@media (max-height: 500px) and (orientation: landscape) {
  .panel { left: calc(env(safe-area-inset-left, 0px) + 16px); transform: none; top: calc(var(--safe-t) + 8px); width: 400px; padding: 14px 18px 10px; gap: 6px; max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 16px); }
  .panel::before { inset: 3px; }
  h1 { font-size: 26px; padding: 6px 90px 0 0; text-align: left; }
  .mini { top: 12px; right: 12px; }
  .how { font-size: 14px; text-align: left; }
  .big { min-height: 52px; font-size: 24px; box-shadow: 0 4px 0 var(--ink); }
  .num b { font-size: 48px; } .num small { font-size: 22px; } .num { padding-top: 0; line-height: 1.45; }
  h2 { font-size: 20px; } .stop { font-size: 15px; } .line { font-size: 14px; margin: 0; } .small { margin: 0; }
  .sub { min-height: 44px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
  .link { min-height: 44px; padding: 4px 16px; font-size: 14px; }
  .tabs { padding-top: 0; } .tab { min-height: 44px; font-size: 14px; }
  #name { height: 44px; font-size: 14px; }
  #rows li { min-height: 34px; font-size: 14px; }
}

/* ---- 2026-11-10：音（ON／OFF と音量）・移動・全画面の結果とランキング・押した手ごたえ ---- */
.snd { display: flex; align-items: center; gap: 12px; }
.snd-t { flex: 0 0 auto; min-width: 64px; min-height: 44px; padding: 6px 12px; background: var(--sand); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.snd-t[aria-pressed="false"] { background: transparent; color: var(--sand); border-color: var(--sand); box-shadow: none; }
.snd-t[aria-pressed="false"]::after { content: " OFF"; }
.snd-t[aria-pressed="true"]::after { content: " ON"; }
.snd-v { flex: 1 1 auto; min-width: 0; height: 44px; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.snd-v::-webkit-slider-runnable-track { height: 10px; background: linear-gradient(90deg, var(--clay) var(--v, 80%), rgba(244, 239, 230, .25) var(--v, 80%)); border: 2px solid var(--ink); border-radius: 2px; }
.snd-v::-moz-range-track { height: 10px; background: rgba(244, 239, 230, .25); border: 2px solid var(--ink); }
.snd-v::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; background: var(--sand); border: 3px solid var(--ink); border-radius: 2px; transform: rotate(45deg); }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 4px; }
.ptitle { font: 400 26px/1.2 "MRDela", sans-serif; color: var(--sand); text-align: center; padding-top: 6px; }
.sub.warn { background: var(--clay); color: var(--linen); }
#confirm { display: flex; flex-direction: column; gap: 8px; }
#confirm[hidden] { display: none !important; }

/* 押した手ごたえ：沈んで横に広がり、離すと少し跳ねて戻る（音は Unity の UI 音） */
.big, .sub, .tab, .snd-t, .link { transition: transform 70ms ease-out, box-shadow 70ms ease-out; }
.is-down.big { transform: translateY(6px) scale(1.03, .9); box-shadow: 0 0 0 var(--ink); }
.is-down.sub, .is-down.snd-t { transform: translateY(4px) scale(1.03, .9); box-shadow: 0 0 0 var(--ink); }
.is-down.tab, .is-down.link { transform: scale(.94); }
.is-pop { animation: pop 260ms cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: translateY(4px) scale(1.05, .88); } 55% { transform: translateY(-3px) scale(.97, 1.06); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .is-pop { animation: none; } }

/* 全画面（結果・ランキング）：藍の夜空にピラミッドの段。文字はこのゲームの書体だけ */
.full { position: fixed; inset: 0; z-index: 8; display: flex; justify-content: center; align-items: center; padding: calc(var(--safe-t) + 18px) 22px calc(var(--safe-b) + 18px);
  background:
    repeating-linear-gradient(180deg, transparent 0 46px, rgba(233, 196, 106, .06) 46px 48px),
    var(--sky); }
.full::before { content: ""; position: absolute; left: 50%; bottom: 0; width: min(150vw, 900px); height: 42vh; transform: translateX(-50%); background: #24426c; border-top: 0;
  clip-path: polygon(50% 0, 54% 0, 54% 8%, 58% 8%, 58% 16%, 62% 16%, 62% 24%, 66% 24%, 66% 32%, 70% 32%, 70% 40%, 74% 40%, 74% 48%, 78% 48%, 78% 56%, 82% 56%, 82% 64%, 86% 64%, 86% 72%, 90% 72%, 90% 80%, 94% 80%, 94% 88%, 98% 88%, 98% 100%, 2% 100%, 2% 88%, 6% 88%, 6% 80%, 10% 80%, 10% 72%, 14% 72%, 14% 64%, 18% 64%, 18% 56%, 22% 56%, 22% 48%, 26% 48%, 26% 40%, 30% 40%, 30% 32%, 34% 32%, 34% 24%, 38% 24%, 38% 16%, 42% 16%, 42% 8%, 46% 8%, 46% 0); pointer-events: none; }
.full .inner { position: relative; width: min(100%, 440px); max-height: 100%; display: flex; flex-direction: column; gap: 14px; }
.hero { display: flex; flex-direction: column; gap: 6px; }
.acts { display: flex; flex-direction: column; gap: 12px; }
.kicker { font-weight: 800; font-size: 17px; line-height: 1.3; letter-spacing: .08em; color: var(--sand); text-align: center; }
.kicker.clear, .rank-inner > .kicker { font: 400 17px/1.3 "MRDela", sans-serif; letter-spacing: .16em; }
.links .link { padding: 8px 10px; }
.full .num { border-top: 2px solid rgba(233, 196, 106, .55); border-bottom: 2px solid rgba(233, 196, 106, .55); padding: 6px 0 2px; }
.full .stop { font-size: 22px; color: var(--linen); }
.full .line { color: var(--sand); }
.full .small { color: rgba(244, 239, 230, .78); letter-spacing: .04em; }
.rank-inner { height: 100%; max-height: 720px; }
.rank-inner .tabs { padding-top: 0; }
.sub.close { flex: 0 0 auto; }
/* 横持ち：結果は 2 列（左に数字、右にボタン） */
@media (max-height: 500px) and (orientation: landscape) {
  .full { padding: calc(var(--safe-t) + 8px) 18px calc(var(--safe-b) + 8px); }
  #result .inner { width: min(100%, 780px); flex-direction: row; align-items: center; gap: 26px; }
  #result .hero, #result .acts { flex: 1 1 0; min-width: 0; }
  .full .num b { font-size: 52px; } .full .stop { font-size: 17px; } .kicker { font-size: 13px; }
  .rank-inner { width: min(100%, 560px) !important; gap: 6px; }
  .rank-inner .kicker { display: none; }
  .snd { gap: 8px; } .ptitle { display: none; }
  #pause { gap: 6px; }
}
@media (max-height: 640px) and (orientation: portrait) {
  .full .inner { gap: 8px; } .full .stop { font-size: 18px; } .acts { gap: 8px; }
  .rank-inner .kicker { display: none; }
  .ptitle { font-size: 20px; } #pause { gap: 6px; }
}

/* 収蔵室：中央の実3Dを主役にする。画像は同じ実モデルのカメラ出力。 */
#gallery { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: transparent; padding: calc(var(--safe-t) + 12px) 20px calc(var(--safe-b) + 12px); gap: 12px; color: var(--linen); }
.museum-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex: 0 0 auto; }
.museum-head h2 { text-align: left; font: 400 24px/1.3 "MRDela",sans-serif; color: var(--sand); }
.museum-head h2 span { font: 700 15px/1.3 "MRBody",sans-serif; white-space: nowrap; margin-left: 10px; }
.museum-eyebrow { font-size: 11px; letter-spacing: .14em; color: var(--sand); line-height: 1.6; }
.museum-head .sub { flex: 0 0 auto; min-height: 44px; min-width: 78px; font-size: 14px; padding: 5px 10px; }
.museum-body { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); flex: 1 1 auto; min-height: 0; gap: 28px; }
.museum-view { display: flex; flex-direction: column; min-height: 0; }
#relic-view { position: relative; flex: 1 1 auto; min-height: 80px; touch-action: none; cursor: grab; outline-offset: -4px; }
#relic-view:active { cursor: grabbing; }
#relic-view.loading { background: #0e1622; }
#museum-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; background: #0e1622; }
.relic-description { flex: 0 0 auto; padding: 14px 14px 6px; background: #0e1622; border-top: 1px solid rgba(233,196,106,.4); }
.relic-description h3 { font-size: clamp(18px,2.4vw,27px); line-height: 1.5; color: var(--sand); overflow-wrap: anywhere; }
#relic-material { font-size: 12px; color: rgba(244,239,230,.68); margin: 4px 0 10px; }
#relic-story { font-size: 14px; line-height: 1.8; max-width: 48em; }
.rotate-hint { font-size: 10px; color: rgba(244,239,230,.5); margin-top: 8px; }
.museum-inventory { display: flex; flex-direction: column; min-height: 0; background: #0e1622; padding: 12px; }
.inventory-label { font-size: 12px; color: var(--sand); padding: 0 2px 10px; flex: 0 0 auto; }
#relic-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-content: start; gap: 8px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; min-height: 0; flex: 1 1 auto; padding: 3px; scrollbar-color: var(--sand) transparent; }
.relic-card { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 112px; border: 1px solid rgba(233,196,106,.15); background: #111c2b; color: rgba(244,239,230,.6); padding: 6px 4px; cursor: pointer; text-align: center; touch-action: pan-y; }
.relic-card[aria-pressed="true"] { border: 2px solid var(--sand); padding: 5px 3px; background: #1b2c40; }
.relic-card.owned { color: var(--linen); }
.relic-card img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; pointer-events: none; }
.relic-serial { position: absolute; top: 4px; left: 6px; font-size: 10px; color: var(--sand); }
.relic-card-name { font-size: 11px; line-height: 1.5; padding: 4px 2px 2px; overflow-wrap: anywhere; }
.museum-note { font-size: 10px; line-height: 1.6; color: rgba(244,239,230,.6); padding-top: 10px; flex: 0 0 auto; }
@media (max-width: 700px) and (orientation: portrait) {
 #gallery { padding: calc(var(--safe-t) + 8px) 12px calc(var(--safe-b) + 8px); gap: 8px; }
 .museum-head h2 { font-size: 21px; }.museum-head .museum-eyebrow { display: none; }
 .museum-body { grid-template-columns: 1fr; grid-template-rows: minmax(0,1.25fr) minmax(0,1fr); gap: 10px; }
 #relic-view { min-height: 60px; }
 .relic-description { padding: 8px 4px 0; }.relic-description h3 { font-size: 17px; line-height: 1.35; }
 #relic-material { font-size: 10px; margin: 2px 0 4px; }#relic-story { font-size: 11px; line-height: 1.65; }
 .rotate-hint { margin-top: 4px; font-size: 9px; }
 .museum-inventory { padding: 6px; }.inventory-label { padding-bottom: 5px; }
 #relic-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }.relic-card { min-height: 88px; }
 .relic-card-name { font-size: 9px; }.museum-note { font-size: 9px; padding-top: 5px; }
}
@media (max-height: 500px) and (orientation: landscape) {
 #gallery { padding: calc(var(--safe-t) + 6px) 12px calc(var(--safe-b) + 6px); gap: 4px; }
 .museum-head h2 { font-size: 18px; }.museum-head .museum-eyebrow { display: none; }.museum-head .sub { min-height: 40px; }
 .museum-body { gap: 12px; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); }
 .relic-description { padding: 6px 4px 0; }.relic-description h3 { font-size: 15px; }#relic-material { font-size: 10px; margin: 0 0 3px; }#relic-story { font-size: 11px; line-height: 1.45; }.rotate-hint { display: none; }
 .museum-inventory { padding: 6px; }#relic-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }.relic-card { min-height: 84px; }.relic-card-name { font-size: 9px; }.museum-note { font-size: 8px; padding-top: 4px; }.inventory-label { padding-bottom: 3px; }
}
