/* =========================================================
   エリカと、スマホの向こう側 / style.css
   固定ステージ 1280 x 720（画面サイズに合わせて等倍拡縮）
   ========================================================= */

:root{
  --bg:#0d0f14;
  --panel:#161a22;
  --panel2:#1e232e;
  --line:#2c3342;
  --text:#e9edf5;
  --sub:#9aa5b8;
  --accent:#7fd4a6;      /* エリカ＝草タイプの緑 */
  --accent2:#b58bd6;
  --gold:#ffd35c;
  --danger:#ff6b6b;
  --chat-me:#8de06a;
  --chat-you:#ffffff;
  --font: "Yu Gothic UI","Hiragino Kaku Gothic ProN","Meiryo",system-ui,sans-serif;
}

*{ box-sizing:border-box; }
html,body{
  margin:0; padding:0; width:100%; height:100%;
  background:#05070a; color:var(--text);
  font-family:var(--font);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}
button{ font-family:inherit; cursor:pointer; }
.hidden{ display:none !important; }

/* ---------- 固定ステージ ---------- */
#stage{
  position:absolute; top:0; left:0;
  width:1280px; height:720px;
  transform-origin:top left;
  background:var(--bg);
  overflow:hidden;
  /* CONFIG から変更される文字サイズ */
  --fs-text:17px;
  --fs-name:14px;
  --fs-chat:13px;
  --bg-img:url('../img/bg_gym.png');
}

/* ボタンはタッチでも押しやすい大きさに（最低44px前後） */
.btn{
  border:1px solid var(--line);
  background:var(--panel2);
  color:var(--text);
  padding:14px 30px;
  min-height:50px;
  border-radius:10px;
  font-size:17px;
  transition:.15s;
}
.btn:hover{ background:#2a3140; border-color:#41506a; }
.btn:disabled{ opacity:.4; cursor:not-allowed; }
.btn-main{
  background:linear-gradient(180deg,#3ea877,#2d7d58);
  border-color:#4fcf94; color:#fff; font-weight:bold;
}
.btn-main:hover{ background:linear-gradient(180deg,#49c78c,#357f5d); }
.btn-small{ padding:11px 22px; min-height:44px; font-size:15px; }

/* ---------- タイトル ---------- */
.screen{ width:1280px; height:720px; }
#title-screen{
  display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(1000px 600px at 30% 20%, rgba(127,212,166,.16), transparent 60%),
    radial-gradient(800px 600px at 80% 80%, rgba(181,139,214,.14), transparent 60%),
    var(--bg);
}
/* 表紙画像を敷いたときは、文字を左に寄せる */
#title-screen.has-bg{
  background:var(--title-bg) center/cover no-repeat, var(--bg);
  justify-content:flex-start;
}
#title-screen.has-bg .title-inner{
  text-align:left; margin-left:78px; max-width:600px; padding:10px 0;
}
#title-screen.has-bg .title-buttons{ justify-content:flex-start; }
#title-screen.has-bg .title-main{ text-shadow:0 4px 24px rgba(0,0,0,.9); }
#title-screen.has-bg .title-desc,
#title-screen.has-bg .title-note{ text-shadow:0 2px 8px rgba(0,0,0,.9); }
#title-screen.has-bg .title-logo{ margin-left:0; }

.title-inner{ text-align:center; max-width:760px; padding:20px; }
.title-logo{ max-width:640px; max-height:280px; display:block; margin:0 auto 18px; }
.title-sub{ letter-spacing:.4em; color:var(--sub); font-size:12px; margin:0 0 12px; }
.title-sub:empty,.title-desc:empty,.title-note:empty{ display:none; }
.title-main{
  font-size:56px; line-height:1.25; margin:0 0 18px;
  background:linear-gradient(180deg,#fff,#9fe6c2);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow:0 0 40px rgba(127,212,166,.25);
}
.title-desc{ color:var(--sub); margin:0 0 40px; }
.title-buttons{ display:flex; gap:14px; justify-content:center; }
.title-note{ margin-top:48px; font-size:11px; color:#5d6779; }

/* ---------- メイン枠 ---------- */
#game-screen{ display:flex; }

/* ---------- VN ---------- */
#vn{
  position:relative; flex:1 1 auto; height:720px; overflow:hidden;
  cursor:pointer; user-select:none;
}
#vn-bg{
  position:absolute; inset:0;
  background:
    linear-gradient(180deg,#1d3b2c 0%, #14261d 55%, #0d1712 100%);
}
/* 背景画像（DATA.config.bg で指定）。無ければ上のグラデーションのまま */
#vn-bg::before{
  content:""; position:absolute; inset:0;
  background:var(--bg-img) center/cover no-repeat;
}
/* 下側を落として文字を読みやすくする */
#vn-bg::after{
  content:""; position:absolute; inset:0;
  background:
    linear-gradient(180deg, rgba(4,8,6,.30) 0%, rgba(4,8,6,0) 26%,
                    rgba(4,8,6,0) 52%, rgba(4,8,6,.62) 100%);
}
/* ---- 立ち絵（呼吸モーション付き） ----
   3層に分けて、それぞれ別の役割を持たせる：
     #chara-wrap … 位置決め（アニメなし）
     #chara-sway … ゆっくりした重心移動（周期を呼吸とずらす）
     img/canvas  … 呼吸そのもの（足元は動かさない）            */
