:root{
  --tl:#2aa198;
  --ink:#0b1b22;
}
*{box-sizing:border-box}
/* .err / .preview / .hint に display を指定しているので、これが無いと
   ブラウザ標準の [hidden]{display:none} に勝ってしまい、隠したはずの
   オーバーレイが出続ける。 */
[hidden]{display:none !important}
html,body{margin:0;height:100%;background:var(--ink);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}
#gl{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}

/* ---- 読み込み中 ---- */
.load{position:fixed;inset:0;display:grid;place-items:center;z-index:20;
  background:radial-gradient(ellipse at 50% 35%,#15303a,#070f14 72%);transition:opacity .35s}
.load.off{opacity:0;pointer-events:none}
.load-in{text-align:center}
.spin{width:38px;height:38px;margin:0 auto 14px;border-radius:50%;
  border:3px solid rgba(255,255,255,.2);border-top-color:var(--tl);animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.load-tx{font-size:13.5px;opacity:.9}

/* ---- 顔待ちの案内 ---- */
.hint{position:fixed;inset:0 0 190px;display:grid;place-items:center;pointer-events:none;z-index:10;
  background:radial-gradient(ellipse at center,rgba(0,0,0,.05),rgba(0,0,0,.42));transition:opacity .35s}
.hint.off{opacity:0}
.hint-in{text-align:center;padding:0 24px;text-shadow:0 2px 14px rgba(0,0,0,.65)}
.hint-ttl{font-size:20px;font-weight:800;letter-spacing:.04em}
.hint-sub{margin-top:8px;font-size:13px;opacity:.92;line-height:1.75}

/* ---- 下の操作パネル ---- */
.panel{position:fixed;left:0;right:0;bottom:0;z-index:12;
  display:flex;flex-direction:column;gap:10px;
  padding:12px 12px calc(10px + env(safe-area-inset-bottom));
  background:none}

.items{display:flex;gap:6px;justify-content:center;overflow-x:auto;scrollbar-width:none}
.items::-webkit-scrollbar{display:none}
.item{flex:0 0 auto;display:flex;align-items:center;gap:5px;padding:7px 9px;cursor:pointer;
  border-radius:999px;border:1px solid rgba(255,255,255,.26);background:rgba(10,22,28,.55);
  color:#fff;font:inherit;font-size:11.5px;font-weight:700;line-height:1;white-space:nowrap}
.item[aria-selected="true"]{border-color:var(--tl);background:rgba(42,161,152,.22)}
.item .dot{width:9px;height:9px;border-radius:50%;background:#555;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35)}
.item[data-on="0"]{opacity:.5}

.colors{display:flex;gap:9px;justify-content:center;flex-wrap:nowrap;
  overflow-x:auto;padding:2px;scrollbar-width:none}
.colors::-webkit-scrollbar{display:none}
.sw{flex:0 0 auto;width:38px;height:38px;border-radius:50%;padding:0;cursor:pointer;
  border:2px solid rgba(255,255,255,.3);display:grid;place-items:center;
  color:#fff;font-size:10.5px;font-weight:700}
.sw[aria-pressed="true"]{border-color:#fff;box-shadow:0 0 0 2px rgba(42,161,152,.75)}
.sw:active{transform:scale(.93)}
.sw.none{background:rgba(10,22,28,.6)}

.ui{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 10px}
.icon{width:46px;height:46px;border:0;border-radius:23px;background:rgba(10,22,28,.6);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);display:grid;place-items:center;
  cursor:pointer;color:#fff;font:inherit;font-size:12.5px;font-weight:700}
.icon.wide{width:64px}
.icon svg{width:23px;height:23px;fill:#fff}
.icon:active{transform:scale(.93)}
.icon.on{background:var(--tl)}

.shutter{width:72px;height:72px;border-radius:50%;border:4px solid rgba(255,255,255,.92);
  background:transparent;display:grid;place-items:center;cursor:pointer;padding:0;flex:0 0 auto}
.shutter span{width:54px;height:54px;border-radius:50%;background:#fff;transition:all .18s}
.shutter.rec span{width:28px;height:28px;border-radius:8px;background:#e04444}
.shutter:active span{transform:scale(.92)}

/* ---- 小さな通知 ---- */
.toast{position:fixed;left:50%;bottom:210px;transform:translateX(-50%);z-index:15;
  padding:8px 16px;border-radius:999px;background:rgba(6,14,18,.82);font-size:13px;
  transition:opacity .3s;pointer-events:none}
.toast.off{opacity:0}

/* ---- プレビュー ---- */
.preview{position:fixed;inset:0;background:rgba(6,14,18,.93);display:grid;place-items:center;z-index:30;padding:20px}
.preview-box{width:100%;max-width:380px;text-align:center}
.preview img,.preview video{width:100%;border-radius:12px;background:#000}
.preview-btns{margin-top:14px;display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.btn{display:inline-block;padding:11px 24px;border-radius:9px;border:0;cursor:pointer;
  background:var(--tl);color:#fff;font:inherit;font-weight:700;text-decoration:none}
.btn-ghost{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.4)}

.err{position:fixed;inset:0;display:grid;place-items:center;padding:30px;text-align:center;
  background:var(--ink);z-index:40;font-size:14.5px;line-height:1.9}

/* 画面が低いときは詰める */
@media (max-height:680px){
  .panel{gap:7px;padding-top:8px}
  .sw{width:33px;height:33px}
  .shutter{width:62px;height:62px}
  .shutter span{width:46px;height:46px}
  .hint{inset:0 0 170px}
}

/* ---- 鏡（縦長に固定する。PCでも横に広がらない） ---- */
:root{--panel:206px;--x:min(calc(100vw - 92px),calc((100dvh - var(--panel) - 20px)*.6))}
html,body{background:radial-gradient(ellipse at 50% 30%,#8a5468,#3b2230 75%)}
#stage{position:fixed;inset:0 0 var(--panel) 0;margin:auto;width:var(--x);height:calc(var(--x)*4/3);z-index:1}
#gl{position:absolute;inset:0;clip-path:url(#mirrorClip);background:#20131a}
#frame{position:absolute;left:-13.33%;top:-15%;width:126.67%;height:125%;pointer-events:none;overflow:visible}
@media (min-aspect-ratio:1/1){
  :root{--x:min(calc(100vw - 500px),calc((100dvh - 24px)*.6))}
  #stage{inset:0 420px 0 0}
  .hint{inset:0 420px 0 0}
}
@media (min-aspect-ratio:1/1){
  .panel{left:auto;right:0;top:0;bottom:0;width:420px;justify-content:center;gap:16px}
  .items{flex-wrap:wrap}
  .colors{flex-wrap:wrap}
  .toast{left:calc(100% - 210px);bottom:auto;top:18%}
}
.hint{background:none}
@media (min-aspect-ratio:1/1){:root{--x:min(calc(100vw - 500px),calc((100dvh - 24px)*.56))}}
