/* ============================================================
   ByAR Camera Kit UI — 共通スタイル
   8本の体験で共用する。体験ごとの違いは config.js だけ。
   ============================================================ */
:root{
  --tl:#2aa198;      /* ByAR のティール */
  --ink:#0b1b22;
}
*{box-sizing:border-box}

/* ★ 消すな。
   #preview や .gate に display を指定しているため、これが無いと
   ID セレクタの優先度がブラウザ標準の [hidden]{display:none} に勝ち、
   隠したはずのオーバーレイが最前面に出たまま操作できなくなる。
   2026-10-30 に旧 a.css 版で実際に起きた不具合がこれ。 */
[hidden]{display:none !important}

html,body{margin:0;height:100%;background:#000;overflow:hidden;
  font:15px/1.6 "Noto Sans JP",-apple-system,"Hiragino Kaku Gothic ProN",Meiryo,sans-serif;
  color:#fff;-webkit-tap-highlight-color:transparent;word-break:auto-phrase}
body{display:grid;place-items:center}

/* ---- ステージ ----
   高さは常に画面いっぱい。幅は「画面幅」と「9:16 ぶんの幅」の小さい方。
     ・スマホ縦（9:16 より縦長）… 画面幅いっぱい＝ほぼ全画面
     ・PC・横画面              … 9:16 に収まり、左右が黒のレターボックス
   9:16 より横長にはならないので、レンズの絵が横に伸びることはない。 */
.stage{position:relative;overflow:hidden;background:var(--ink);
  height:100dvh;width:min(100vw, calc(100dvh * 9 / 16))}

#canvas{position:absolute;inset:0;width:100%;height:100%;display:block;
  object-fit:cover;touch-action:manipulation}

/* ---- 操作 ---- */
.ui{position:absolute;inset:0;z-index:20;pointer-events:none}
.ui-top{position:absolute;top:0;right:0;padding:calc(14px + env(safe-area-inset-top)) 14px 0 0;
  pointer-events:auto}
.ui-bottom{position:absolute;left:0;right:0;bottom:0;
  padding:0 20px calc(18px + env(safe-area-inset-bottom));
  display:flex;flex-direction:column;align-items:center;gap:7px;pointer-events:auto}

.icon{width:46px;height:46px;border:0;border-radius:50%;background:rgba(10,22,28,.5);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  display:grid;place-items:center;cursor:pointer}
.icon svg{width:23px;height:23px;fill:#fff}
.icon:active{transform:scale(.93)}

.shutter{position:relative;width:80px;height:80px;border:0;background:transparent;padding:0;
  display:grid;place-items:center;cursor:pointer}
.shutter .ring{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.ring-bg{fill:none;stroke:rgba(255,255,255,.28);stroke-width:5}
.ring-fg{fill:none;stroke:#fff;stroke-width:5;stroke-linecap:round;
  stroke-dasharray:226;stroke-dashoffset:226;transition:stroke-dashoffset .1s linear}
.shutter.rec .ring-fg{stroke:#e04444}
.shutter .dot{width:56px;height:56px;border-radius:50%;background:#fff;transition:all .18s}
.shutter.rec .dot{width:30px;height:30px;border-radius:9px;background:#e04444}
.shutter:active .dot{transform:scale(.92)}

.shutter-note{font-size:12.5px;opacity:.9;text-shadow:0 2px 10px rgba(0,0,0,.7)}
.rectime{font-size:13px;font-weight:700;color:#ff8080;letter-spacing:.06em;
  text-shadow:0 2px 10px rgba(0,0,0,.7)}

/* ---- プレビュー ---- */
.preview{position:absolute;inset:0;z-index:50;background:#000;
  display:flex;flex-direction:column}
.preview-media{flex:1;min-height:0;display:grid;place-items:center;background:#0a1014}
.preview-media img,.preview-media video{width:100%;height:100%;object-fit:contain}
.preview-btns{padding:14px 16px calc(14px + env(safe-area-inset-bottom));
  display:flex;gap:9px;justify-content:center;align-items:center;flex-wrap:wrap}
.btn{display:inline-block;padding:12px 22px;border-radius:999px;border:0;cursor:pointer;
  background:var(--tl);color:#fff;font:inherit;font-size:14px;font-weight:700;text-decoration:none}
.btn-ghost{background:rgba(255,255,255,.12);color:#fff}
.btn:active{transform:scale(.96)}

/* ---- 読み込み中／はじめる ---- */
.gate{position:absolute;inset:0;z-index:60;display:grid;place-items:center;
  background:radial-gradient(ellipse at center,#15323b,#06121a);padding:28px}
.gate-in{text-align:center;max-width:320px}
.spin{width:42px;height:42px;margin:0 auto 18px;border-radius:50%;
  border:4px solid rgba(255,255,255,.2);border-top-color:var(--tl);
  animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.gate-ttl{font-size:17px;font-weight:800;letter-spacing:.03em}
.gate-sub{margin-top:9px;font-size:13px;opacity:.85;line-height:1.8}
.bar{margin:18px auto 0;width:180px;height:4px;border-radius:999px;background:rgba(255,255,255,.18);overflow:hidden}
.bar span{display:block;height:100%;width:0;border-radius:999px;background:var(--tl);transition:width .4s ease}
.start{margin-top:22px;padding:15px 52px;border:0;border-radius:999px;cursor:pointer;
  background:#fff;color:#0b1b22;font:inherit;font-size:17px;font-weight:800;letter-spacing:.04em}
.start:active{transform:scale(.96)}
.gate-hint{margin-top:14px;font-size:12.5px;opacity:.8;line-height:1.75}

.err{position:absolute;inset:0;z-index:70;display:grid;place-items:center;padding:28px;
  text-align:center;background:#0b1b22;font-size:14px;line-height:1.9}

/* 画面が狭いときは文字とボタンを少し詰める */
@media (max-height:560px){
  .shutter{width:66px;height:66px}
  .shutter .dot{width:46px;height:46px}
  .gate-sub,.gate-hint{font-size:12px}
}