#chara-wrap{
  position:absolute; left:50%; bottom:0; transform:translateX(-50%);
  height:660px; pointer-events:none; z-index:2;
}
#chara-sway{
  height:100%; transform-origin:50% 100%;
  animation:sway 9.3s ease-in-out infinite;
  will-change:transform;
}
#chara-canvas,#chara-img{
  height:100%; width:auto; display:block;
  transform-origin:50% 100%;
  filter:drop-shadow(0 0 40px rgba(0,0,0,.6));
  animation:breathe 4.6s infinite;
  will-change:transform;
}

/* 息を吸う（やや速い）→ ほんの少し止める → 吐く（ゆっくり） */
@keyframes breathe{
  0%   { transform:scale(1, 1);
         animation-timing-function:cubic-bezier(.42,0,.58,1); }
  40%  { transform:scale(1.0035, 1.0075);
         animation-timing-function:cubic-bezier(.45,0,.55,1); }
  52%  { transform:scale(1.0032, 1.0068);
         animation-timing-function:cubic-bezier(.33,0,.45,1); }
  100% { transform:scale(1, 1); }
}

/* 呼吸と周期をずらした、ごくわずかな揺れ（機械的な反復に見せない） */
@keyframes sway{
  0%,100% { transform:translateX(0)     rotate(0deg); }
  50%     { transform:translateX(1.6px) rotate(.13deg); }
}

body.no-breathe #chara-canvas,
body.no-breathe #chara-img,
body.no-breathe #chara-sway{ animation:none; }
#chara-img{ display:none; }
body.has-chara-img #chara-canvas{ display:none; }
body.has-chara-img #chara-img{ display:block; }

/* イベントCG（常に縦いっぱいに合わせる。横は中央基準ではみ出し可） */
#event-cg{
  position:absolute; top:0; bottom:0; left:50%; transform:translateX(-50%);
  height:100%; width:auto; max-width:none; max-height:none;
  display:none; z-index:3; pointer-events:none;
}
body.has-cg #event-cg{ display:block; }
body.has-cg #chara-canvas,
body.has-cg #chara-img{ display:none !important; }
body.has-cg #vn-bg{ filter:brightness(.35); }

/* チャットの入力待ち表示 */
.chat-wait{ color:var(--sub); font-size:12px; text-align:center; padding:9px 0; }
.shop-who{ font-size:10px; color:var(--sub); font-weight:normal; margin-left:6px; }

