/* 予測変換 — 見た目
   明るい紙色のトーク画面。話が進むと --w（0〜1）が上がり、画面がくすんでいく */
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;overflow:hidden;background:#1d1c21;overscroll-behavior:none}
body{font-family:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic UI","Yu Gothic","Noto Sans JP",Meiryo,sans-serif;color:#22252b;-webkit-text-size-adjust:100%;touch-action:manipulation;user-select:none;-webkit-user-select:none}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
ul{list-style:none}

#phone{--w:0;--paper:#f3efe6;--ink:#22252b;--me:#3d4a8f;--accent:#c8452f;--sub:#7d7a72;
  position:relative;width:100%;max-width:430px;height:100vh;height:100dvh;margin:0 auto;display:flex;flex-direction:column;background:var(--paper);overflow:hidden}
@media (min-width:600px) and (min-height:700px){
  body{display:flex;align-items:center;justify-content:center}
  #phone{height:min(860px,calc(100dvh - 40px));border-radius:38px;box-shadow:0 0 0 10px #0c0c0f,0 0 0 12px #34333a,0 30px 80px rgba(0,0,0,.55)}
}

/* 上のバー */
#bar{flex:none;display:flex;justify-content:space-between;align-items:center;height:calc(34px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 18px 0;font-size:14px;font-weight:600;background:#ece7dc;position:relative;z-index:40}
#bar-right{display:flex;align-items:center;gap:8px}
#mute{width:40px;height:34px;font-size:17px;line-height:1;border-radius:8px}
#mute.off{opacity:.3;text-decoration:line-through}
.sig{display:flex;align-items:flex-end;gap:2px;height:11px}
.sig i{width:3px;background:var(--ink);border-radius:1px}
.sig i:nth-child(1){height:4px}.sig i:nth-child(2){height:6px}.sig i:nth-child(3){height:8px}.sig i:nth-child(4){height:11px}
.bat{width:23px;height:11px;border:1.5px solid var(--ink);border-radius:3px;padding:1px;position:relative}
.bat::after{content:"";position:absolute;right:-4px;top:2.5px;width:2px;height:4px;background:var(--ink);border-radius:0 1px 1px 0}
.bat i{display:block;width:34%;height:100%;background:var(--ink);border-radius:1px}

/* 相手の名前 */
#top{flex:none;display:flex;align-items:center;gap:10px;height:48px;padding:0 14px;background:#ece7dc;border-bottom:1px solid rgba(0,0,0,.08);position:relative;z-index:5}
#top .back{font-size:28px;line-height:1;color:var(--sub);margin-top:-4px}
#avatar{width:32px;height:32px;border-radius:50%;background:#d9a441;color:#fff;font-size:15px;font-weight:700;display:flex;align-items:center;justify-content:center;transition:background .6s}
#peer{font-size:16px;font-weight:700;min-width:2em}

