/* 画面の文字は小さく・端に寄せる（見せ場は 3D の絵。文字で隠さない） */
html, body { margin: 0; height: 100%; background: #0d1116; overflow: hidden; touch-action: none; }
body { font: 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #fff; -webkit-user-select: none; user-select: none; }
#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#title { position: absolute; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); text-shadow: 0 1px 6px rgba(0,0,0,.45); }
#title h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .02em; }
#title p { margin: 2px 0 0; font-size: 13px; opacity: .85; transition: opacity .6s; }
#buttons { position: absolute; right: max(16px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#buttons button[hidden] { display: none; }
#rebuild, #autocam { pointer-events: auto;
  font: 600 14px/1 inherit; font-family: inherit; color: #fff; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35);
  background: rgba(20,26,34,.42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; }
#rebuild:active, #autocam:active { transform: scale(.96); }
#autocam { font-size: 12px; padding: 8px 13px; }
/* 操作の説明: 小さく薄く。マウスの端末は .fine、指の端末は .coarse だけ出す */
#help { margin: 4px 0 0; font-size: 11px; opacity: .7; }
/* 右上のボタンと重ならないように、題と説明は右のボタンの手前で折り返す（スマホ幅で説明の 1 行が Rebuild の下に潜った・2026-11-02） */
#title { max-width: calc(100% - 150px); }
#help .coarse { display: none; }
@media (pointer: coarse) { #help .fine { display: none; } #help .coarse { display: inline; } }
#note { position: absolute; left: 50%; transform: translateX(-50%); top: max(64px, calc(env(safe-area-inset-top) + 56px)); font-size: 12px;
  padding: 6px 12px; border-radius: 999px; background: rgba(20,26,34,.55); white-space: nowrap; }
#credit { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); max-width: calc(100% - 24px);
  text-align: right; font-size: 11px; opacity: .78; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-size: 14px; opacity: .7; pointer-events: none; }
@media (max-width: 600px) { #title h1 { font-size: 17px; } #credit { font-size: 10px; } }

/* 物理のつまみ（Physics パネル・2026-11-03 直し 3）。右上のボタンの列の一番下。
   ボタンと同じすりガラス。スマホは畳んで始める（knobs.js）。開いても画面の右 ~250px だけ */
/* 畳んだときは Rebuild と同じ小さな丸ボタン（幅いっぱいにすると、スマホ幅で左の操作の説明にかぶった・2026-11-03）。開いたら 236px */
#buttons { z-index: 2; } /* 開いたパネルが WebGL 2 の一言（#note）より上に来るように */
#physics { pointer-events: auto; width: auto; border-radius: 16px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(20,26,34,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; }
#physics[open] { width: 236px; }
#physics summary { list-style: none; cursor: pointer; padding: 8px 13px; font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 6px; }
#physics summary::-webkit-details-marker { display: none; }
#physics summary::after { content: ''; margin-left: auto; width: 6px; height: 6px; border-right: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
  transform: rotate(45deg) translate(-2px, -2px); opacity: .8; transition: transform .2s; }
#physics[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
/* 既定から変えた値があるときの印（畳んでいても分かる） */
#physics summary i { width: 6px; height: 6px; border-radius: 50%; background: #ffb35c; }
#physics summary i[hidden] { display: none; }
#physics .body { padding: 0 13px 10px; display: grid; gap: 7px; }
#physics .knob.range, #physics .knob.log { display: grid; grid-template-columns: 1fr auto; row-gap: 2px; }
#physics .knob .name { opacity: .8; }
#physics .knob b { font-weight: 600; font-variant-numeric: tabular-nums; }
#physics .knob.changed b { color: #ffc27a; }
#physics input[type=range] { grid-column: 1 / -1; width: 100%; margin: 0; height: 18px; accent-color: #ffb35c; touch-action: pan-x; }
#physics .knob.toggle { display: flex; gap: 7px; align-items: center; opacity: .9; cursor: pointer; }
#physics input[type=checkbox] { margin: 0; accent-color: #ffb35c; }
#physics .foot { display: flex; gap: 6px; margin-top: 2px; }
#physics .foot button { flex: 1; font: 600 11px/1 inherit; font-family: inherit; color: #fff; padding: 7px 6px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); cursor: pointer; }
#physics .tip { margin: 0; font-size: 10.5px; opacity: .6; }
/* スマホ幅: 開いたパネルを細く・行を詰める（開いても塔の左半分は見える） */
@media (max-width: 600px) {
  #physics[open] { width: 196px; }
  #physics .body { gap: 4px; padding: 0 11px 8px; }
  #physics .knob { font-size: 11px; }
  #physics input[type=range] { height: 16px; }
  #physics .tip { display: none; }
}
/* スマホ幅: WebGL 2 の一言（#note）は下のクレジットの上へ。上の真ん中だと操作の説明と Physics のボタンに重なった（2026-11-03） */
@media (max-width: 600px) { #note { top: auto; bottom: max(48px, calc(env(safe-area-inset-bottom) + 40px)); } }

/* ---- 直し 4（2026-11-03・Meshlet 版）: 左上の数字と切り替え・読み込みの棒。BILLION（r187-meshlet/public/style.css）と同じ見せ方 ---- */
#stats { margin-top: 10px; pointer-events: none; }
#stats .big { font-size: 34px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.05; }
#stats .sub { font-size: 11px; opacity: .75; text-transform: uppercase; letter-spacing: .08em; }
#stats .fpsrow { margin-top: 6px; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
#stats .fpsrow .unit { font-size: 11px; opacity: .7; margin-left: 4px; font-weight: 500; }
#stats .drawn { font-size: 11.5px; opacity: .85; font-variant-numeric: tabular-nums; margin-top: 2px; }
#stats .mode { font-size: 11px; opacity: .7; margin-top: 4px; }
#stats .mode.slow { color: #ffb08a; opacity: .95; }
#stats .toggles { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
#stats .toggles button { pointer-events: auto; font: 600 12px/1 inherit; font-family: inherit; color: #fff; padding: 8px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(20,26,34,.42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; }
#stats .toggles button.on { background: rgba(255,179,92,.28); border-color: rgba(255,200,130,.75); }
#stats .toggles button:disabled { opacity: .4; cursor: default; }
#loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; opacity: 1; background: #0d1116; }
#loading .ltitle { font-size: 22px; font-weight: 650; letter-spacing: .02em; }
#loading .lbar { width: min(320px, 70vw); height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
#loading .lbar i { display: block; height: 100%; width: 0; background: #ffb35c; transition: width .2s; }
#loading #loadtxt { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  #stats { margin-top: 6px; }
  #stats .big { font-size: 24px; }
  #stats .fpsrow { font-size: 16px; margin-top: 3px; }
  #stats .drawn, #stats .mode { font-size: 10px; }
  #stats .toggles button { font-size: 11px; padding: 7px 10px; }
}
/* スマホ幅: 左上の数字が画面の 1/3 を占めて塔にかぶった（2026-11-03 390×844 の写真）→ 説明の 1 行（mode）を隠し、行を詰める */
@media (max-width: 600px) {
  #stats .mode { display: none; }
  #stats .sub { font-size: 9.5px; letter-spacing: .05em; }
  #stats .toggles { margin-top: 5px; }
}