/* HUD */
#vn-hud{
  position:absolute; top:12px; left:14px; display:flex; gap:9px; flex-wrap:wrap;
  font-size:12px; max-width:560px; z-index:6;
}
.hud-chip{
  background:rgba(10,14,20,.72); border:1px solid var(--line);
  border-radius:20px; padding:6px 13px; display:flex; align-items:center; gap:7px;
  backdrop-filter:blur(4px);
}
.hud-label{ color:var(--sub); }
.meter{ width:64px; height:6px; background:#2a3140; border-radius:4px; overflow:hidden; }
.meter-fill{ height:100%; width:0%; transition:width .4s; }
.meter-fill.love{ background:linear-gradient(90deg,#7fd4a6,#4fcf94); }
.meter-fill.doubt{ background:linear-gradient(90deg,#b58bd6,#ff6b6b); }

/* テキストボックス（立ち絵より必ず前面に） */
#vn-box{
  position:absolute; left:34px; right:34px; bottom:20px; z-index:6;
  background:rgba(8,11,16,.86);
  border:1px solid var(--line); border-radius:12px;
  padding:20px 26px 24px; min-height:150px;
  backdrop-filter:blur(6px);
  box-shadow:0 10px 40px rgba(0,0,0,.5);
}
#vn-name{
  position:absolute; top:-15px; left:22px;
  background:linear-gradient(180deg,#2d7d58,#1f5b40);
  border:1px solid #4fcf94; color:#fff;
  padding:4px 18px; border-radius:16px; font-size:var(--fs-name); font-weight:bold;
  min-width:70px; text-align:center;
}
#vn-name.narration{ display:none; }
#vn-name.me{ background:linear-gradient(180deg,#39506e,#26364c); border-color:#6f93c4; }
#vn-name.kenji{ background:linear-gradient(180deg,#6e5539,#4c3a26); border-color:#c49f6f; }
#vn-text{ font-size:var(--fs-text); line-height:1.85; min-height:72px; white-space:pre-wrap; }
#vn-text.narration{ color:#c4cddd; }
#vn-next{
  position:absolute; right:20px; bottom:10px; color:var(--accent);
  animation:blink 1.1s infinite; font-size:13px;
}
@keyframes blink{ 0%,100%{opacity:.15} 50%{opacity:1} }

/* 選択肢 */
#vn-choices{
  position:absolute; left:50%; top:44%; transform:translate(-50%,-50%);
  width:620px; display:flex; flex-direction:column; gap:12px; z-index:9;
}
.choice{
  background:rgba(14,19,26,.94); border:1px solid var(--line);
  padding:20px 26px; min-height:62px; border-radius:12px;
  font-size:var(--fs-text); color:var(--text);
  text-align:left; transition:.15s;
}
.choice:hover{ border-color:var(--accent); background:rgba(30,60,48,.94); transform:translateX(4px); }

/* ツール */
#vn-tools{ position:absolute; top:12px; right:14px; display:flex; gap:9px; z-index:8; }
.tool-btn{
  background:rgba(10,14,20,.78); border:1px solid var(--line); color:var(--sub);
  border-radius:10px; padding:0 18px; min-height:46px; font-size:14px; letter-spacing:.08em;
}
.tool-btn:hover{ color:var(--text); border-color:var(--accent); }
.tool-btn.on{ color:var(--accent); border-color:var(--accent); }
.tool-btn.notify{ color:var(--gold); border-color:var(--gold); animation:pulse 1.2s infinite; }
.tool-btn.skipping{
  background:linear-gradient(180deg,#3ea877,#2d7d58); border-color:#4fcf94; color:#fff; font-weight:bold;
}

/* テキスト非表示モード（イラストを見る） */
#vn-box,#vn-hud,#vn-tools,#vn-choices,#skip-badge{ transition:opacity .18s; }
body.ui-hidden #vn-box,
body.ui-hidden #vn-hud,
body.ui-hidden #vn-tools,
body.ui-hidden #vn-choices,
body.ui-hidden #skip-badge{ opacity:0; pointer-events:none; }
body.ui-hidden #vn{ cursor:pointer; }
#hide-hint{
  position:absolute; left:0; right:0; bottom:16px; text-align:center;
  font-size:13px; color:rgba(255,255,255,.5); z-index:9; pointer-events:none;
  text-shadow:0 2px 8px rgba(0,0,0,.9);
  opacity:0; transition:opacity .25s;
}
body.ui-hidden #hide-hint{ opacity:1; animation:hidefade 3s ease-out forwards; }
@keyframes hidefade{ 0%{opacity:1} 70%{opacity:1} 100%{opacity:0} }

/* スキップ中の表示 */
#skip-badge{
  position:absolute; top:52px; right:16px; z-index:8;
  background:rgba(45,125,88,.92); border:1px solid #4fcf94; color:#fff;
  border-radius:16px; padding:5px 14px; font-size:12px; font-weight:bold;
  letter-spacing:.12em; pointer-events:none;
  animation:skipblink .7s ease-in-out infinite;
}
@keyframes skipblink{ 0%,100%{ opacity:1 } 50%{ opacity:.45 } }
@keyframes pulse{ 0%,100%{box-shadow:0 0 0 rgba(255,211,92,0)} 50%{box-shadow:0 0 12px rgba(255,211,92,.6)} }

/* =========================================================
   ジム戦
   ========================================================= */
#battle{
  position:absolute; inset:0; z-index:7;
  background:
    linear-gradient(180deg, rgba(8,16,12,.42) 0%, rgba(8,16,12,.62) 60%, rgba(6,12,9,.82) 100%),
    var(--bg-img) center/cover no-repeat,
    linear-gradient(180deg,#20402f 0%, #16281e 60%, #0e1712 100%);
  display:flex; flex-direction:column;
}
#bt-field{ position:relative; flex:1 1 auto; }

.bt-info{
  position:absolute; width:260px;
  background:rgba(8,11,16,.86); border:1px solid var(--line);
  border-radius:10px; padding:10px 14px;
}
.bt-info.foe{ top:30px; left:40px; }
.bt-info.me { bottom:26px; right:40px; }
.bt-name{ display:flex; justify-content:space-between; align-items:baseline; font-size:14px; margin-bottom:6px; }
.bt-name span{ font-size:11px; color:var(--sub); }
.bt-hp{ height:9px; background:#2a3140; border-radius:5px; overflow:hidden; }
.bt-hp-fill{ height:100%; width:100%; background:linear-gradient(90deg,#7fd4a6,#4fcf94); transition:width .35s; }
.bt-hp-fill.mid{ background:linear-gradient(90deg,#ffd35c,#e0a92c); }
.bt-hp-fill.low{ background:linear-gradient(90deg,#ff8a8a,#e04a4a); }
.bt-hpnum{ text-align:right; font-size:11px; color:var(--sub); margin-top:4px; }

.bt-sprite{ position:absolute; width:220px; height:220px; }
.bt-sprite canvas,.bt-sprite img{ width:100%; height:100%; object-fit:contain; display:block; }
.bt-sprite.foe{ top:18px; right:70px; }
.bt-sprite.me { bottom:0px; left:70px; transform:scale(1.15); transform-origin:bottom left; }
.bt-sprite.foe::after,.bt-sprite.me::after{
  content:''; position:absolute; left:8%; right:8%; bottom:6px; height:20px;
  background:radial-gradient(ellipse at center, rgba(0,0,0,.45), transparent 70%);
}

#bt-bottom{
  flex:0 0 176px; display:flex; gap:14px; padding:0 34px 22px;
}
#bt-msg{
  flex:1 1 auto; background:rgba(8,11,16,.9); border:1px solid var(--line);
  border-radius:12px; padding:20px 24px; font-size:17px; line-height:1.8;
  white-space:pre-wrap; letter-spacing:.06em;
}
#bt-cmds{
  flex:0 0 300px; display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:10px;
}
.bt-cmd{
  background:rgba(14,19,26,.94); border:1px solid var(--line); color:var(--text);
  border-radius:12px; font-size:18px; min-height:56px; position:relative; transition:.12s;
}
.bt-cmd:hover:not(:disabled){ border-color:var(--accent); background:rgba(30,60,48,.94); }
.bt-cmd:disabled{ opacity:.35; cursor:not-allowed; }
.bt-cmd .pp{ display:block; font-size:10px; color:var(--sub); margin-top:3px; }

/* =========================================================
   スマホ
   ========================================================= */
/* =========================================================
   モード切り替え
   body.mode-talk  … エリカとの会話（スマホは出さない）
   body.mode-phone … スマホ操作（中央に大きく表示）
   ========================================================= */
body.mode-talk  #phone-wrap{ display:none; }

body.mode-phone #vn{ filter:brightness(.35) saturate(.7); pointer-events:none; }
body.mode-phone #vn-tools{ pointer-events:auto; filter:none; }
body.mode-phone #phone-wrap{
  position:absolute; inset:0; z-index:40;
  background:rgba(4,7,11,.72); backdrop-filter:blur(3px);
  border-left:none;
}
body.mode-phone #phone-frame{
  width:430px; height:706px; border-radius:38px; border-width:10px;
}
body.mode-phone #phone-navbar{ flex:0 0 40px; }
body.mode-phone #app-grid{ gap:22px 10px; margin-top:34px; }
body.mode-phone .app-icon .ico{ width:66px; height:66px; font-size:30px; border-radius:18px; }
body.mode-phone .app-icon .nm{ font-size:12px; }
body.mode-phone #home-clock{ font-size:44px; }
body.mode-phone #puzzle-canvas{ width:340px; height:340px; }
body.mode-phone .msg.photo .bubble canvas,
body.mode-phone .msg.photo .bubble img{ width:210px; height:210px; }

#phone-wrap{
  flex:0 0 372px; height:720px;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg,#0a0c11,#12151c);
  border-left:1px solid var(--line);
  position:relative;
}
#phone{ position:relative; }

/* 会話にもどるボタン */
#phone-back{
  position:absolute; top:18px; left:22px; z-index:45;
  background:rgba(20,26,34,.92); border:1px solid var(--line); color:var(--sub);
  border-radius:10px; padding:0 22px; min-height:50px; font-size:16px;
}
#phone-back:hover{ color:var(--text); border-color:var(--accent); }
body.mode-talk #phone-back{ display:none; }

/* ツールバーのスマホボタン */
.tool-btn.phone-btn{ position:relative; padding:7px 14px; }
.tool-btn.phone-btn .badge{
  position:absolute; top:-6px; right:-6px;
  min-width:18px; height:18px; line-height:18px; padding:0 5px;
  background:var(--danger); color:#fff; border-radius:9px; font-size:11px; font-weight:bold;
}
body.mode-phone .tool-btn.phone-btn{ display:none; }

#phone-frame{
  width:330px; height:664px;
  background:#05070a; border:8px solid #23272f; border-radius:32px;
  box-shadow:0 20px 60px rgba(0,0,0,.7), inset 0 0 0 1px #000;
  display:flex; flex-direction:column; overflow:hidden;
}
#phone-statusbar{
  flex:0 0 30px; display:flex; align-items:center; justify-content:space-between;
  padding:0 16px; font-size:12px; color:#c8d0de; background:#0b0e13;
}
#phone-money{ color:var(--gold); font-weight:bold; }
.battery{ color:#6b7688; letter-spacing:-2px; }
#phone-body{ flex:1 1 auto; position:relative; overflow:hidden; background:#0f1218; }
.app-view{ position:absolute; inset:0; display:flex; flex-direction:column; overflow:hidden; }
#phone-navbar{
  flex:0 0 44px; display:flex; align-items:center; justify-content:center; background:#0b0e13;
}
#phone-navbar button{
  background:none; border:none; color:#4a5468; font-size:22px; line-height:1;
  width:80px; height:40px; border-radius:20px;
}
#phone-navbar button:hover{ color:#98a3b6; background:rgba(255,255,255,.06); }