/* トーク */
#chat-wrap{flex:1;min-height:0;position:relative}
#gloom{position:absolute;inset:0;background:#26232c;opacity:calc(var(--w) * .82);transition:opacity 2.4s;pointer-events:none}
#chat{position:absolute;inset:0;overflow-y:auto;padding:12px 12px 16px;display:flex;flex-direction:column;gap:7px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
#chat::-webkit-scrollbar{display:none}
#chat::before{content:"";flex:1 0 0}
.chip{align-self:center;font-size:11.5px;color:#fff;background:rgba(60,56,66,.42);padding:3px 11px;border-radius:99px;margin:5px 0 2px}
.msg{display:flex;align-items:flex-end;gap:6px;max-width:100%;animation:pop .22s ease-out both}
.msg.me{flex-direction:row-reverse}
.bub{max-width:76%;padding:9px 13px;border-radius:18px;font-size:16px;line-height:1.5;word-break:break-word;background:#fff;box-shadow:0 1px 1.5px rgba(0,0,0,.1)}
.msg.mom .bub{border-bottom-left-radius:5px}
.msg.me .bub{background:var(--me);color:#fff;border-bottom-right-radius:5px}
.meta{font-size:10.5px;color:#8b8792;line-height:1.3;text-align:right;flex:none;padding-bottom:2px}
.msg.mom .meta{text-align:left}
.typing .bub{display:flex;gap:4px;padding:14px 14px}
.typing .bub i{width:6px;height:6px;border-radius:50%;background:#aaa5a0;animation:dots 1s infinite}
.typing .bub i:nth-child(2){animation-delay:.15s}.typing .bub i:nth-child(3){animation-delay:.3s}
.sys{align-self:center;font-size:12px;color:#fff;background:rgba(60,56,66,.5);padding:4px 12px;border-radius:8px}
@keyframes pop{from{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:none}}
@keyframes dots{0%,60%,100%{opacity:.3;transform:none}30%{opacity:1;transform:translateY(-3px)}}
#toast{position:absolute;left:50%;bottom:8px;transform:translateX(-50%);white-space:nowrap;font-size:12.5px;color:#fff;background:rgba(34,37,43,.86);padding:6px 14px;border-radius:99px;opacity:0;transition:opacity .25s;pointer-events:none;z-index:6}
#toast.show{opacity:1}

/* 入力欄 */
#compose{flex:none;display:flex;align-items:center;gap:8px;padding:7px 10px;background:#e6e1d6;border-top:1px solid rgba(0,0,0,.07);position:relative;z-index:5}
#field{flex:1;min-width:0;min-height:40px;display:flex;align-items:center;flex-wrap:wrap;padding:7px 14px;border-radius:20px;background:#fff;font-size:16px;line-height:1.45;border:1.5px solid transparent;transition:border-color .2s}
#phone.composing #field{border-color:rgba(61,74,143,.4)}
#field-text{word-break:break-all}
#field-ph{color:#b3aea5}
#field-text:not(:empty)~#field-ph{display:none}
.caret{display:none;width:2px;height:1.2em;background:var(--me);margin-left:1px;animation:blink 1s steps(1) infinite}
#phone.composing .caret,.st-field .caret{display:inline-block}
@keyframes blink{50%{opacity:0}}
#send{flex:none;width:42px;height:42px;border-radius:50%;background:var(--accent);color:#fff;font-size:21px;font-weight:700;line-height:1;transition:opacity .15s,transform .12s}
#send:disabled{opacity:.28;cursor:default}
#send:not(:disabled):active,#send.press{transform:scale(.88)}
#send.ready{animation:ready 1.3s ease-in-out infinite}
@keyframes ready{50%{box-shadow:0 0 0 7px rgba(200,69,47,.2)}}

/* 候補 */
#cands{flex:none;display:flex;height:52px;background:#d7d2c8;position:relative;z-index:5}
.cand{flex:1 1 0;min-width:0;height:100%;font-size:17px;font-weight:600;padding:0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-left:1px solid rgba(0,0,0,.1);transition:background .12s,color .5s}
.cand:first-child{border-left:0}
.cand:not(:disabled):active,.cand.press{background:#fff}
.cand:disabled{cursor:default}
.cand.dim{color:rgba(34,37,43,.45)}
.cand.in{animation:candin .2s ease-out both}
.cand.small{font-size:14.5px}
@keyframes candin{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
#phone.hint .cand{animation:candhint 1.4s ease-in-out infinite}
@keyframes candhint{50%{background:#f7f3ea}}
#cands .idle{flex:1;display:flex;align-items:center;justify-content:center;font-size:13px;color:rgba(34,37,43,.38)}

/* キーボード */
#kb{flex:none;display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(4,var(--kh,43px));gap:6px;padding:7px 6px 5px;background:#cfcac0;position:relative;z-index:5}
#kb::before{content:"";position:absolute;inset:0;background:#26232c;opacity:calc(var(--w) * .5);transition:opacity 2.4s;pointer-events:none}
.key{position:relative;border-radius:7px;background:#fbf9f4;font-size:20px;box-shadow:0 1px 0 rgba(0,0,0,.28);display:flex;align-items:center;justify-content:center;transition:background .1s,color .8s}
.key.fn{background:#b3ada2;font-size:13px}
.key.tall{grid-row:span 2}
.key:active{background:#e3ded3}
.key.fn:active{background:#9d978c}
.key.odd{color:#8d1f12}
.key.del{font-size:20px}
#homebar{flex:none;height:calc(16px + env(safe-area-inset-bottom));background:#cfcac0;position:relative;z-index:5}
#homebar::after{content:"";position:absolute;left:50%;top:5px;width:118px;height:5px;margin-left:-59px;border-radius:3px;background:rgba(34,37,43,.55)}
@media (max-height:640px){#kb{--kh:37px;gap:5px}#cands{height:48px}#top{height:42px}}
@media (max-height:540px){#kb{--kh:31px;gap:4px}.key{font-size:17px}}

/* 着信（トークの部分だけを覆う） */
#call{position:absolute;inset:0;z-index:8;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px;background:rgba(27,25,33,.94);color:#fff;opacity:0;visibility:hidden;transition:opacity .35s,visibility .35s}
#call.show{opacity:1;visibility:visible}
.call-av{width:56px;height:56px;border-radius:50%;background:#d9a441;font-size:24px;font-weight:700;display:flex;align-items:center;justify-content:center}
#call.ring .call-av{animation:ring 1.2s ease-out infinite}
@keyframes ring{0%{box-shadow:0 0 0 0 rgba(217,164,65,.6)}100%{box-shadow:0 0 0 22px rgba(217,164,65,0)}}
.call-name{font-size:21px;font-weight:700}
.call-state{font-size:13.5px;color:rgba(255,255,255,.65);min-height:1.4em}
.call-cap{min-height:3.2em;font-size:16px;line-height:1.55;text-align:center;padding:0 8px}
.call-cap p{animation:pop .3s both}
.call-btns{display:flex;gap:64px;margin-top:4px}
.call-btns button{display:flex;flex-direction:column;align-items:center;gap:5px;font-size:12.5px;color:rgba(255,255,255,.8)}
.call-btns i{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:25px;font-style:normal;color:#fff}
.call-btns .no i{background:#d1453b}.call-btns .yes i{background:#35a862}
.call-btns button:active i{transform:scale(.9)}
#call.talk .call-btns{display:none}
@media (max-height:640px){.call-av{width:42px;height:42px;font-size:18px}.call-btns i{width:52px;height:52px}.call-cap{min-height:2.6em;font-size:15px}}

/* 夜 */
#night{position:absolute;inset:0;z-index:20;background:#000;opacity:0;pointer-events:none;transition:opacity 1.3s}
#night.show{opacity:1;pointer-events:auto}
#phone.night{--w:1}
#phone.night #bar,#phone.night #top{background:#17161c;color:#cfcbd6}
#phone.night #top{border-bottom-color:rgba(255,255,255,.08)}
#phone.night .sig i,#phone.night .bat i{background:#cfcbd6}
#phone.night .bat{border-color:#cfcbd6}.night .bat::after{background:#cfcbd6}
#phone.night #compose{background:#1f1d25;border-top-color:rgba(255,255,255,.06)}
#phone.night #field{background:#2c2a33;color:#e8e5ee}
#phone.night #cands{background:#25232b;color:#dedae6}
#phone.night .cand{border-left-color:rgba(255,255,255,.1)}
#phone.night .cand.press{background:#4a4654}
#phone.night #kb,#phone.night #homebar{background:#1b1a20}
#phone.night #kb::before{opacity:0}
#phone.night .key{background:#34323c;color:#d8d4e0}
#phone.night .key.fn{background:#26242c}
#phone.night #homebar::after{background:rgba(255,255,255,.5)}
#phone.night .bub{background:#34323c;color:#e8e5ee}
#phone.night .msg.me .bub{background:#4a4f6b}

/* 重ねる画面（はじめ・結果） */
.sheet{position:absolute;inset:0;z-index:30;display:flex;flex-direction:column;align-items:center;padding:calc(44px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));background:var(--paper);overflow-y:auto;opacity:0;visibility:hidden;transition:opacity .45s,visibility .45s}
.sheet.show{opacity:1;visibility:visible}
.sheet>*{flex-shrink:0}
.pill-btn{display:flex;align-items:center;justify-content:center;width:100%;max-width:320px;min-height:52px;padding:10px 20px;border-radius:26px;background:var(--me);color:#fff;font-size:17px;font-weight:700;text-decoration:none;flex:none}
.pill-btn:active{transform:scale(.97)}
.pill-btn.ghost{background:transparent;color:var(--me);border:1.5px solid var(--me);min-height:46px;font-size:15px}
.pill-btn:disabled{opacity:.4}
.text-btn{min-height:44px;padding:8px 14px;font-size:14px;color:var(--sub);text-decoration:underline;text-underline-offset:3px}

#start{justify-content:flex-start}
.st-kicker{font-size:11px;letter-spacing:.24em;color:var(--sub);margin-top:auto}
.st-field{display:flex;align-items:center;justify-content:center;width:100%;max-width:320px;margin-top:14px;padding:16px 10px;border-radius:18px;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,.07)}
.st-field h1{font-size:38px;letter-spacing:.06em;font-weight:800}
.st-field .caret{height:40px;width:3px;margin-left:5px}
.st-cands{display:flex;width:100%;max-width:320px;margin-top:8px;border-radius:12px;background:#d7d2c8;overflow:hidden}
.st-cands span{flex:1;text-align:center;padding:10px 0;font-size:15px;font-weight:600;border-left:1px solid rgba(0,0,0,.1)}
.st-cands span:first-child{border:0}
.st-lead{margin-top:20px;font-size:clamp(12px,3.75vw,14.5px);line-height:1.8;text-align:center}
.st-how{margin:16px 0 20px;width:100%;max-width:320px;font-size:13px;line-height:1.5;display:flex;flex-direction:column;gap:7px}
.st-how li{display:flex;align-items:center;gap:10px}
.st-how b{flex:none;width:46px;height:28px;border-radius:7px;background:#d7d2c8;display:flex;align-items:center;justify-content:center;font-size:13px}
.st-caution{margin-top:18px;width:100%;max-width:320px;font-size:11px;line-height:1.65;color:var(--sub)}
.st-caution li{padding-left:.9em;text-indent:-.9em}
.st-caution li::before{content:"・"}
.st-sub{display:flex;align-items:center;justify-content:center;gap:14px;min-height:44px;margin-bottom:auto;font-size:12.5px;color:var(--sub)}
.st-sub button{min-height:44px;padding:0 8px;text-decoration:underline;text-underline-offset:3px}

#report{justify-content:flex-start;gap:0}
.rp-kicker{font-size:12px;letter-spacing:.2em;color:var(--sub)}
.rp-end{margin-top:8px;font-size:29px;font-weight:800;letter-spacing:.04em;text-align:center}
.rp-msgs{width:100%;max-width:340px;margin-top:16px;display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.rp-msgs .bub{max-width:88%;background:var(--me);color:#fff;border-bottom-right-radius:5px;font-size:15px;padding:7px 12px;opacity:0;animation:pop .3s ease-out forwards}
.rp-msgs .bub.ghost{background:#3a3742}
.rp-line{margin-top:18px;font-size:14.5px;line-height:1.9;text-align:center;white-space:pre-line}
.rp-dict{width:100%;max-width:340px;margin-top:18px;padding:11px 14px 9px;border-radius:14px;background:#e6e1d6;font-size:13px}
.rp-dict-h{display:flex;justify-content:space-between;font-size:11px;color:var(--sub);padding-bottom:5px;border-bottom:1px solid rgba(0,0,0,.09)}
#rp-dict div{display:flex;justify-content:space-between;padding:5px 0;border-bottom:1px solid rgba(0,0,0,.05)}
#rp-dict div:last-child{border:0}
.rp-dict-t{font-size:13.5px;font-weight:700;padding-bottom:7px}
#rp-dict .late em{color:#8d1f12}
.rp-msgs .chip{margin:6px 0 0}
#rp-dict em{font-style:normal;color:var(--sub);font-variant-numeric:tabular-nums}
.rp-btns{width:100%;display:flex;flex-direction:column;align-items:center;gap:9px;margin-top:20px}
.rp-ends-h{margin-top:14px;font-size:12.5px;color:var(--sub)}
.rp-ends{width:100%;max-width:340px;margin-top:6px;padding-bottom:10px;font-size:12.5px;display:flex;flex-direction:column;gap:3px}
.rp-ends li{display:flex;justify-content:space-between;gap:10px;padding:5px 10px;border-radius:8px;background:rgba(0,0,0,.04);color:var(--sub)}
.rp-ends li.got{color:var(--ink);font-weight:700;background:rgba(61,74,143,.1)}
.rp-ends li span:last-child{font-weight:400;font-size:11.5px;text-align:right}

/* アンケート */
#endpop{position:absolute;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(20,18,24,.6);opacity:0;visibility:hidden;transition:opacity .3s,visibility .3s}
#endpop.show{opacity:1;visibility:visible}
.ep-card{position:relative;width:100%;max-width:350px;max-height:100%;overflow-y:auto;padding:26px 20px 12px;border-radius:22px;background:#fbf9f4;display:flex;flex-direction:column;align-items:center;gap:8px;box-shadow:0 18px 50px rgba(0,0,0,.35)}
#end-x{position:absolute;right:4px;top:4px;width:44px;height:44px;font-size:24px;color:var(--sub)}
#endpop-head{font-size:15.5px;font-weight:700;text-align:center;padding:0 22px}
.ep-label{align-self:flex-start;font-size:12.5px;color:var(--sub);margin-top:6px}
#stars{display:flex;gap:2px}
.star{width:48px;height:48px;font-size:33px;line-height:1;color:#d6d0c4;transition:color .12s,transform .12s}
.star.on{color:#e0a020}
.star:active{transform:scale(1.15)}
#fbForm{width:100%;display:flex;flex-direction:column;align-items:center;gap:6px}
#fbtext{width:100%;height:84px;padding:10px 12px;border:1.5px solid #d7d2c8;border-radius:12px;background:#fff;font:inherit;font-size:16px;line-height:1.5;resize:none;user-select:text;-webkit-user-select:text}
#fbtext:focus{outline:none;border-color:var(--me)}
#fb-err{min-height:1.3em;font-size:12.5px;color:var(--accent);text-align:center}
.ep-note{font-size:11px;line-height:1.6;color:var(--sub);text-align:center}
.ep-note a{color:inherit}
#fbThanks{display:none;flex-direction:column;align-items:center;gap:2px;padding:14px 0 4px;font-size:14.5px;line-height:1.8;text-align:center;white-space:pre-line}
.ep-div{width:100%;height:1px;background:rgba(0,0,0,.09);margin:8px 0 4px}
#portal-pitch{font-size:12.5px;line-height:1.7;text-align:center}
[hidden]{display:none!important}
