/* ============================================================
   STYLE — 横持ちプレーヤー（1632×1024）v3
   ============================================================ */
:root {
  --female: rgba(255, 220, 230, .95);
  --male: rgba(180, 210, 255, .9);
  --tx1: #fff; --tx2: #aaa; --tx3: #666;
  --panel-w: 80px;
  --accent: #d48a8a;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: #000; height: 100%; }
body {
  color: #fff;
  font-family: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html, body { overscroll-behavior: none; }
#app { position: relative; margin: 0 auto; overflow: hidden; background: #000; }

/* ---- SCREENS ---- */
.scr { position: absolute; inset: 0; display: none; }
.scr.active { display: flex; animation: scrIn .35s ease; }
@keyframes scrIn { from { opacity: 0 } to { opacity: 1 } }
#scr-player.active { animation: none; }

/* ==========================================
   ロゴ・利き手
   ========================================== */
#scr-logo { align-items: center; justify-content: center; background: #000; }
#scr-logo { cursor: pointer; }
.logo-wrap { text-align: center; animation: logoFade var(--logo-sec, 1.8s) ease-in-out both; }
.logo-img { display: block; max-width: min(85vw, 900px); max-height: 75vh; object-fit: contain; }
.logo-img.hide, #logo-text.hide { display: none; }
.logo-mark { font-size: 32px; color: #888; margin-bottom: 8px; }
.logo-name { font-size: 14px; color: #555; letter-spacing: 4px; }
@keyframes logoFade { 0%{opacity:0} 25%{opacity:1} 80%{opacity:1} 100%{opacity:0} }

#scr-hand { align-items: center; justify-content: center; flex-direction: column; background: #000; gap: 20px; }
.hand-title { font-size: 14px; color: #ccc; letter-spacing: 1px; }
.hand-sub { font-size: 11px; color: #666; }
.hand-btns { display: flex; gap: 32px; justify-content: center; }
.hand-btn {
  background: none; border: 1px solid #333; border-radius: 12px;
  padding: 20px 28px; cursor: pointer; color: #aaa;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .2s, color .2s;
}
.hand-btn:active, .hand-btn:hover { border-color: #888; color: #fff; }
.hand-icon { font-size: 28px; }
.hand-label { font-size: 12px; letter-spacing: 1px; }
#hand-right .hand-icon, #hand-change-right .hand-icon { transform: scaleX(-1); }

/* ==========================================
   タイトル（パッケージ画像＋下中央メニュー）
   ========================================== */
#scr-title { background: #000; }
.title-blur { position: absolute; inset: -40px; background: #000 center / cover no-repeat; filter: blur(30px) brightness(.35); }
.title-bg { position: absolute; inset: 0; background: center / contain no-repeat; }
.title-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0)); pointer-events: none; }
.title-text { position: absolute; left: 0; right: 0; top: 30%; text-align: center; z-index: 2; pointer-events: none; }
.title-text.hide { display: none; }
.title-name { font-size: clamp(24px, 5vw, 44px); font-weight: 300; letter-spacing: .3em; color: rgba(255,255,255,.95); text-shadow: 0 0 30px rgba(0,0,0,.9); }
.title-circle { font-size: 11px; color: rgba(255,255,255,.6); letter-spacing: 4px; margin-top: 6px; text-shadow: 0 0 10px #000; }
.title-menu {
  position: absolute; left: 0; right: 0; bottom: 5%; z-index: 3;
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; padding: 0 16px;
  opacity: 0; transform: translateY(10px); transition: opacity .9s ease, transform .9s ease; pointer-events: none;
}
.title-menu.show { opacity: 1; transform: none; pointer-events: auto; }
/* 文字だけのメニュー。見た目は控えめ、押せる範囲は広く（高さ48px以上） */
.title-btn {
  position: relative; background: none; border: none; cursor: pointer;
  min-height: 48px; padding: 12px 22px; font-size: 14px; letter-spacing: .25em;
  color: rgba(255,255,255,.78); text-shadow: 0 1px 8px rgba(0,0,0,.9);
  transition: color .2s;
}
.title-btn + .title-btn::before { content: ''; position: absolute; left: 0; top: 50%; width: 1px; height: 14px; margin-top: -7px; background: rgba(255,255,255,.28); }
.title-btn::after { content: ''; position: absolute; left: 50%; right: 50%; bottom: 8px; height: 1px; background: rgba(255,255,255,.8); transition: left .25s, right .25s; }
.title-btn:hover, .title-btn:focus-visible { color: #fff; outline: none; }
.title-btn:hover::after, .title-btn:focus-visible::after { left: 22px; right: calc(22px - .25em); }
.title-btn:active { color: #fff; }
.title-btn-main { color: #fff; }
.title-btn.hide { display: none; }
.title-btn.hide + .title-btn::before { display: none; }
.title-rec { position: absolute; left: 3%; top: 4%; z-index: 3; display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 2px; color: rgba(255,255,255,.7); text-shadow: 0 0 6px #000; }
.title-rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #e03030; animation: recBlink 1.2s ease-in-out infinite; }
#title-date { margin-left: 8px; color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .title-btn { padding: 12px 14px; font-size: 13px; letter-spacing: .15em; } }

/* ==========================================
   立場選択・名前
   ========================================== */
#scr-role { flex-direction: column; align-items: center; justify-content: center; gap: 26px; background: radial-gradient(ellipse at center, #1a1014 0%, #000 70%); }
.role-head { font-size: 14px; color: #bbb; letter-spacing: 3px; }
.role-cards { display: flex; gap: 20px; }
.role-card {
  width: min(34vw, 260px); padding: 28px 18px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid #3a2a2e; color: #ddd;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: border-color .2s, background .2s, transform .2s;
}
.role-card:hover { border-color: var(--accent); background: rgba(212,138,138,.07); transform: translateY(-2px); }
.role-label { font-size: 20px; letter-spacing: 6px; font-weight: 500; }
.role-sub { font-size: 11px; color: #888; letter-spacing: 1px; line-height: 1.6; }
.role-back { position: absolute; top: 10px; left: 14px; }

#scr-name { align-items: center; justify-content: center; background: #000; }
.ni-box { text-align: center; width: 300px; }
.ni-label { font-size: 14px; color: #ddd; margin-bottom: 6px; letter-spacing: 1px; }
.ni-sub { font-size: 11px; color: #777; margin-bottom: 18px; line-height: 1.6; }
.ni-input {
  width: 100%; padding: 10px 12px; font-size: 18px; letter-spacing: 2px;
  background: #111; border: 1px solid #333; border-radius: 6px;
  color: #fff; text-align: center; font-family: inherit; outline: none;
  -webkit-user-select: text; user-select: text;
}
.ni-input:focus { border-color: #777; }
.ni-err { font-size: 11px; color: #c44; margin-top: 6px; visibility: hidden; }
.ni-err.show { visibility: visible; }
.ni-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.ni-next { padding: 9px 34px; font-size: 13px; background: rgba(255,255,255,.08); border: 1px solid #555; border-radius: 6px; color: #eee; cursor: pointer; }
.ni-ghost { background: none; border-color: #333; color: #888; }

/* ==========================================
   共通：中央ウィンドウ
   ========================================== */
.win { margin: auto; width: min(760px, 86%); max-height: 88%; display: flex; flex-direction: column; background: #121216; border: 1px solid #26262d; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); overflow: hidden; }
.win-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #18181d; border-bottom: 1px solid #22222a; }
.win-back { background: none; border: none; color: #8ab0ff; font-size: 18px; cursor: pointer; padding: 0 6px 0 0; line-height: 1; }
.win-body { flex: 1; overflow-y: auto; padding: 16px 20px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ==========================================
   フォルダ（寝取る側）
   ========================================== */
#scr-folder { background: radial-gradient(ellipse at center, #15151b 0%, #050507 75%); align-items: center; justify-content: center; }
.fd-icon { font-size: 14px; }
.fd-path { font-size: 13px; color: #ccc; letter-spacing: .5px; }
.fd-count { margin-left: auto; font-size: 11px; color: #666; }
.fd-notice { display: none; padding: 6px 14px; border-radius: 20px; background: rgba(80,140,255,.14); color: #9cc0ff; font-size: 12px; }
.fd-notice.show { display: block; animation: scrIn .5s ease; }
.fd-hero { width: 100%; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.fd-hint { font-size: 11px; color: #777; letter-spacing: 1px; min-height: 1em; }
.fd-others { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; opacity: .45; }
.fd-item { background: none; border: none; color: #bbb; cursor: pointer; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.fd-item.big { width: min(420px, 70%, calc(42vh * 1.594)); }
.fd-item.mid { width: min(200px, 30%, calc(26vh * 1.594)); }
.fd-item.small { width: min(104px, calc(13vh * 1.594)); cursor: default; }
.fd-thumb { position: relative; width: 100%; aspect-ratio: 1632/1024; border-radius: 6px; background: #1a1a1f center / cover no-repeat; overflow: hidden; }
.fd-thumb.blur::after { content: ''; position: absolute; inset: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background: rgba(0,0,0,.25); }
.fd-dur { position: absolute; right: 6px; bottom: 6px; z-index: 2; font-size: 10px; background: rgba(0,0,0,.7); padding: 1px 5px; border-radius: 3px; color: #ddd; }
.fd-play { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; font-size: 30px; color: rgba(255,255,255,.9); text-shadow: 0 0 14px rgba(0,0,0,.8); }
.fd-badge { position: absolute; left: 6px; top: 6px; z-index: 2; font-size: 9px; letter-spacing: 1px; background: #e04848; color: #fff; padding: 1px 6px; border-radius: 3px; }
.fd-item.big .fd-thumb { animation: fdPulse 2s ease-in-out infinite; }
@keyframes fdPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(212,138,138,0) } 50% { box-shadow: 0 0 0 3px rgba(212,138,138,.55) } }
.fd-item.new { animation: fdNew .6s ease both; }
@keyframes fdNew { from { opacity: 0; transform: scale(.92) } to { opacity: 1; transform: none } }
.fd-name { font-size: 11px; color: #ccc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-item.small .fd-name { font-size: 9px; color: #888; }
.fd-date { font-size: 10px; color: #666; }

/* ==========================================
   メール（寝取られる側）
   ========================================== */
#scr-mail { background: #000; }
.ml-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: radial-gradient(ellipse at 50% 40%, #1c1830 0%, #07060c 70%); }
.ml-clock { font-size: clamp(44px, 9vh, 72px); font-weight: 300; color: rgba(255,255,255,.9); letter-spacing: 2px; line-height: 1; }
.ml-date { font-size: 13px; color: rgba(255,255,255,.6); margin-bottom: 4vh; }
.ml-notif {
  width: min(440px, 76%); text-align: left; cursor: pointer;
  background: rgba(40,40,48,.78); border: 1px solid rgba(255,255,255,.08); border-radius: 14px;
  padding: 12px 16px; color: #eee; display: flex; flex-direction: column; gap: 3px;
  backdrop-filter: blur(12px); transform: translateY(-14px); opacity: 0; pointer-events: none;
}
.ml-notif.show { animation: notifIn .6s cubic-bezier(.2,.8,.2,1) forwards; pointer-events: auto; }
@keyframes notifIn { to { transform: none; opacity: 1 } }
.ml-notif-app { font-size: 11px; color: #aaa; display: flex; justify-content: space-between; }
.ml-notif-time { color: #777; }
.ml-notif-from { font-size: 14px; font-weight: 500; }
.ml-notif-subj { font-size: 13px; color: #ccc; }
.ml-tap { font-size: 11px; color: rgba(255,255,255,.35); letter-spacing: 2px; margin-top: 10px; opacity: 0; transition: opacity .5s 1s; }
.ml-notif.show + .ml-tap { opacity: 1; }
.ml-view { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(5,5,8,.92); }
.ml-view.show { display: flex; animation: scrIn .3s ease; }
.ml-card { width: min(640px, 86%); max-height: 90%; display: flex; flex-direction: column; background: #f4f4f6; color: #222; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.ml-top { flex: 0 0 auto; padding: 9px 14px; border-bottom: 1px solid #ddd; background: #fafafa; }
.ml-inbox { font-size: 13px; color: #2a6be0; }
.ml-scroll { flex: 1; overflow-y: auto; padding: 14px 22px 18px; display: flex; flex-direction: column; }
.ml-subject { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.ml-from-row { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #e2e2e6; }
.ml-avatar { width: 34px; height: 34px; border-radius: 50%; background: #9a9aa4; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.ml-from-col { flex: 1; min-width: 0; }
.ml-from { font-size: 13px; font-weight: 600; }
.ml-addr { font-size: 11px; color: #888; }
.ml-time { font-size: 11px; color: #888; }
.ml-body { font-size: 14px; line-height: 1.85; padding: 12px 0; white-space: pre-wrap; }
.ml-attachs { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ml-attach { position: relative; display: flex; flex-direction: column; gap: 4px; width: min(300px, 60%, calc(32vh * 1.594)); padding: 6px; border: 1px solid #d8d8de; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.ml-attach.img { width: min(170px, 30%); }
.ml-attach:hover { border-color: #2a6be0; }
.ml-attach-thumb { position: relative; width: 100%; aspect-ratio: 1632/1024; border-radius: 6px; background: #222 center / cover; overflow: hidden; }
.ml-attach-thumb.blur::after { content: ''; position: absolute; inset: 0; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgba(0,0,0,.3); }
.ml-play { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; }
.ml-attach-name { font-size: 12px; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-attach-size { font-size: 10px; color: #888; }

/* 横持ちスマホなど高さが低い画面：詰めて表示（添付は本文の下・中央） */
@media (max-height: 560px) {
  .win-body { padding: 10px 16px 12px; gap: 8px; }
  .ml-card { max-height: 96%; }
  .ml-top { padding: 0 8px; }
  .ml-scroll { padding: 8px 16px 10px; }
  .ml-subject { font-size: 15px; margin-bottom: 4px; }
  .ml-from-row { padding-bottom: 6px; }
  .ml-avatar { width: 28px; height: 28px; font-size: 13px; }
  .ml-body { font-size: 13px; line-height: 1.65; padding: 6px 0; }
  .ml-attachs { padding-top: 2px; }
  .ml-attach { width: min(240px, 60%, calc(30vh * 1.594)); }
  .ml-attach.img { width: min(150px, 30%, calc(26vh * 1.594)); }
}

/* ==========================================
   お礼
   ========================================== */
/* ---- 体験版 ---- */
.title-trial { margin-left: 12px; padding: 1px 8px; border: 1px solid rgba(212,138,138,.6); border-radius: 3px; color: #e8b4b4; font-size: 10px; letter-spacing: .2em; }
.title-trial.hide { display: none; }
.by-box { max-width: 420px; text-align: center; padding: 26px 22px 18px; }
.by-title { font-size: 16px; color: #eee; letter-spacing: .12em; margin-bottom: 10px; }
.by-text { font-size: 12.5px; line-height: 1.8; color: #aaa; white-space: pre-wrap; margin-bottom: 16px; }
.by-links { display: flex; flex-direction: column; gap: 10px; }
.by-link { display: flex; align-items: center; justify-content: center; min-height: 46px; border-radius: 8px; background: #7a1f2b; color: #fff; text-decoration: none; font-size: 14px; letter-spacing: .08em; }
.by-link:active { opacity: .7; }

/* ---- エンディングの締め ---- */
#fade-cover { position: fixed; inset: 0; z-index: 150; background: #000; opacity: 0; pointer-events: none; transition: opacity 1.1s ease; }
#fade-cover.on { opacity: 1; pointer-events: auto; }
#scr-outro { align-items: center; justify-content: center; background: #000; cursor: pointer; }
#scr-outro.active { animation: none; }
.ot-wrap { text-align: center; transition: opacity 1s ease; }
#scr-outro.out .ot-wrap { opacity: 0; }
.ot-line { font-family: 'Shippori Mincho', 'Yu Mincho', 'YuMincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif; font-size: clamp(18px, 3.2vw, 30px); letter-spacing: .32em; color: #e8e2dc; opacity: 0; transform: translateY(6px); transition: opacity 1.6s ease, transform 1.6s ease; white-space: nowrap; }
.ot-line.show { opacity: 1; transform: none; }
#ot-dots span { opacity: 0; transition: opacity .35s ease; letter-spacing: .1em; }
#ot-dots span.on { opacity: 1; }
.ot-sub { margin-top: 18px; font-family: 'Cormorant Garamond', 'Times New Roman', serif; font-style: italic; font-size: clamp(11px, 1.6vw, 15px); letter-spacing: .3em; color: rgba(232,226,220,.45); opacity: 0; transition: opacity 1.4s ease; }
.ot-sub.show { opacity: 1; }
/* 予告画像を開いていない人へ、そっと光らせて知らせる */
.end-hint { animation: endHint 1.8s ease-in-out infinite; }
@keyframes endHint { 0%,100% { box-shadow: 0 0 0 0 rgba(212,138,138,0); } 50% { box-shadow: 0 0 18px 4px rgba(212,138,138,.55); } }

#scr-thanks { align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #1a1216 0%, #000 75%); }
.th-box { width: min(480px, 86%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.th-title { font-size: 16px; color: #eee; letter-spacing: 3px; }
.th-text { font-size: 12px; color: #999; line-height: 1.8; white-space: pre-wrap; }
.th-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.th-links a { font-size: 12px; color: #ddd; padding: 8px 18px; border: 1px solid #444; border-radius: 6px; text-decoration: none; background: rgba(255,255,255,.04); }
.th-links a:hover { border-color: #888; }
.th-btns { display: flex; gap: 10px; margin-top: 10px; }
.th-btn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 12px; padding: 8px 24px; border-radius: 6px; cursor: pointer; }
.th-btn.sub { background: none; color: #999; border-color: #333; }

/* ==========================================
   画像ビューア
   ========================================== */
#scr-viewer { background: #000; align-items: center; justify-content: center; }
.vw-img { position: absolute; inset: 0; background: #000 center / contain no-repeat; }
.vw-close { position: absolute; top: 10px; right: 14px; background: rgba(0,0,0,.5); border: none; color: #ccc; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.vw-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.4); border: none; color: #ddd; font-size: 30px; width: 46px; height: 64px; cursor: pointer; border-radius: 6px; }
.vw-prev { left: 10px; } .vw-next { right: 10px; }
.vw-count { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #aaa; }
/* 次作画像のひとこと（モノローグ風） */
.vw-caption { position: absolute; left: 50%; bottom: 9%; transform: translate(-50%, 6px); max-width: 80%; padding: 4px 14px; border-radius: 3px; background: rgba(0,0,0,.55); color: rgba(255,255,255,.92); font-size: 15px; letter-spacing: .08em; line-height: 1.6; text-align: center; white-space: pre-wrap; pointer-events: none; opacity: 0; transition: opacity 1.2s ease .6s, transform 1.2s ease .6s; }
.vw-caption:empty { display: none; }
.vw-caption.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-height: 560px) { .vw-caption { font-size: 13px; bottom: 7%; } }

/* ==========================================
   プレーヤー
   ========================================== */
#scr-player { background: #000; }
#scr-player.hand-left  { flex-direction: row; }
#scr-player.hand-right { flex-direction: row-reverse; }

#video-container { position: relative; overflow: hidden; background: #000; flex: 0 0 auto; }
.layer-bg { position: absolute; inset: 0; background: #000; }
.scene-img-wrap { position: absolute; inset: 0; z-index: 1; overflow: hidden; transition: transform .25s ease; }
.sway { position: absolute; inset: 0; will-change: transform; }
.layer-scene-img { position: absolute; inset: 0; background: transparent center / contain no-repeat; }   /* 透明：読み込み途中でも下の画像が見える */
.layer-scene-img.out { opacity: 0; }
.layer-scene-img.fade { transition: opacity var(--fade-ms, .4s) ease; }
#app.view-fill .layer-scene-img { background-size: cover; }

.tap-area { position: absolute; inset: 0; z-index: 10; cursor: pointer; touch-action: none; -webkit-touch-callout: none; }
#subtitle-area.hidden { visibility: hidden; }
#btn-subs.off span { opacity: .35; text-decoration: line-through; }

/* 字幕 */
#subtitle-area {
  position: absolute; bottom: 6%; left: 4%; right: 20%; z-index: 20;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
}
#female-line { color: var(--female); font-size: 15px; line-height: 1.6; transition: opacity .2s; }
#female-line span, #male-line span { background: rgba(0,0,0,.6); border-radius: 3px; display: inline; white-space: pre-wrap; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
#female-line span { padding: 2px 10px; }
#male-line { color: var(--male); font-size: 13px; line-height: 1.5; transition: opacity .2s; }
#male-line span { padding: 1px 8px; }
#female-line.off, #male-line.off { opacity: 0; height: 0; overflow: hidden; }
@media (min-width: 1200px) { #female-line { font-size: 18px; } #male-line { font-size: 15px; } }

/* 黒／白フェード・フラッシュ */
#fx-color { position: absolute; inset: 0; z-index: 30; background: #000; opacity: 0; pointer-events: none; transition: opacity var(--color-ms, .7s) ease; }
#fx-color.on { opacity: 1; }
#fx-color.white { background: #fff; }
#fx-flash { position: absolute; inset: 0; z-index: 31; background: #fff; opacity: 0; pointer-events: none; }
#fx-flash.flash { animation: fxFlash .35s ease-out; }
#fx-flash.blink { animation: fxBlink 1.1s ease-in-out; }
@keyframes fxFlash { 0% { opacity: 0 } 15% { opacity: .95 } 100% { opacity: 0 } }
@keyframes fxBlink { 0%{opacity:0} 10%{opacity:.9} 22%{opacity:0} 40%{opacity:.8} 52%{opacity:0} 70%{opacity:.6} 85%{opacity:0} 100%{opacity:0} }
.scene-img-wrap.shake { animation: fxShake .45s linear; }
@keyframes fxShake { 0%,100%{translate:0 0} 15%{translate:-6px 3px} 30%{translate:5px -4px} 45%{translate:-4px -3px} 60%{translate:4px 4px} 75%{translate:-2px 2px} 90%{translate:2px -1px} }

/* REC */
#rec-overlay { position: absolute; inset: 0; z-index: 35; pointer-events: none; display: none; }
#rec-overlay.on { display: block; }
.rec-corner { position: absolute; width: 28px; height: 28px; border-color: rgba(255,255,255,.5); border-style: solid; border-width: 0; }
.rec-tl { top: 3%; left: 3%; border-top-width: 2px; border-left-width: 2px; }
.rec-tr { top: 3%; right: 3%; border-top-width: 2px; border-right-width: 2px; }
.rec-bl { bottom: 3%; left: 3%; border-bottom-width: 2px; border-left-width: 2px; }
.rec-br { bottom: 3%; right: 3%; border-bottom-width: 2px; border-right-width: 2px; }
.rec-info { position: absolute; top: 5%; left: 5%; display: flex; align-items: center; gap: 6px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #e03030; animation: recBlink 1.2s ease-in-out infinite; }
@keyframes recBlink { 0%,100%{opacity:1} 50%{opacity:.2} }
.rec-label { font-size: 10px; color: rgba(255,255,255,.75); letter-spacing: 2px; font-weight: 500; }
.rec-time { font-size: 10px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; margin-left: 4px; letter-spacing: 1px; }
.rec-battery { position: absolute; top: 5%; right: 5%; display: flex; align-items: center; gap: 4px; }
.rec-bat-icon { display: flex; align-items: center; }
.rec-bat-body { width: 20px; height: 10px; border: 1.5px solid rgba(255,255,255,.7); border-radius: 2px; position: relative; overflow: hidden; }
.rec-bat-fill { position: absolute; top: 1px; left: 1px; bottom: 1px; width: 80%; background: rgba(255,255,255,.7); border-radius: 1px; transition: width .3s, background .3s; }
.rec-bat-tip { width: 2px; height: 5px; background: rgba(255,255,255,.7); border-radius: 0 1px 1px 0; margin-left: -0.5px; }
.rec-battery.low .rec-bat-icon, .rec-battery.low .rec-bat-pct { animation: recBlink 1s ease-in-out infinite; }
.rec-bat-pct { font-size: 10px; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }

/* 進捗バー */
#progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; z-index: 36; background: rgba(255,255,255,.08); pointer-events: none; transition: opacity .3s; }
#progress-fill { height: 100%; width: 0; background: rgba(255,255,255,.45); transition: width .3s; }

/* ---- コントロールバー ---- */
#side-panel {
  flex: 0 0 var(--panel-w); width: var(--panel-w);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 12px 0; background: #080808; border-left: 1px solid #1a1a1a; z-index: 40;
  transition: opacity .35s, transform .35s;
}
#scr-player.hand-left #side-panel { border-left: none; border-right: 1px solid #1a1a1a; }
.sp-nav, .sp-actions, .sp-bottom { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.sp-actions { gap: 8px; }
.sp-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: none; border: 1px solid #2a2a2a; color: #888; font-size: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s; line-height: 1;
}
.sp-btn:hover { border-color: #555; color: #ccc; }
.sp-btn:active { border-color: #888; color: #fff; }
.sp-btn span { font-size: 14px; }
.sp-btn small { font-size: 7px; color: #555; margin-top: 1px; }
.sp-btn.on { border-color: #888; color: #fff; background: rgba(255,255,255,.06); }
.sp-btn.on small { color: #aaa; }
.sp-btn-fav span { color: #c08040; }
.sp-btn-fav.saved span { color: #e8a020; }
.sp-btn-sm { width: 34px; height: 34px; border-color: #1a1a1a; }
.sp-btn-sm span { font-size: 13px; color: #666; }

/* 画面いっぱいモード：コントロールバーを画像に重ねる */
#app.view-fill #video-container { position: absolute; inset: 0; }
#app.view-fill #side-panel {
  position: absolute; top: 0; bottom: 0; background: linear-gradient(to left, rgba(0,0,0,.55), rgba(0,0,0,0));
  border: none !important;
}
/* 全体表示と同じく hand-right → バーは左、hand-left → バーは右 */
#app.view-fill #scr-player.hand-left  #side-panel { right: 0; padding-right: env(safe-area-inset-right); }
#app.view-fill #scr-player.hand-right #side-panel { left: 0; background: linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,0)); padding-left: env(safe-area-inset-left); }
#app.view-fill .sp-btn { background: rgba(0,0,0,.35); border-color: rgba(255,255,255,.18); color: #ddd; }
#app.view-fill .sp-btn small { color: #aaa; }
#app.view-fill #scr-player.panel-hidden #side-panel { opacity: 0; pointer-events: none; }
#app.view-fill #scr-player.panel-hidden.hand-left #side-panel { transform: translateX(20px); }
#app.view-fill #scr-player.panel-hidden.hand-right #side-panel { transform: translateX(-20px); }
#app.view-fill #scr-player.panel-hidden #progress { opacity: 0; }
#app.view-fill #scr-player.hand-left #subtitle-area { right: calc(var(--panel-w) + 6%); }
#app.view-fill #scr-player.hand-right #subtitle-area { left: calc(var(--panel-w) + 3%); right: 14%; }
/* 画面いっぱいのときも、録画枠は画面の四隅に（ボタンは少しすると隠れる） */

/* スマホ */
@media (max-width: 1024px) and (hover: none) {
  :root { --panel-w: 64px; }
  .sp-btn { width: 48px; height: 48px; }
  .sp-btn span { font-size: 18px; }
  .sp-btn-sm { width: 38px; height: 38px; }
  #female-line { font-size: 14px; } #male-line { font-size: 12px; }
}
@media (max-height: 420px) {
  .sp-btn { width: 40px; height: 40px; } .sp-btn-sm { width: 32px; height: 32px; }
  .sp-nav, .sp-bottom { gap: 4px; } .sp-actions { gap: 4px; }
  #side-panel { padding: 8px 0; }
}

/* ---- スワイプメニュー ---- */

/* ==========================================
   ギャラリー
   ========================================== */
#scr-gallery { flex-direction: column; background: #000; }
.gal-header { flex: 0 0 auto; display: flex; align-items: center; padding: 8px 16px; gap: 12px; }
.ch-back { background: none; border: none; color: #888; font-size: 13px; cursor: pointer; }
.ch-title { font-size: 13px; color: #aaa; letter-spacing: 1px; }
.gal-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; padding: 8px 16px; align-content: start; overflow-y: auto; }
.gal-item { aspect-ratio: 1632/1024; background: #111 center / cover no-repeat; border-radius: 4px; cursor: pointer; border: 1px solid #1a1a1a; }
.gal-item:active { border-color: #666; }
.gal-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #777; text-align: center; line-height: 2; pointer-events: none; }
.gal-empty.hide { display: none; }
#scr-galview { background: #000; align-items: center; justify-content: center; }
.galv-img { position: absolute; inset: 0; background: #000 center / contain no-repeat; }
.galv-text { position: absolute; bottom: 12%; left: 6%; right: 30%; font-size: 14px; color: var(--female); }
.galv-text span { background: rgba(0,0,0,.6); padding: 3px 10px; border-radius: 4px; white-space: pre-wrap; }
.galv-close { position: absolute; top: 8px; right: 12px; background: rgba(0,0,0,.4); border: none; color: #aaa; font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.galv-btns { position: absolute; bottom: 10px; right: 12px; display: flex; gap: 8px; }
.galv-btn { background: rgba(0,0,0,.5); border: 1px solid #444; border-radius: 6px; color: #bbb; font-size: 11px; padding: 6px 14px; cursor: pointer; }

/* ==========================================
   モーダル
   ========================================== */
.modal { position: absolute; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-box { background: #1a1a1a; border-radius: 12px; padding: 20px; width: 88%; max-width: 380px; max-height: 88%; overflow-y: auto; position: relative; }
.modal-small { max-width: 300px; text-align: center; }
.modal-x { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--tx3); font-size: 18px; cursor: pointer; }
.modal-title { color: #ccc; font-size: 14px; margin-bottom: 14px; text-align: center; }
.s-section { margin-bottom: 8px; }
.s-section-title { color: #666; font-size: 10px; margin-bottom: 4px; letter-spacing: 1px; }
.s-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.s-label { font-size: 12px; color: #999; white-space: nowrap; }
.s-label:first-child { flex: 0 0 auto; }
.s-gap { margin-left: auto; }
.s-w { width: 44px; }
.s-sep { border-top: 1px solid #242424; margin: 10px 0; }
.s-slider-wrap { flex: 1; }
.s-slider { width: 100%; accent-color: #999; }
.s-val { font-size: 11px; color: #888; min-width: 32px; text-align: right; }
.s-name { flex: 1; text-align: left; color: #ccc; overflow: hidden; text-overflow: ellipsis; }
.s-row > .s-toggle:nth-child(2) { margin-left: auto; }
.s-toggle { flex: 0 0 auto; width: 36px; height: 20px; border-radius: 10px; background: #333; border: none; position: relative; cursor: pointer; transition: background .2s; }
.s-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #666; transition: transform .2s, background .2s; }
.s-toggle.on { background: #666; }
.s-toggle.on::after { transform: translateX(16px); background: #eee; }
.s-seg { margin-left: auto; display: flex; border: 1px solid #333; border-radius: 6px; overflow: hidden; }
.s-seg button { background: none; border: none; color: #888; font-size: 11px; padding: 5px 10px; cursor: pointer; }
.s-seg button.on { background: #444; color: #fff; }
.s-action-btn { margin-left: auto; padding: 5px 14px; font-size: 11px; background: #222; border: 1px solid #333; border-radius: 6px; color: #aaa; cursor: pointer; }
.s-action-btn.full { width: 100%; margin-top: 10px; padding: 8px; }
.name-field { margin-bottom: 10px; }
.name-field-label { font-size: 11px; color: #888; margin-bottom: 6px; }
.name-field-input { width: 100%; padding: 6px 10px; font-size: 14px; background: #111; border: 1px solid #333; border-radius: 6px; color: #fff; font-family: inherit; outline: none; -webkit-user-select: text; user-select: text; }
.name-field-input:focus { border-color: #666; }
.cf-sub { font-size: 11px; color: #777; margin-bottom: 14px; }
.cf-btns { display: flex; gap: 10px; justify-content: center; }
.cf-btns .s-action-btn { margin: 0; padding: 7px 18px; }
.cf-yes { background: #3a3a3a; color: #eee; }

/* ---- 縦持ち案内 ---- */
/* ---- 読み込み待ち（長引いたときだけ、隅に小さく） ---- */
#loading { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: 2px; opacity: 0; pointer-events: none; transition: opacity .4s; }
#loading.show { opacity: 1; }
.ld-ring { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.18); border-top-color: rgba(255,255,255,.7); animation: ld-spin .9s linear infinite; }
@keyframes ld-spin { to { transform: rotate(360deg); } }

#rotate-hint { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #bbb; font-size: 13px; letter-spacing: 1px; }
#rotate-hint.show { display: flex; }
.rh-icon { font-size: 40px; animation: rh 2s ease-in-out infinite; }
@keyframes rh { 0%,30% { transform: rotate(0) } 60%,100% { transform: rotate(-90deg) } }
#rotate-hint button { margin-top: 10px; background: none; border: 1px solid #444; color: #888; font-size: 11px; padding: 6px 16px; border-radius: 6px; }

/* ---- プレビューゲート ---- */
#preview-gate { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.7); }
#preview-gate.show { display: flex; }
#preview-gate button { background: rgba(255,255,255,.1); border: 1px solid #555; color: #ddd; padding: 12px 26px; border-radius: 8px; font-size: 13px; cursor: pointer; }

/* ==========================================
   スマホ（指で操作）：押せる範囲を44px以上に
   ========================================== */
@media (pointer: coarse) {
  .win-back, .ml-inbox { min-width: 44px; min-height: 44px; padding: 0 12px 0 4px; font-size: 20px; }
  .ml-inbox { font-size: 15px; }
  .ch-back { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .modal-x { width: 44px; height: 44px; top: 4px; right: 4px; font-size: 20px; }
  .vw-close, .galv-close { width: 48px; height: 48px; }
  .vw-nav { width: 52px; height: 72px; }
  .galv-btn { min-height: 44px; padding: 0 18px; font-size: 13px; }
  .th-btn { min-height: 48px; padding: 0 28px; font-size: 14px; }
  .th-links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 20px; font-size: 13px; }
  .ni-next { min-height: 48px; padding: 0 36px; font-size: 14px; }
  .s-row { min-height: 44px; }
  .s-toggle { width: 48px; height: 28px; border-radius: 14px; }
  .s-toggle::after { width: 22px; height: 22px; top: 3px; left: 3px; }
  .s-toggle.on::after { transform: translateX(20px); }
  .s-seg button { min-height: 36px; padding: 0 12px; font-size: 12px; }
  .s-action-btn { min-height: 40px; padding: 0 18px; font-size: 12px; }
  .s-slider { height: 28px; }
  .cf-btns .s-action-btn { min-height: 44px; }
  .sp-btn-sm { width: 44px; height: 44px; }
  .ml-attach { min-height: 44px; }
  #rotate-hint button { min-height: 44px; padding: 0 20px; }
}

/* 押した手応え（音の代わりに見た目で返す） */
button:active:not(:disabled) { opacity: .6; transition: opacity 0s; }
.title-btn:active::after { left: 22px; right: calc(22px - .25em); }

/* ---- 操作説明 ---- */
.guide-box { max-width: 640px; width: 92%; display: flex; flex-direction: column; padding: 16px 18px 12px; overflow: hidden; }
.guide-head { display: flex; align-items: baseline; gap: 10px; padding-right: 36px; margin-bottom: 10px; }
.guide-title { font-size: 15px; color: #eee; letter-spacing: .08em; }
.guide-count { font-size: 11px; color: var(--tx3); }
.guide-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 4px; }
.guide-intro { font-size: 12.5px; line-height: 1.75; color: #bbb; margin-bottom: 10px; }
.guide-list { display: flex; flex-direction: column; gap: 6px; }
.guide-list.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.guide-item { display: flex; gap: 10px; align-items: flex-start; background: #222; border-radius: 8px; padding: 8px 10px; }
.guide-ic { flex: 0 0 30px; height: 30px; border-radius: 6px; background: #2e2e2e; color: #ddd; font-size: 14px; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.guide-tx { min-width: 0; }
.guide-name { font-size: 12.5px; color: #eee; margin-bottom: 2px; }
.guide-desc { font-size: 11.5px; line-height: 1.65; color: #9a9a9a; }
.guide-note { font-size: 11.5px; line-height: 1.6; color: var(--accent); margin-top: 10px; }
.guide-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #2a2a2a; }
.guide-foot .s-action-btn { margin: 0; padding: 7px 18px; font-size: 12px; }
.guide-next { background: #3a2a2a; border-color: #5a3a3a; color: #f0d6d6; }
.guide-dots { flex: 1; display: flex; justify-content: center; gap: 6px; }
.guide-dots span { width: 6px; height: 6px; border-radius: 50%; background: #444; }
.guide-dots span.on { background: var(--accent); }
@media (max-width: 560px) { .guide-list.grid { grid-template-columns: 1fr; } }
@media (pointer: coarse) { .guide-foot .s-action-btn { min-height: 44px; } }
.guide-body.more { -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