.app-head{
  flex:0 0 52px; display:flex; align-items:center; gap:6px;
  padding:0 8px; background:#1a1f29; border-bottom:1px solid var(--line);
  font-size:15px; font-weight:bold;
}
.back-btn{
  background:none; border:none; color:var(--sub);
  font-size:26px; line-height:1; width:44px; height:44px;
}
.back-btn:hover{ color:var(--text); }

/* チャットのタブ */
#chat-tabs{ display:flex; gap:6px; }
.chat-tab{
  background:#242b38; border:1px solid var(--line); color:var(--sub);
  border-radius:14px; padding:5px 14px; font-size:12px; position:relative;
}
.chat-tab.on{ background:#2d7d58; border-color:#4fcf94; color:#fff; }
.chat-tab.locked{ opacity:.35; cursor:not-allowed; }
.chat-tab .dot{
  position:absolute; top:-3px; right:-3px; width:9px; height:9px;
  border-radius:50%; background:var(--danger);
}

/* ホーム */
#view-home{
  background:
    radial-gradient(400px 300px at 50% 0%, rgba(127,212,166,.16), transparent 70%),
    linear-gradient(180deg,#101822,#0b0e13);
  padding:16px 14px;
}
#home-clock{ text-align:center; font-size:36px; font-weight:200; letter-spacing:.05em; margin:8px 0 2px; }
#app-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px 6px; margin-top:24px; }
.app-icon{ background:none; border:none; color:var(--text); text-align:center; position:relative; }
.app-icon .ico{
  width:54px; height:54px; margin:0 auto 6px; border-radius:15px;
  display:flex; align-items:center; justify-content:center; font-size:25px;
  box-shadow:0 4px 12px rgba(0,0,0,.45); transition:.15s;
}
.app-icon .nm{ font-size:11px; color:#c3cbd9; }
.app-icon:hover .ico{ transform:translateY(-2px); }
.badge{
  position:absolute; top:-4px; right:10px; min-width:18px; height:18px;
  background:var(--danger); color:#fff; border-radius:9px;
  font-size:11px; line-height:18px; padding:0 5px; font-weight:bold;
}
#home-hint{ position:absolute; bottom:14px; left:0; right:0; text-align:center; font-size:11px; color:#5d6779; }

/* チャット */
#chat-log{ flex:1 1 auto; overflow-y:auto; padding:14px 12px; background:#7c93a8; }
#chat-log.erika{ background:#6f7f9e; }
#chat-log::-webkit-scrollbar,#shop-list::-webkit-scrollbar,#album-grid::-webkit-scrollbar,
#clicker-shop::-webkit-scrollbar,#log-body::-webkit-scrollbar,#chat-actions::-webkit-scrollbar{ width:6px; }
#chat-log::-webkit-scrollbar-thumb,#shop-list::-webkit-scrollbar-thumb,#album-grid::-webkit-scrollbar-thumb,
#clicker-shop::-webkit-scrollbar-thumb,#log-body::-webkit-scrollbar-thumb,#chat-actions::-webkit-scrollbar-thumb{
  background:#4a5468; border-radius:3px;
}
.msg{ display:flex; margin-bottom:10px; align-items:flex-end; gap:6px; }
.msg.you .bubble{ background:var(--chat-you); color:#1b1f26; border-radius:2px 14px 14px 14px; }
.msg.me{ flex-direction:row-reverse; }
.msg.me .bubble{ background:var(--chat-me); color:#152012; border-radius:14px 2px 14px 14px; }
.bubble{ max-width:76%; padding:9px 12px; font-size:var(--fs-chat); line-height:1.6; white-space:pre-wrap; }
.msg .time{ font-size:9px; color:#e8eef4; opacity:.85; }
.msg.system{ justify-content:center; }
.msg.system .bubble{
  background:rgba(0,0,0,.35); color:#e8eef4; border-radius:12px; font-size:11px;
  max-width:88%; text-align:center;
}
.msg.photo .bubble{ padding:5px; background:#fff; }
.msg.photo .bubble canvas,.msg.photo .bubble img{
  width:160px; height:160px; object-fit:cover; display:block; border-radius:8px; cursor:pointer;
}
.msg.photo .bubble.missing{
  background:#3a2226; color:#ffb0b0; padding:9px 12px; font-size:11px;
  border:1px dashed #6b4040; max-width:200px;
}
#chat-actions{
  flex:0 0 auto; background:#1a1f29; border-top:1px solid var(--line);
  padding:10px; display:flex; flex-direction:column; gap:8px; max-height:220px; overflow-y:auto;
}
.chat-action{
  background:#242b38; border:1px solid var(--line); color:var(--text);
  border-radius:18px; padding:13px 16px; min-height:48px;
  font-size:var(--fs-chat); text-align:left;
}
.chat-action:hover{ border-color:var(--accent); background:#2c3646; }
.chat-action.buy{
  background:linear-gradient(180deg,#3ea877,#2d7d58); border-color:#4fcf94;
  color:#fff; font-weight:bold; text-align:center;
}
.chat-action.buy:hover{ background:linear-gradient(180deg,#49c78c,#357f5d); }
.chat-action.buy.poor,
.chat-action.buy.sold-out{
  background:#242b38; border-color:var(--line); color:#6b7688;
  font-weight:normal; cursor:not-allowed;
}
/* タップ送りのボタン */
.chat-action.next{
  background:#1e2630; border-color:#3a4756; color:#9fb4c8; text-align:center;
  animation:tapblink 1.6s ease-in-out infinite;
}
.chat-action.next:hover{ background:#26303c; border-color:var(--accent); color:var(--text); }
@keyframes tapblink{ 0%,100%{ opacity:1 } 50%{ opacity:.55 } }
#chat-log.tappable{ cursor:pointer; }

/* つづきボタン（発言なし） */
.chat-action.go{
  background:#2f3a30; border-color:#4f6a55; color:#d6ecdc; text-align:center;
}
.chat-action.go:hover{ background:#3a4a3d; border-color:#7fd4a6; }

/* こちらの発言ボタン */
.chat-action.say{
  background:#2b3a4e; border-color:#4a6a8e; color:#dce8f6; text-align:center;
}
.chat-action.say:hover{ background:#35485f; border-color:#7fb0e0; }
.chat-empty{ color:#e8eef4; opacity:.7; text-align:center; padding:40px 20px; font-size:12px; }

/* ---- 設定パネル ---- */
.cfg{ text-align:left; }
.cfg-row{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.cfg-row label{ flex:0 0 170px; font-size:13px; color:var(--sub); }
.cfg-row input[type=range]{ flex:1 1 auto; accent-color:#4fcf94; }
.cfg-row input[type=checkbox]{ width:18px; height:18px; accent-color:#4fcf94; }
.cfg-val{ flex:0 0 54px; text-align:right; font-size:12px; color:var(--gold); }
.cfg-sample{
  margin-top:16px; background:rgba(8,11,16,.9); border:1px solid var(--line);
  border-radius:10px; padding:16px 18px; position:relative;
}
/* データ管理（テストプレイ用） */
.cfg-danger{
  margin-top:18px; padding-top:14px; border-top:1px solid var(--line); text-align:left;
}
.cfg-danger-h{ font-size:12px; letter-spacing:.16em; color:var(--sub); margin-bottom:6px; }
.cfg-danger-t{ font-size:13px; color:#9aa5b8; margin-bottom:10px; }
.cfg-danger-t b{ color:#c3cede; }
.cfg-danger-t b.on{ color:var(--accent); }
.cfg-danger-btns{ display:flex; gap:10px; flex-wrap:wrap; }
.btn.danger{
  border-color:#6b4040; color:#e0a0a0; background:#2a1e1e;
  padding:9px 16px; min-height:40px; font-size:13px;
}
.btn.danger:hover{ border-color:#ff6b6b; color:#ffb3b3; }
.cfg-sample-name{
  position:absolute; top:-11px; left:14px;
  background:linear-gradient(180deg,#2d7d58,#1f5b40); border:1px solid #4fcf94;
  border-radius:14px; padding:3px 14px; font-size:var(--fs-name); font-weight:bold;
}
.cfg-sample-text{ font-size:var(--fs-text); line-height:1.85; padding-top:6px; }

/* ショップ */
#shop-list{ flex:1 1 auto; overflow-y:auto; padding:10px; }
.shop-item{
  display:flex; gap:10px; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:10px; margin-bottom:10px;
}
.shop-item.owned{ opacity:.55; }
.shop-thumb{ flex:0 0 76px; height:76px; border-radius:6px; overflow:hidden; background:#000; }
.shop-thumb canvas,.shop-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.shop-info{ flex:1 1 auto; min-width:0; }
.shop-name{ font-size:13px; font-weight:bold; margin-bottom:3px; }
.shop-desc{ font-size:11px; color:var(--sub); line-height:1.55; margin-bottom:7px; }
.shop-buy{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.shop-price{ color:var(--gold); font-size:13px; font-weight:bold; }
.shop-btn{
  background:linear-gradient(180deg,#3ea877,#2d7d58); border:1px solid #4fcf94; color:#fff;
  border-radius:6px; padding:5px 14px; font-size:12px; font-weight:bold;
}
.shop-btn:disabled{ background:#2a3140; border-color:var(--line); color:#6b7688; }
.shop-empty{ text-align:center; color:var(--sub); font-size:12px; padding:40px 20px; line-height:1.8; }

/* アルバム */
#album-grid{
  flex:1 1 auto; overflow-y:auto; padding:10px;
  display:grid; grid-template-columns:1fr 1fr; gap:8px; align-content:start;
}
.album-cell{
  position:relative; border-radius:8px; overflow:hidden; background:#000;
  border:1px solid var(--line); aspect-ratio:1/1;
}
.album-cell.gift{ border-color:var(--accent2); }
.album-cell canvas,.album-cell img{ width:100%; height:100%; object-fit:cover; display:block; }
.album-cell .cap{
  position:absolute; left:0; right:0; bottom:0;
  background:linear-gradient(transparent,rgba(0,0,0,.85));
  font-size:10px; padding:12px 6px 5px; color:#fff;
}
.album-cell.locked{ display:flex; align-items:center; justify-content:center; color:#39414f; font-size:26px; }
.album-sep{ grid-column:1/3; font-size:11px; color:var(--sub); padding:6px 2px 0; }

/* クリッカー */
#clicker-body{ flex:1 1 auto; display:flex; flex-direction:column; padding:12px; overflow:hidden; position:relative; }
#clicker-stat{ text-align:center; font-size:12px; color:var(--sub); line-height:1.9; margin-bottom:6px; }
#clicker-stat b{ color:var(--gold); font-size:15px; }
#clicker-btn{
  flex:0 0 auto; width:142px; height:142px; margin:2px auto 10px; border-radius:50%;
  background:radial-gradient(circle at 35% 30%,#ffe89a,#e0a92c 60%,#a1741a);
  border:5px solid #7c5811; color:#5a3f08; font-size:23px; font-weight:bold;
  box-shadow:0 8px 20px rgba(0,0,0,.5); transition:transform .06s;
}
#clicker-btn:active{ transform:scale(.93); }
#clicker-shop{ flex:1 1 auto; overflow-y:auto; }
.up-item{
  display:flex; align-items:center; gap:8px; background:var(--panel);
  border:1px solid var(--line); border-radius:8px; padding:8px 10px; margin-bottom:7px;
}
.up-info{ flex:1 1 auto; min-width:0; }
.up-name{ font-size:12px; font-weight:bold; }
.up-eff{ font-size:10px; color:var(--sub); }
.up-btn{
  background:#2d7d58; border:1px solid #4fcf94; color:#fff; border-radius:6px;
  padding:5px 10px; font-size:11px; white-space:nowrap;
}
.up-btn:disabled{ background:#2a3140; border-color:var(--line); color:#6b7688; }
.coin-pop{
  position:absolute; color:var(--gold); font-weight:bold; font-size:14px;
  pointer-events:none; animation:coinup .8s ease-out forwards;
}
@keyframes coinup{ to{ transform:translateY(-46px); opacity:0; } }

/* パズル */
#puzzle-body{ flex:1 1 auto; display:flex; flex-direction:column; align-items:center; padding:10px; }
#puzzle-stat{ font-size:12px; color:var(--sub); margin-bottom:8px; }
#puzzle-stat b{ color:var(--gold); }
#puzzle-canvas{ border-radius:10px; background:#0b0e13; border:1px solid var(--line); touch-action:none; }
#puzzle-msg{ font-size:12px; color:var(--accent); height:36px; display:flex; align-items:center; text-align:center; }

/* スロット */
#slot-body{ flex:1 1 auto; display:flex; flex-direction:column; align-items:center; padding:12px; }
#slot-reels{ display:flex; gap:8px; margin:8px 0 14px; }
#slot-reels span{
  width:74px; height:96px; border-radius:10px;
  background:linear-gradient(180deg,#fdfdfd,#c9cfda); color:#1b1f26;
  display:flex; align-items:center; justify-content:center; font-size:42px;
  border:3px solid #40495a; box-shadow:inset 0 0 14px rgba(0,0,0,.25);
}
#slot-reels span.spinning{ animation:reelshake .08s infinite; }
@keyframes reelshake{ 0%{transform:translateY(-2px)} 50%{transform:translateY(2px)} 100%{transform:translateY(-2px)} }
#slot-msg{ font-size:13px; min-height:36px; color:var(--accent); margin-bottom:6px; text-align:center; line-height:1.4; }
#slot-bets{ display:flex; gap:6px; margin-bottom:10px; }
.bet-btn{
  background:#242b38; border:1px solid var(--line); color:var(--sub);
  border-radius:6px; padding:6px 11px; font-size:12px;
}
.bet-btn.on{ background:#2d7d58; border-color:#4fcf94; color:#fff; }
#slot-table{ margin-top:12px; font-size:10px; color:#6b7688; line-height:1.9; text-align:center; }

/* トースト（会話中でも見えるようステージ右上） */
#phone-toast{
  position:absolute; top:56px; right:16px; width:300px;
  pointer-events:none; z-index:110;
}
.toast{
  background:rgba(20,26,34,.96); border:1px solid var(--accent); border-radius:10px;
  padding:9px 13px; margin-bottom:8px; font-size:12px; color:var(--text);
  box-shadow:0 6px 20px rgba(0,0,0,.6); animation:toastin .3s ease-out;
}
.toast b{ color:var(--accent); }
@keyframes toastin{ from{ opacity:0; transform:translateY(-12px);} }

/* ---------- 画像ビューア（縦いっぱい） ---------- */
#viewer{
  position:absolute; inset:0; z-index:120;
  background:rgba(3,5,8,.95);
  display:flex; align-items:center; justify-content:center;
  padding:14px 14px 36px;          /* 下はヒント表示のぶん空ける */
  backdrop-filter:blur(4px);
}
#viewer-inner{
  height:100%; display:flex; align-items:center; justify-content:center;
  pointer-events:none;
}
#viewer-inner img,
#viewer-inner canvas{
  height:100%; width:auto; max-width:1230px; object-fit:contain; display:block;
  border-radius:6px; box-shadow:0 24px 70px rgba(0,0,0,.75);
  pointer-events:auto;
}
#viewer-inner.tappable img,
#viewer-inner.tappable canvas{ cursor:pointer; }
#viewer-hint{
  position:absolute; left:0; right:0; bottom:10px; text-align:center;
  font-size:12px; color:var(--sub); pointer-events:none;
}
#viewer-hint b{ color:var(--gold); }
#viewer-close{
  position:absolute; top:14px; right:16px;
  width:52px; height:52px; border-radius:50%;
  background:rgba(20,26,34,.9); border:1px solid var(--line); color:var(--sub); font-size:19px;
}
#viewer-close:hover{ color:var(--text); border-color:var(--accent); }

/* ---------- モーダル / ログ / エンディング ---------- */
/* ---------- 制作者ロゴ（タイトル右下） ---------- */
#maker-logo{
  position:absolute; right:22px; bottom:18px; z-index:5;
  display:flex; align-items:center; gap:10px;
  opacity:.9; pointer-events:none;
}
#maker-logo img{
  max-height:56px; max-width:200px; display:block;
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.95)) drop-shadow(0 0 14px rgba(0,0,0,.7));
}
#maker-logo img[src=""]{ display:none; }
#maker-logo span{
  font-size:12px; letter-spacing:.14em; color:#c3cede;
  text-shadow:0 2px 8px rgba(0,0,0,.9);
}
#maker-logo span:empty{ display:none; }

/* ---------- クレジット ---------- */
#credit-screen{
  position:absolute; inset:0; background:rgba(4,6,10,.9); z-index:120;
  display:flex; align-items:center; justify-content:center;
  backdrop-filter:blur(3px);
}
#credit-inner{
  background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:26px 30px; width:760px; max-height:640px;
  display:flex; flex-direction:column; text-align:center;
}
#credit-head{ margin-bottom:16px; }
#credit-logo{ max-height:70px; max-width:280px; display:block; margin:0 auto 10px; }
#credit-title{
  margin:0; font-size:22px; letter-spacing:.16em;
  background:linear-gradient(180deg,#fff,#9fe6c2);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
#credit-body{
  flex:1 1 auto; overflow-y:auto; text-align:left;
  font-size:14px; line-height:1.95; color:#d3dae6; margin-bottom:18px;
  padding-right:6px;
}
.cr-sec{ margin-bottom:18px; }
.cr-sec:last-child{ margin-bottom:0; }
.cr-sec h3{
  margin:0 0 6px; font-size:12px; letter-spacing:.2em;
  color:var(--accent); border-bottom:1px solid var(--line); padding-bottom:5px;
}
.cr-sec p{ margin:0; white-space:pre-wrap; }
.cr-sec.note p{ font-size:12px; color:#8b95a8; line-height:1.85; }
#credit-close{ align-self:center; }

#modal,#log-screen,#ending-screen{
  position:absolute; inset:0; background:rgba(4,6,10,.86);
  display:flex; align-items:center; justify-content:center; z-index:100;
  backdrop-filter:blur(3px);
}
#modal-inner{
  background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:24px; min-width:460px; max-width:520px; text-align:center;
}
#modal-title{ font-size:18px; font-weight:bold; margin-bottom:14px; color:var(--accent); }
#modal-title:empty{ display:none; }
#modal-body{ font-size:14px; line-height:1.8; color:#d3dae6; margin-bottom:20px; }
#modal-body .photo-view{ margin:0 auto 14px; width:250px; height:250px; border-radius:10px; overflow:hidden; border:1px solid var(--line); }
#modal-body .photo-view.big{ width:420px; height:420px; margin-bottom:4px; }
#modal-body .photo-view canvas,#modal-body .photo-view img{ width:100%; height:100%; object-fit:cover; display:block; }
#modal-foot{ display:flex; gap:10px; justify-content:center; }

#log-inner{
  background:var(--panel); border:1px solid var(--line); border-radius:14px;
  padding:24px; width:820px; max-height:620px; display:flex; flex-direction:column;
}
#log-inner h2{ margin:0 0 14px; font-size:18px; }
#log-body{ flex:1 1 auto; overflow-y:auto; font-size:14px; line-height:1.9; margin-bottom:16px; }
.log-line{ margin-bottom:10px; }
.log-line .who{ color:var(--accent); font-weight:bold; margin-right:8px; }
.log-line .who.me{ color:#8fb4e8; }
.log-line .who.kenji{ color:#d8b47c; }

#ending-inner{ text-align:center; width:700px; padding:30px; }
#ending-label{ letter-spacing:.4em; font-size:12px; color:var(--sub); margin:0 0 8px; }
#ending-title{
  font-size:42px; margin:0 0 22px;
  background:linear-gradient(180deg,#fff,#9fe6c2); -webkit-background-clip:text; background-clip:text; color:transparent;
}
#ending-text{ font-size:14px; line-height:1.95; color:#d3dae6; white-space:pre-wrap; margin-bottom:20px; max-height:330px; overflow-y:auto; }
#ending-stats{ font-size:12px; color:var(--sub); line-height:1.9; margin-bottom:24px; }
