:root{
  --blue:#2E7CF6;--blue-deep:#1A5BEE;--teal:#1ECBBE;--teal-deep:#11B3A6;
  --grad:linear-gradient(135deg,#2E7CF6 0%,#1ECBBE 100%);
  --ink:#0E1A2B;--muted:#7A8AA0;--bg-bubble:#F1F3F7;--live-tint:#EAF8F6;--line:#E7ECF3;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent;}
html{height:100%;background:#0A1322;}
body{
  margin:0;height:100vh;height:100dvh;overflow:hidden;overscroll-behavior:none;
  font-family:'Zen Kaku Gothic New',sans-serif;color:var(--ink);
  background:radial-gradient(1100px 700px at 15% -10%,rgba(46,124,246,.20),transparent 60%),
             radial-gradient(900px 700px at 95% 110%,rgba(30,203,190,.22),transparent 55%),#0A1322;
}
.stage{position:fixed;top:0;left:0;width:100%;height:100dvh;display:flex;align-items:center;justify-content:center;}
.screen[hidden]{display:none;}

/* アイコン（線で描いたSVG・絵文字なし） */
.ic{width:22px;height:22px;display:block;}

/* ロゴ（画像をそのまま表示・白枠なし） */
.logo{display:flex;align-items:center;justify-content:center;flex:0 0 auto;}
.logo img{width:100%;height:100%;object-fit:contain;display:block;}
.logo.sm{width:30px;height:30px;}
.logo.big{width:80px;height:80px;margin-bottom:12px;}
.brand-lg{font-family:'M PLUS Rounded 1c';font-weight:800;font-size:24px;margin-bottom:10px;}

/* カード（設定・ログイン） */
.card{background:#fff;width:100%;height:100%;padding:34px 28px;
  padding-top:max(40px,env(safe-area-inset-top));padding-bottom:max(34px,env(safe-area-inset-bottom));
  display:flex;flex-direction:column;align-items:flex-start;justify-content:center;}
.card .lead{color:var(--muted);font-size:14px;line-height:1.7;margin-bottom:20px;}
.card code{background:#F1F3F7;padding:2px 7px;border-radius:6px;font-size:13px;color:var(--blue-deep);}
.field{width:100%;border:1.5px solid var(--line);border-radius:13px;padding:13px 15px;font-size:16px;
  font-family:'Zen Kaku Gothic New';outline:none;margin-bottom:12px;transition:border-color .15s;}
.field:focus{border-color:var(--blue);}
.btn{width:100%;border:none;cursor:pointer;font-family:'M PLUS Rounded 1c';font-weight:700;font-size:15px;
  padding:14px;border-radius:13px;background:var(--grad);color:#fff;box-shadow:0 10px 24px -8px rgba(46,124,246,.5);
  transition:transform .12s;}
.btn:active{transform:scale(.98);}
.btn.ghost{background:#F1F3F7;color:var(--blue-deep);box-shadow:none;}
.btn:disabled{opacity:.6;cursor:default;}
.err{color:#E2533B;font-size:13px;margin-top:12px;}
.ok-msg{color:var(--teal-deep);font-size:13px;margin-top:12px;font-weight:700;}

/* パネル（ダッシュボード・トーク・設定の外枠） */
.panel{background:#fff;overflow:hidden;width:100%;height:100%;min-height:0;position:relative;
  display:flex;flex-direction:column;}

/* 白ベースのヘッダー */
.head.light{background:#fff;color:var(--ink);border-bottom:1px solid var(--line);
  padding:11px 10px;padding-top:max(11px,env(safe-area-inset-top));display:flex;align-items:center;gap:10px;}
.brand{font-family:'M PLUS Rounded 1c';font-weight:800;font-size:19px;flex:1;color:var(--ink);}
.htxt{flex:1;min-width:0;}
.htxt .rm{font-family:'M PLUS Rounded 1c';font-weight:700;font-size:16px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.htxt .sub{font-size:11.5px;color:var(--muted);display:flex;align-items:center;gap:6px;margin-top:1px;}
.htxt .sub i{width:7px;height:7px;border-radius:50%;background:#cfd8e6;transition:background .3s;flex:0 0 auto;}
.htxt .sub i.ok{background:var(--teal);box-shadow:0 0 8px var(--teal);}
.iconbtn{width:38px;height:38px;border-radius:11px;border:none;cursor:pointer;background:transparent;
  color:#5B6B82;display:flex;align-items:center;justify-content:center;flex:0 0 auto;transition:background .12s;}
.iconbtn:active{background:#EEF2F7;}

/* ダッシュボード本体 */
.body{flex:1;min-height:0;overflow-y:auto;padding:18px;padding-bottom:max(18px,env(safe-area-inset-bottom));}
.hello{font-family:'M PLUS Rounded 1c';font-weight:700;font-size:17px;margin-bottom:6px;}
.mystatus{display:inline-flex;align-items:center;gap:7px;font-family:'M PLUS Rounded 1c';font-weight:700;
  font-size:12.5px;color:var(--teal-deep);margin:0 0 18px;}
.mystatus .dot{width:8px;height:8px;border-radius:50%;background:#cfd8e6;flex:0 0 auto;}
.mystatus .dot.ok{background:var(--teal);box-shadow:0 0 8px var(--teal);}
.roomcreate{display:flex;gap:8px;margin-bottom:24px;}
.roomcreate .field{margin-bottom:0;}
.roomcreate .btn{width:auto;white-space:nowrap;padding:13px 18px;}
.list-title{font-size:12px;color:var(--muted);font-weight:700;margin-bottom:10px;letter-spacing:.02em;}
.roomlist{display:flex;flex-direction:column;gap:9px;margin-bottom:24px;}
.roomitem{position:relative;display:flex;align-items:center;gap:12px;text-align:left;width:100%;border:1px solid var(--line);
  background:#fff;border-radius:15px;padding:12px 14px;cursor:pointer;font-family:inherit;transition:border-color .15s,transform .1s;}
.roomitem:hover{border-color:var(--blue);}
.roomitem:active{transform:scale(.99);}
.ri-ava{width:42px;height:42px;border-radius:13px;background:var(--bg-bubble);color:var(--blue);font-weight:800;
  font-family:'M PLUS Rounded 1c';display:flex;align-items:center;justify-content:center;flex:0 0 auto;font-size:18px;}
.ri-ava .ic{width:24px;height:24px;}
.ri-body{display:flex;flex-direction:column;min-width:0;flex:1;}
.ri-name{font-weight:700;font-size:15px;color:var(--ink);}
.ri-last{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px;}
.roomitem.unread .ri-name{font-weight:800;}
.ri-badge{min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:var(--blue);color:#fff;
  font-family:'M PLUS Rounded 1c';font-weight:800;font-size:12px;display:flex;align-items:center;justify-content:center;
  flex:0 0 auto;align-self:center;box-shadow:0 4px 10px -3px rgba(46,124,246,.6);}
.empty{color:var(--muted);font-size:13px;text-align:center;padding:26px 10px;}

/* メンバーのログイン状況 */
.memberlist{display:flex;flex-direction:column;gap:8px;}
.memberitem{display:flex;align-items:center;gap:11px;border:1px solid var(--line);border-radius:14px;
  padding:10px 13px;background:#fff;}
.mi-ava{width:38px;height:38px;border-radius:11px;background:#EEF3FB;font-weight:800;
  font-family:'M PLUS Rounded 1c';display:flex;align-items:center;justify-content:center;flex:0 0 auto;font-size:16px;}
.mi-ava .ic{width:22px;height:22px;}
.mi-body{display:flex;flex-direction:column;min-width:0;flex:1;gap:2px;}
.mi-name{font-weight:700;font-size:14.5px;color:var(--ink);display:flex;align-items:center;gap:7px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.you-tag{font-size:10px;font-weight:700;color:var(--blue-deep);background:#EAF1FE;padding:1px 7px;border-radius:999px;flex:0 0 auto;}
.mi-body .st{font-size:12px;color:var(--muted);}
.mi-body .st.on{color:var(--teal-deep);font-weight:700;}
.mi-dot{width:9px;height:9px;border-radius:50%;background:#cfd8e6;flex:0 0 auto;}
.mi-dot.on{background:var(--teal);box-shadow:0 0 8px var(--teal);}

/* プロフィール設定 */
.set-ava{width:84px;height:84px;border-radius:24px;background:#EEF3FB;align-self:center;margin:6px 0 22px;
  display:flex;align-items:center;justify-content:center;font-family:'M PLUS Rounded 1c';font-weight:800;font-size:38px;color:var(--blue);
  box-shadow:0 14px 32px -12px rgba(46,124,246,.4);}
.set-ava .ic{width:46px;height:46px;}
.set-label{display:block;font-size:12px;font-weight:700;color:var(--muted);margin:0 0 9px 2px;letter-spacing:.02em;}
.set-label:not(:first-of-type){margin-top:20px;}
.pick{display:flex;flex-wrap:wrap;gap:8px;}
.pchip{border:1.5px solid var(--line);background:#fff;border-radius:13px;min-width:46px;height:46px;padding:0 10px;
  cursor:pointer;font-family:'Zen Kaku Gothic New';font-size:13px;color:var(--ink);
  display:flex;align-items:center;justify-content:center;transition:border-color .12s,box-shadow .12s,transform .1s;}
.pchip .ic{width:24px;height:24px;}
.pchip:active{transform:scale(.94);}
.pchip.on{border-color:var(--blue);color:var(--blue-deep);box-shadow:0 0 0 3px rgba(46,124,246,.16);}
.pick.colors{gap:11px;}
.cchip{width:34px;height:34px;border-radius:50%;border:3px solid #fff;cursor:pointer;
  box-shadow:0 0 0 1.5px var(--line);transition:transform .1s,box-shadow .12s;}
.cchip:active{transform:scale(.9);}
.cchip.on{box-shadow:0 0 0 3px var(--blue);transform:scale(1.06);}

/* トーク本体 */
.stream{flex:1;min-height:0;overflow-y:auto;padding:16px 14px 8px;display:flex;flex-direction:column;gap:8px;background:#fff;}
.stream::-webkit-scrollbar{width:0;}
.day{align-self:center;font-size:11px;color:var(--muted);background:#F1F3F7;padding:4px 12px;border-radius:999px;margin-bottom:4px;}
.row{display:flex;flex-direction:column;max-width:84%;}
.row.commit{animation:rise .26s ease both;}
.row.me{align-self:flex-end;align-items:flex-end;}
.row.you{align-self:flex-start;align-items:flex-start;}
.nm{font-size:11px;color:var(--muted);margin:0 8px 3px;font-weight:700;}
.bl{display:flex;align-items:flex-end;gap:6px;max-width:100%;}
.me .bl{flex-direction:row-reverse;}
.bubble{padding:9px 13px;border-radius:18px;font-size:15px;line-height:1.55;word-break:break-word;}
.you .bubble{background:var(--bg-bubble);color:var(--ink);border-top-left-radius:6px;}
.me .bubble{background:var(--grad);color:#fff;border-top-right-radius:6px;}
.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px;word-break:break-all;}
.you .bubble a{color:var(--blue-deep);}
.tm{font-size:10px;color:var(--muted);white-space:nowrap;padding-bottom:2px;flex:0 0 auto;}

/* ライブ入力（相手のみ・点滅なし） */
.live{border:1.5px dashed var(--teal);background:var(--live-tint);}
.ltag{display:inline-flex;align-items:center;gap:6px;font-family:'M PLUS Rounded 1c';font-weight:700;font-size:10.5px;color:var(--teal-deep);margin:0 8px 3px;}
.ltag .rec{width:7px;height:7px;border-radius:50%;background:var(--teal);box-shadow:0 0 9px var(--teal);}
.caret{display:inline-block;width:2px;height:1.05em;background:var(--teal-deep);margin-left:1px;vertical-align:-2px;opacity:.55;}

/* 入力バー */
.comp{padding:8px 10px;padding-bottom:max(8px,env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);}
.bar{display:flex;align-items:flex-end;gap:8px;}
.wrap{flex:1;background:#F1F3F7;border-radius:20px;padding:9px 15px;}
#msg{width:100%;border:none;background:transparent;outline:none;font-family:'Zen Kaku Gothic New';font-size:16px;color:var(--ink);resize:none;max-height:120px;line-height:1.5;}
.send{width:42px;height:42px;border-radius:50%;background:var(--grad);color:#fff;border:none;cursor:pointer;
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;box-shadow:0 6px 16px -5px rgba(46,124,246,.55);transition:transform .15s;}
.send .ic{width:20px;height:20px;}
.send:active{transform:scale(.92);}

/* 新着メッセージボタン */
.newmsg{position:absolute;left:50%;transform:translateX(-50%);bottom:78px;z-index:5;border:none;cursor:pointer;
  font-family:'M PLUS Rounded 1c';font-weight:700;font-size:12.5px;color:#fff;background:var(--blue);
  padding:8px 16px;border-radius:999px;box-shadow:0 8px 20px -6px rgba(46,124,246,.6);}
.newmsg[hidden]{display:none;}

/* 長押しメニュー（アクションシート） */
.sheet-overlay{position:fixed;inset:0;z-index:50;background:rgba(8,18,34,.45);
  display:flex;align-items:flex-end;justify-content:center;padding:14px;
  padding-bottom:max(14px,env(safe-area-inset-bottom));}
.sheet-overlay[hidden]{display:none;}
.sheet{width:100%;max-width:460px;display:flex;flex-direction:column;gap:8px;animation:rise .18s ease both;}
.sheet-item{width:100%;border:none;cursor:pointer;font-family:'M PLUS Rounded 1c';font-weight:700;font-size:16px;
  padding:16px;border-radius:16px;background:#fff;color:var(--blue-deep);box-shadow:0 8px 24px -10px rgba(5,25,55,.4);}
.sheet-item.danger{color:#E2533B;}
.sheet-item.cancel{color:var(--muted);margin-top:4px;}
.sheet-item:active{transform:scale(.99);}

@keyframes rise{from{opacity:0;transform:translateY(7px);}to{opacity:1;transform:none;}}

/* PC・大画面ではカード型で中央に（スマホは全画面のまま） */
@media(min-width:540px){
  .stage{padding:18px;}
  .panel{width:480px;height:min(840px,94vh);border-radius:26px;box-shadow:0 30px 80px -24px rgba(5,25,55,.6);}
  .card{width:420px;height:auto;border-radius:24px;justify-content:flex-start;
    box-shadow:0 30px 80px -24px rgba(5,25,55,.6);padding:34px 28px;}
}
