﻿
    :root{--bg:#0f1115;--panel:#151823;--text:#e6e8ef;--muted:#9aa3b2;--border:#23283a;--mine:#315da8}
    *{box-sizing:border-box}
    html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,Meiryo,sans-serif}
    header{padding:10px 14px;border-bottom:1px solid var(--border);display:flex;gap:12px;align-items:center;flex-wrap:wrap}
    .room{margin-right:auto;color:var(--muted);font-size:14px;display:flex;gap:8px;align-items:center}
    .wid-room-list-btn{
      min-width:0;
      padding:2px 5px;
      display:flex;
      align-items:center;
      gap:4px;
      border:0;
      border-radius:6px;
      background:transparent;
      color:inherit;
      font:inherit;
      cursor:pointer;
      appearance:none;
      -webkit-appearance:none;
    }
    .wid-room-list-btn code{
      min-width:0;
      max-width:min(45vw,280px);
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
      color:#c7d2fe;
      font-family:inherit;
      font-weight:900;
    }
    .wid-room-list-btn:hover{background:rgba(255,255,255,.07)}
    .wid-room-list-btn:focus-visible{outline:2px solid #5ea4ff;outline-offset:1px}
    .status{font-weight:600;color:#c7d2fe}
    .bar{width:100%;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
    .row{display:flex;gap:8px;align-items:center}
    input,button{font:inherit}
    .bar input{height:36px;padding:0 12px;border-radius:10px;border:1px solid var(--border);background:#0f1422;color:var(--text);outline:none}
    .bar input:focus,.inputrow input:focus{border-color:#4c6fa9}
    .bar input#roomInput{min-width:160px;flex:1}
    .bar input#nameInput{min-width:160px}
    .bar button{height:36px;padding:0 12px;border-radius:10px;border:1px solid var(--border);background:#172035;color:var(--text);cursor:pointer}
    main{max-width:900px;margin:16px auto;padding:0 16px}
    .muted{color:var(--muted)}
    .chat{border:1px solid var(--border);border-radius:12px;background:#131826;overflow:hidden}
    .chatlog{height:40vh;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:10px;transition:background-color .25s ease}
    .message{display:flex;flex-direction:column;align-items:flex-start;max-width:78%}
    .message.mine{align-self:flex-end;align-items:flex-end}
    .message-meta{margin:0 6px 3px;color:var(--muted);font-size:12px;line-height:1.3}
    .message-bubble{position:relative;padding:9px 13px;border-radius:16px 16px 16px 4px;background:#232b3d;color:var(--text);overflow-wrap:anywhere;white-space:pre-wrap}
    .message.mine .message-bubble{border-radius:16px 16px 4px 16px;background:var(--mine);color:#fff}
    .message.ai-comment-message{
      max-width:84%;
      flex-direction:row;
      align-items:flex-end;
      gap:7px;
    }
    .message.ai-comment-message .message-content{
      min-width:0;
      display:flex;
      flex-direction:column;
      align-items:flex-start;
    }
    .message.ai-comment-message .ai-comment-avatar{
      flex:0 0 auto;
      width:30px;
      height:30px;
      overflow:hidden;
      display:flex;
      align-items:center;
      justify-content:center;
      border:1px solid #42cce9;
      border-radius:50%;
      background:linear-gradient(145deg,#dffcff,#82e9ff);
      box-shadow:0 0 0 1px rgba(44,186,218,.16);
    }
    .message.ai-comment-message .ai-comment-avatar img{
      width:100%;
      height:100%;
      display:block;
      object-fit:cover;
      object-position:50% 60%;
      transform:scale(1.2);
      transform-origin:center;
    }
    .inputrow{display:flex;gap:8px;padding:10px;border-top:1px solid var(--border);background:#101525}
    .inputrow input{flex:1;min-width:0;height:40px;padding:0 12px;border-radius:10px;border:1px solid var(--border);background:#0f1422;color:var(--text);outline:none}
    .inputrow button{height:40px;padding:0 16px;border-radius:10px;border:1px solid var(--border);background:#1b2742;color:var(--text);cursor:pointer}

    .wid-room-list-backdrop{
      position:fixed;
      inset:0;
      z-index:2147483000;
      display:flex;
      align-items:center;
      justify-content:center;
      padding:12px;
      background:rgba(0,0,0,.62);
      backdrop-filter:blur(3px);
      -webkit-backdrop-filter:blur(3px);
      opacity:0;
      visibility:hidden;
      pointer-events:none;
      transition:opacity .2s ease,visibility 0s linear .24s;
    }
    .wid-room-list-backdrop.open{
      opacity:1;
      visibility:visible;
      pointer-events:auto;
      transition-delay:0s;
    }
    .wid-room-list-modal{
      width:min(94vw,390px);
      max-height:min(84vh,620px);
      padding:13px;
      display:flex;
      flex-direction:column;
      border:1px solid #33435b;
      border-radius:16px;
      background:#111827;
      color:#eef2f7;
      box-shadow:0 20px 70px rgba(0,0,0,.52);
      opacity:0;
      transform:translateY(10px) scale(.97);
      transition:opacity .2s ease,transform .26s cubic-bezier(.2,.8,.2,1);
    }
    .wid-room-list-backdrop.open .wid-room-list-modal{
      opacity:1;
      transform:translateY(0) scale(1);
    }
    .wid-room-list-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
    }
    .wid-room-list-head strong{font-size:14px;font-weight:1000}
    .wid-room-list-head button{
      flex:0 0 auto;
      width:32px;
      height:32px;
      padding:0;
      display:flex;
      align-items:center;
      justify-content:center;
      border:1px solid #3b4a61;
      border-radius:9px;
      background:#17243a;
      color:#eef4ff;
      font-size:20px;
      line-height:1;
      cursor:pointer;
    }
    .wid-room-list-description{
      margin:7px 1px 10px;
      color:#aab4c1;
      font-size:10px;
      line-height:1.5;
    }
    .wid-room-list-items{
      min-height:0;
      overflow:auto;
      display:flex;
      flex-direction:column;
      gap:8px;
      overscroll-behavior:contain;
    }
    .wid-room-list-item{
      padding:10px;
      border:1px solid #314056;
      border-radius:12px;
      background:#162033;
    }
    .wid-room-list-identity{
      min-width:0;
      display:flex;
      flex-direction:column;
      align-items:flex-start;
      gap:4px;
    }
    .wid-room-list-name{
      min-width:0;
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
      color:#eef4ff;
      font-family:inherit;
      font-size:12px;
      font-weight:950;
    }
    .wid-room-list-labels{
      max-width:100%;
      min-width:0;
      display:flex;
      align-items:center;
      gap:4px;
    }
    .wid-room-list-current{
      flex:0 0 auto;
      padding:2px 6px;
      border-radius:999px;
      background:#294b77;
      color:#cfe5ff;
      font-size:8px;
      font-weight:900;
    }
    .wid-room-list-title{
      min-width:0;
      max-width:245px;
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
      padding:2px 7px;
      border-radius:999px;
      background:rgba(139,92,246,.18);
      color:#d9ccff;
      font-size:8px;
      font-weight:900;
    }
    .wid-room-list-access{
      width:100%;
      min-height:35px;
      margin-top:9px;
      padding:0 9px;
      border:1px solid #3976c4;
      border-radius:10px;
      background:#2765ad;
      color:#fff;
      font-size:10px;
      font-weight:950;
      cursor:pointer;
    }
    .wid-room-list-empty{
      padding:26px 10px;
      border:1px dashed #3b4a61;
      border-radius:12px;
      color:#9aa4b2;
      text-align:center;
      font-size:11px;
    }
    body.local-light .wid-room-list-btn{
      border:0!important;
      background:transparent!important;
      color:inherit!important;
    }
    body.local-light .wid-room-list-btn code{color:#245a91!important}
    body.local-light .wid-room-list-modal{
      border-color:#b7c2cc!important;
      background:#f8fafc!important;
      color:#111827!important;
    }
    body.local-light .wid-room-list-description{color:#566473!important}
    body.local-light .wid-room-list-item{
      border-color:#cbd5df!important;
      background:#fff!important;
    }
    body.local-light .wid-room-list-name{color:#17212c!important}
    body.local-light .wid-room-list-current{background:#dbeafe!important;color:#245a91!important}
    body.local-light .wid-room-list-title{background:#eee8ff!important;color:#6742a5!important}
    body.local-light .wid-room-list-head button{
      border-color:#aeb9c3!important;
      background:#fff!important;
      color:#17212c!important;
    }
    body.local-light .wid-room-list-access{
      border-color:#2765ad!important;
      background:#2765ad!important;
      color:#fff!important;
    }

    /* iframeなどの表示幅が300px以下なら、自動的にウィジェット表示へ切り替える */
    @media (max-width:300px){
      html,body{width:100%;max-width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;font-size:12px;background:transparent}
      body{display:block}
      header{width:100%;max-width:100%;height:42px;padding:6px 7px;gap:6px;flex-wrap:nowrap;overflow:hidden;background:var(--panel)}
      .room,.room-row,#saveNameBtn{display:none}
      .bar,.name-row{width:100%;min-width:0;display:flex;gap:0}
      .bar input#nameInput{width:100%;min-width:0;height:28px;padding:0 9px;border-radius:7px;font-size:12px}
      main{width:100%;max-width:100%;height:calc(100% - 42px);margin:0;padding:0;overflow:hidden}
      main>.muted{display:none}
      .chat{width:100%;max-width:100%;height:100%;min-width:0;display:grid;grid-template-rows:minmax(0,1fr) 48px;border:0;border-radius:0;background:var(--bg)}
      .chatlog{
        height:auto;
        min-height:0;
        overflow-y:auto;
        overflow-x:hidden;
        justify-content:flex-start;
        padding:8px;
        gap:7px;
        -webkit-overflow-scrolling:touch;
        overscroll-behavior:contain;
        touch-action:pan-y;
        scrollbar-width:thin;
        background-color:var(--wid-chat-bgc,transparent);
      }
      .message{max-width:88%;flex:0 0 auto}
      .message-meta{max-width:100%;margin:0 4px 2px;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
      .message-bubble{max-width:100%;padding:6px 8px;border-radius:10px 10px 10px 3px;font-size:12px;line-height:1.35;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}
      .message.mine .message-bubble{border-radius:10px 10px 3px 10px}
      .message.ai-comment-message{max-width:91%;gap:5px}
      .message.ai-comment-message .ai-comment-avatar{width:26px;height:26px}
      .inputrow{height:48px;gap:5px;padding:7px}
      .inputrow input{height:33px;padding:0 8px;border-radius:8px;font-size:12px}
      .inputrow button{flex:0 0 34px;width:34px;height:33px;padding:0;border:0;border-radius:8px;background:var(--mine);font-size:0}
      .inputrow button::after{content:'➤';font-size:16px;color:#fff}
      .wid-room-list-backdrop{padding:6px}
      .wid-room-list-modal{width:100%;max-height:calc(100% - 12px);padding:10px;border-radius:12px}
      .wid-room-list-head strong{font-size:12px}
      .wid-room-list-head button{width:28px;height:28px;font-size:18px}
      .wid-room-list-description{font-size:8px;margin:5px 1px 7px}
      .wid-room-list-item{padding:7px;border-radius:9px}
      .wid-room-list-name{font-size:9px}
      .wid-room-list-current{font-size:6px}
      .wid-room-list-title{max-width:180px;font-size:6px}
      .wid-room-list-access{min-height:29px;margin-top:6px;font-size:8px}
    }

    /* 195px幅の極小ウィジェットでも、入力欄と送信ボタンを横に収める */
    @media (max-width:210px){
      html,body{font-size:11px}
      header{height:36px;padding:4px 5px}
      .bar input#nameInput{height:28px;padding:0 7px;font-size:11px}
      main{height:calc(100% - 36px)}
      .chat{grid-template-rows:minmax(0,1fr) 44px}
      .chatlog{
        padding:6px;
        gap:5px;
        overflow-y:auto;
        overflow-x:hidden;
        -webkit-overflow-scrolling:touch;
        touch-action:pan-y;
      }
      .message{max-width:94%}
      .message-meta{margin:0 3px 2px;font-size:8px}
      .message-bubble{padding:5px 7px;font-size:11px;line-height:1.3}
      .inputrow{height:44px;gap:4px;padding:5px}
      .inputrow input{height:34px;padding:0 6px;font-size:11px}
      .inputrow button{flex-basis:31px;width:31px;height:34px}
      .inputrow button::after{font-size:14px}
    }

    /* WID chat background: bgc: コマンド用 */
    .chat,
    .chatlog{
      background-color:var(--wid-chat-bgc, var(--bg));
    }

    /* chat command visual effects */
    #effectLayer{position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:9999}
    .fx-word{position:absolute;white-space:nowrap;font-weight:800;text-shadow:0 1px 3px rgba(0,0,0,.35);will-change:transform;line-height:1}
    @keyframes fxLeft{from{transform:translateX(0) rotate(var(--rot))}to{transform:translateX(calc(-100vw - 120%)) rotate(var(--rot))}}
    @keyframes fxRight{from{transform:translateX(0) rotate(var(--rot))}to{transform:translateX(calc(100vw + 120%)) rotate(var(--rot))}}
    @keyframes fxDown{from{transform:translateY(0) rotate(var(--rot))}to{transform:translateY(calc(100vh + 120%)) rotate(var(--rot))}}
    @keyframes fxUp{from{transform:translateY(0) rotate(var(--rot))}to{transform:translateY(calc(-100vh - 120%)) rotate(var(--rot))}}
    @media (prefers-reduced-motion:reduce){.fx-word{animation-duration:.01ms!important;animation-iteration-count:1!important}}

    /* toast command */
    #toastLayer{
      position:fixed; top:14px; left:50%; transform:translateX(-50%);
      z-index:10001; display:flex; flex-direction:column; gap:8px;
      width:min(92vw,520px); pointer-events:none;
    }
    .chat-toast{
      align-self:center; max-width:100%; padding:10px 14px; border-radius:12px;
      background:rgba(17,24,39,.94); color:#fff; border:1px solid rgba(255,255,255,.14);
      box-shadow:0 10px 30px rgba(0,0,0,.28); font-weight:700;
      overflow-wrap:anywhere; white-space:pre-line; animation:toastIn .18s ease-out, toastOut .22s ease-in 4.1s forwards;
    }
    @keyframes toastIn{from{opacity:0;transform:translateY(-10px) scale(.98)}to{opacity:1;transform:none}}
    @keyframes toastOut{to{opacity:0;transform:translateY(-8px) scale(.98)}}


    @keyframes chatShake{0%,100%{transform:translate(0)}25%{transform:translate(-7px,3px) rotate(-.5deg)}50%{transform:translate(7px,-3px) rotate(.5deg)}75%{transform:translate(-5px,-2px)}}
    .chat.is-shaking{animation:chatShake .11s linear infinite}
    #bigEffectLayer{position:fixed;inset:0;z-index:10000;pointer-events:none;display:flex;align-items:center;justify-content:center;padding:18px;overflow:hidden}
    .big-effect-text{max-width:94vw;text-align:center;overflow-wrap:anywhere;font-weight:1000;line-height:1.05;color:#fff;font-size:clamp(46px,13vw,150px);text-shadow:0 4px 12px rgba(0,0,0,.75);animation:bigPop 1.45s ease forwards}
    @keyframes bigPop{0%{opacity:0;transform:scale(.25) rotate(-5deg)}20%{opacity:1;transform:scale(1.12) rotate(2deg)}75%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1.35)}}
    .fx-spin-word{position:absolute;left:50%;top:50%;white-space:nowrap;font-weight:900;line-height:1;will-change:transform,opacity;text-shadow:0 2px 5px rgba(0,0,0,.45);animation:spinFly var(--dur) ease-out var(--delay) forwards}
    @keyframes spinFly{0%{opacity:0;transform:translate(-50%,-50%) rotate(0) scale(.3)}12%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--x)),calc(-50% + var(--y))) rotate(var(--spin)) scale(var(--scale))}}


    /* help / YouTube embed */
    .help-panel{
      align-self:center;max-width:min(92%,620px);padding:13px 15px;border-radius:14px;
      background:#172033;border:1px solid var(--border);color:var(--text);
      box-shadow:0 10px 30px rgba(0,0,0,.22);font-size:13px;white-space:pre-line;
    }
    .youtube-bubble{width:min(420px,78vw);max-width:100%}
    .youtube-frame-wrap{position:relative;width:100%;aspect-ratio:16/9;border-radius:12px;overflow:hidden;background:#000}
    .youtube-frame-wrap iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
    @media(max-width:300px){
      .help-panel{max-width:96%;padding:8px;font-size:10px}
      .youtube-bubble{width:100%}
      .youtube-frame-wrap{border-radius:8px}
    }


    /* command modal */
    .command-btn{flex:0 0 auto;height:40px;padding:0 11px;border-radius:10px;border:1px solid var(--border);background:#172035;color:var(--text);cursor:pointer;font-weight:800}
    .command-modal-backdrop{position:fixed;inset:0;z-index:11000;background:rgba(0,0,0,.58);display:none;align-items:center;justify-content:center;padding:16px}
    .command-modal-backdrop.open{display:flex}
    .command-modal{width:min(92vw,560px);max-height:min(78vh,680px);background:#111827;border:1px solid var(--border);border-radius:16px;box-shadow:0 18px 60px rgba(0,0,0,.45);display:flex;flex-direction:column;overflow:hidden}
    .command-modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid var(--border);background:#151823}
    .command-modal-title{font-weight:800}.command-modal-close{border:0;background:transparent;color:var(--text);font-size:24px;cursor:pointer}
    .command-modal-list{overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:8px;overscroll-behavior:contain}
    .command-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:9px 10px;border-radius:11px;background:#172033;border:1px solid #263149}
    .command-code{display:block;font-family:monospace;font-weight:800;overflow-wrap:anywhere}.command-desc{display:block;margin-top:2px;color:var(--muted);font-size:12px}
    .command-copy{min-width:58px;height:32px;padding:0 9px;border-radius:8px;border:1px solid var(--border);background:#1b2742;color:var(--text);cursor:pointer;font-size:12px;font-weight:700}
    @media(max-width:300px){.command-btn{height:33px;padding:0 7px;font-size:11px}.command-modal-backdrop{padding:6px}.command-modal{width:98vw;max-height:88vh;border-radius:10px}.command-modal-head{padding:8px}.command-modal-list{padding:6px;gap:5px}.command-row{padding:6px}.command-code{font-size:10px}.command-desc{font-size:9px}.command-copy{min-width:44px;height:28px;padding:0 5px;font-size:9px}}


    /* /hanten — 全画面色反転トグル
       filterをbodyへ直接掛けず、白いdifferenceレイヤーで視覚的に反転。
       fixed要素やエフェクトの配置への副作用を抑える。 */
    #hantenLayer{
      position:fixed;
      inset:0;
      z-index:2147483646;
      display:none;
      pointer-events:none;
      background:#fff;
      mix-blend-mode:difference;
    }
    body.hanten-mode #hantenLayer{display:block}

    /* fireworks */
    #fireworksLayer{
      position:fixed;inset:0;z-index:10500;pointer-events:none;overflow:hidden;
    }
    .fw-particle{
      position:absolute;width:7px;height:7px;border-radius:50%;
      background:currentColor;box-shadow:0 0 8px currentColor,0 0 16px currentColor;
      animation:fwBurst var(--dur) ease-out var(--delay) forwards;
    }
    @keyframes fwBurst{
      0%{opacity:1;transform:translate(0,0) scale(1)}
      75%{opacity:1}
      100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.25)}
    }
    .fw-core{
      position:absolute;width:12px;height:12px;border-radius:50%;
      background:#fff;box-shadow:0 0 18px #fff;
      animation:fwCore .45s ease-out forwards;
    }
    @keyframes fwCore{from{opacity:1;transform:scale(.4)}to{opacity:0;transform:scale(3.2)}}


    /* smoke */
    #smokeLayer{
      position:fixed;inset:0;z-index:10600;pointer-events:none;overflow:hidden;
    }
    .smoke-puff{
      position:absolute;bottom:-80px;border-radius:50%;
      background:radial-gradient(circle at 40% 40%,rgba(255,255,255,.34),rgba(180,185,195,.18) 45%,rgba(80,85,95,.06) 72%,transparent 78%);
      filter:blur(6px);opacity:0;
      animation:smokeRise var(--dur) ease-out var(--delay) forwards;
      will-change:transform,opacity;
    }
    @keyframes smokeRise{
      0%{opacity:0;transform:translate3d(0,0,0) scale(.55)}
      16%{opacity:.72}
      70%{opacity:.45}
      100%{opacity:0;transform:translate3d(var(--drift),calc(-100vh - 180px),0) scale(2.1)}
    }


    /* aqua — Aqua Mirror 3D water */
    #aquaLayer{position:fixed;inset:0;z-index:10700;display:none;pointer-events:auto;touch-action:none;overflow:hidden;background:#063548}
    #aquaLayer.active{display:block;animation:aquaFade 2s ease forwards}
    #aquaCanvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair}
    #aquaLayer::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(1,32,49,.12),transparent 22%,transparent 72%,rgba(2,23,37,.18)),radial-gradient(circle at 18% 0%,rgba(255,255,255,.12),transparent 34%);mix-blend-mode:multiply}
    @keyframes aquaFade{0%{opacity:0}8%,88%{opacity:1}100%{opacity:0}}

    /* wid command button correction */
    @media (max-width:300px){
      .inputrow input#msgInput{flex:1 1 auto;min-width:0}
      .inputrow #commandBtn.command-btn{
        flex:0 0 34px;width:34px;height:33px;padding:0;
        border:1px solid var(--border);border-radius:8px;
        background:#172035;color:var(--text);
        font-size:11px;font-weight:800;
      }
      .inputrow #commandBtn.command-btn::after{content:none!important}
      .inputrow #sendBtn{flex:0 0 34px;width:34px}
    }
    @media (max-width:210px){
      .inputrow input#msgInput{flex:1 1 auto;width:auto;min-width:0}
      .inputrow #commandBtn.command-btn{
        flex-basis:29px;width:29px;height:34px;font-size:10px;
      }
      .inputrow #sendBtn{flex-basis:29px;width:29px;height:34px}
    }


    /* /e shared drawing canvas */
    #drawLayer{
      position:fixed;inset:0;z-index:10800;display:none;
      background:rgba(4,8,16,.82);backdrop-filter:blur(2px);
      touch-action:none;pointer-events:auto;overflow:hidden;
    }
    #drawLayer.active{display:block}
    #drawCanvas{
      position:absolute;inset:0;width:100%;height:100%;display:block;
      touch-action:none;cursor:crosshair;
    }
    #drawCountdown{
      position:absolute;top:14px;left:50%;transform:translateX(-50%);
      padding:7px 12px;border-radius:999px;background:rgba(0,0,0,.48);
      color:#fff;font-weight:900;font-size:14px;pointer-events:none;z-index:2;
    }
    #drawHint{
      position:absolute;bottom:14px;left:50%;transform:translateX(-50%);
      color:rgba(255,255,255,.82);font-size:12px;pointer-events:none;
      white-space:nowrap;z-index:2;
    }
    @media(max-width:300px){
      #drawCountdown{top:7px;font-size:11px;padding:5px 8px}
      #drawHint{bottom:7px;font-size:9px}
    }


    #arasiModalBackdrop{position:fixed;inset:0;z-index:12000;background:rgba(0,0,0,.62);display:none;align-items:center;justify-content:center;padding:16px}
    #arasiModalBackdrop.open{display:flex}.arasi-modal{width:min(92vw,520px);max-height:80vh;background:#111827;border:1px solid var(--border);border-radius:16px;display:flex;flex-direction:column;overflow:hidden}
    .arasi-head{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--border)}.arasi-title{font-weight:900}.arasi-close{border:0;background:transparent;color:var(--text);font-size:24px}
    .arasi-sub{padding:9px 14px;color:var(--muted);font-size:12px}.arasi-list{overflow:auto;padding:10px;display:flex;flex-direction:column;gap:8px}.arasi-row{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;padding:9px 10px;background:#172033;border:1px solid #263149;border-radius:11px}
    .arasi-bad,.arasi-abstain{height:32px;border-radius:8px;border:1px solid var(--border);background:#2b1f26;color:#ffd5df;font-weight:800}.arasi-foot{padding:10px 14px;border-top:1px solid var(--border);text-align:right}
    .chat-ban-note{padding:7px 10px;text-align:center;font-size:12px;color:#ffd6dd;background:#351c24;border-top:1px solid #5a2b3b}

/* kaminari */#kaminariLayer{position:fixed;inset:0;z-index:10950;pointer-events:none;overflow:hidden}.storm-cloud{position:absolute;left:50%;top:50%;width:min(58vw,520px);height:min(25vw,220px);transform:translate(-50%,-50%) scale(.86);opacity:0;filter:drop-shadow(0 24px 30px rgba(0,0,0,.52));animation:cloudEnter 1s cubic-bezier(.2,.8,.2,1) forwards}.storm-cloud.rise{animation:cloudRise .72s cubic-bezier(.2,.8,.2,1) forwards}.cloud-puff{position:absolute;border-radius:50%;background:radial-gradient(circle at 35% 28%,rgba(255,255,255,.92),rgba(205,214,226,.88) 35%,rgba(105,118,138,.95) 68%,rgba(44,54,70,.98) 100%);box-shadow:inset -18px -18px 30px rgba(20,28,42,.34),inset 10px 10px 24px rgba(255,255,255,.28),0 16px 28px rgba(0,0,0,.32)}.cloud-puff.p1{width:44%;height:74%;left:4%;top:22%}.cloud-puff.p2{width:48%;height:88%;left:27%;top:2%}.cloud-puff.p3{width:42%;height:70%;right:4%;top:26%}.cloud-puff.p4{width:34%;height:62%;left:18%;top:4%}.cloud-puff.p5{width:36%;height:64%;right:20%;top:10%}.cloud-base{position:absolute;left:10%;right:10%;bottom:5%;height:44%;border-radius:50%;background:linear-gradient(180deg,rgba(110,123,145,.96),rgba(36,44,58,.98));box-shadow:inset 0 12px 18px rgba(255,255,255,.08),0 18px 30px rgba(0,0,0,.34)}@keyframes cloudEnter{0%{opacity:0;transform:translate(-50%,-50%) scale(.45)}55%{opacity:1;transform:translate(-50%,-50%) scale(1.05)}100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes cloudRise{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:.96;transform:translate(-50%,-145%) scale(.9)}}.lightning-wrap{position:absolute;top:13%;left:50%;width:7px;height:74vh;transform-origin:top center;opacity:0}.lightning-wrap.show{opacity:1}.lightning-main,.lightning-branch{position:absolute;top:0;left:0;width:7px;height:100%;background:linear-gradient(180deg,#fff,#dff6ff 38%,#a7ddff 100%);box-shadow:0 0 8px #fff,0 0 18px #9fdcff,0 0 28px rgba(117,194,255,.9);clip-path:polygon(46% 0,66% 0,54% 10%,76% 10%,44% 22%,63% 22%,36% 36%,58% 36%,28% 52%,49% 52%,18% 69%,40% 69%,0 100%,22% 73%,8% 73%,33% 57%,17% 57%,45% 41%,28% 41%,55% 27%,38% 27%,64% 14%,48% 14%)}.lightning-branch{width:5px;height:48%;top:28%;left:3px;transform:rotate(var(--branch-rot)) scaleX(.8);transform-origin:top center;opacity:.78}.screen-flash{position:fixed;inset:0;background:#fff;z-index:10960;opacity:0;pointer-events:none}.screen-flash.go{animation:screenFlash .11s ease-out forwards}@keyframes screenFlash{0%{opacity:0}15%{opacity:.95}55%{opacity:.65}100%{opacity:0}}@media(max-width:300px){.storm-cloud{width:78vw;height:34vw}.lightning-wrap{height:68vh}}

    /* kaminari v2: denser rolling cloud + thicker lightning */
    .storm-cloud{
      width:min(68vw,620px);
      height:min(30vw,270px);
      filter:blur(.15px) drop-shadow(0 28px 36px rgba(0,0,0,.58));
    }
    .cloud-puff{
      background:
        radial-gradient(circle at 32% 26%,
          rgba(245,248,252,.95) 0%,
          rgba(190,200,214,.92) 30%,
          rgba(105,117,137,.96) 58%,
          rgba(48,57,73,.98) 78%,
          rgba(25,31,43,.98) 100%);
      box-shadow:
        inset -22px -22px 38px rgba(10,17,29,.42),
        inset 12px 10px 26px rgba(255,255,255,.24),
        0 10px 24px rgba(0,0,0,.28);
      animation:cloudMoku 1.15s ease-in-out infinite alternate;
    }
    .cloud-puff.p1{width:48%;height:76%;left:0%;top:24%;animation-delay:-.2s}
    .cloud-puff.p2{width:50%;height:92%;left:25%;top:0%;animation-delay:-.7s}
    .cloud-puff.p3{width:46%;height:74%;right:0%;top:27%;animation-delay:-.45s}
    .cloud-puff.p4{width:38%;height:68%;left:13%;top:2%;animation-delay:-.9s}
    .cloud-puff.p5{width:40%;height:70%;right:13%;top:7%;animation-delay:-.35s}
    .cloud-puff.p6{width:32%;height:58%;left:35%;top:-9%;animation-delay:-.6s}
    .cloud-puff.p7{width:34%;height:60%;left:5%;top:43%;animation-delay:-.1s}
    .cloud-puff.p8{width:34%;height:60%;right:5%;top:43%;animation-delay:-.8s}
    @keyframes cloudMoku{
      from{transform:translate3d(-2px,2px,0) scale(.98)}
      to{transform:translate3d(3px,-3px,0) scale(1.045)}
    }
    .cloud-base{
      left:5%;right:5%;bottom:0;height:48%;
      filter:blur(2px);
    }
    .lightning-wrap{width:16px}
    .lightning-main{
      width:16px;
      filter:drop-shadow(0 0 3px #fff) drop-shadow(0 0 9px #bdeaff);
      box-shadow:0 0 12px #fff,0 0 28px #9fdcff,0 0 48px rgba(117,194,255,.95);
    }
    .lightning-branch{
      width:10px;left:7px;
      box-shadow:0 0 10px #fff,0 0 22px #9fdcff;
    }
    @media(max-width:300px){
      .storm-cloud{width:88vw;height:40vw}
      .lightning-wrap,.lightning-main{width:11px}
      .lightning-branch{width:7px;left:5px}
    }


    /* /cloud — translucent cotton-like 3D cloud drifting for 60 seconds */
    #cloudEffectLayer{
      position:fixed;inset:0;z-index:10680;pointer-events:none;overflow:hidden;
      perspective:900px;
    }
    .dream-cloud{
      --cloudW:min(58vw,720px);
      position:absolute;
      left:0;top:var(--cloudTop,28%);
      width:var(--cloudW);
      height:calc(var(--cloudW) * .43);
      opacity:0;
      transform-style:preserve-3d;
      will-change:transform,opacity;
      filter:drop-shadow(0 26px 34px rgba(20,32,52,.16));
    }
    .dream-cloud.running{
      animation:cloudCrossScreen 60s linear forwards;
    }
    .dream-cloud-core{
      position:absolute;inset:7% 4% 5%;
      transform-style:preserve-3d;
      animation:cloudFloat3D 7s ease-in-out infinite alternate;
    }
    .dream-cloud .cotton{
      position:absolute;border-radius:50%;
      transform-style:preserve-3d;
      background:
        radial-gradient(circle at 30% 22%,
          rgba(255,255,255,.88) 0%,
          rgba(250,252,255,.72) 22%,
          rgba(220,231,243,.55) 48%,
          rgba(164,184,207,.34) 70%,
          rgba(103,126,154,.17) 86%,
          rgba(65,86,112,.05) 100%);
      box-shadow:
        inset -18px -22px 38px rgba(61,83,111,.12),
        inset 13px 10px 28px rgba(255,255,255,.55),
        0 12px 28px rgba(76,103,137,.10);
      backdrop-filter:blur(.5px);
      animation:cottonBreathe var(--breathe,6s) ease-in-out infinite alternate;
    }
    .dream-cloud .c1{width:35%;height:70%;left:0;top:28%;--z:10px;--breathe:6.4s}
    .dream-cloud .c2{width:38%;height:82%;left:17%;top:8%;--z:34px;--breathe:7.2s}
    .dream-cloud .c3{width:34%;height:88%;left:36%;top:0;--z:52px;--breathe:5.8s}
    .dream-cloud .c4{width:39%;height:78%;left:55%;top:14%;--z:26px;--breathe:6.8s}
    .dream-cloud .c5{width:31%;height:65%;right:0;top:31%;--z:8px;--breathe:5.5s}
    .dream-cloud .c6{width:30%;height:62%;left:9%;top:4%;--z:-12px;--breathe:7.7s}
    .dream-cloud .c7{width:31%;height:64%;left:30%;top:25%;--z:70px;--breathe:6.1s}
    .dream-cloud .c8{width:29%;height:60%;right:14%;top:2%;--z:-18px;--breathe:7.4s}
    .dream-cloud .c9{width:27%;height:56%;left:48%;top:40%;--z:86px;--breathe:5.9s}
    .dream-cloud .c10{width:25%;height:53%;left:2%;top:48%;--z:42px;--breathe:6.9s}
    .dream-cloud .c11{width:25%;height:52%;right:2%;top:49%;--z:48px;--breathe:6.3s}
    .dream-cloud .c12{width:24%;height:50%;left:26%;top:-5%;--z:22px;--breathe:8s}
    .dream-cloud-haze{
      position:absolute;left:4%;right:4%;bottom:5%;height:43%;
      border-radius:50%;
      background:radial-gradient(ellipse at center,
        rgba(245,250,255,.42),rgba(202,218,236,.25) 48%,rgba(143,166,192,.08) 76%,transparent);
      filter:blur(8px);
      transform:translateZ(-25px);
    }
    @keyframes cottonBreathe{
      0%{transform:translate3d(-3px,2px,var(--z)) scale(.97)}
      100%{transform:translate3d(5px,-5px,var(--z)) scale(1.055)}
    }
    @keyframes cloudFloat3D{
      0%{transform:rotateX(1deg) rotateY(-3deg) translateY(3px)}
      100%{transform:rotateX(-2deg) rotateY(4deg) translateY(-5px)}
    }
    @keyframes cloudCrossScreen{
      0%{transform:translate3d(var(--cloudStart),0,0) scale(.92);opacity:0}
      4%{opacity:.72}
      50%{transform:translate3d(var(--cloudMid),-10px,35px) scale(1.04);opacity:.78}
      94%{opacity:.70}
      100%{transform:translate3d(var(--cloudEnd),4px,0) scale(.94);opacity:0}
    }
    @media(max-width:300px){
      .dream-cloud{--cloudW:min(82vw,300px)}
    }


    /* /rainbow — shared 60 second rainbow background */
    body.rainbow-mode{
      animation:rainbowBackground 7s linear infinite !important;
    }
    body.rainbow-mode main,
    body.rainbow-mode .wrap,
    body.rainbow-mode .chat,
    body.rainbow-mode #log{
      background-color:transparent !important;
    }
    @keyframes rainbowBackground{
      0%{background-color:hsl(0 78% 55%)}
      14%{background-color:hsl(45 88% 56%)}
      28%{background-color:hsl(100 70% 48%)}
      42%{background-color:hsl(170 72% 45%)}
      57%{background-color:hsl(210 80% 54%)}
      71%{background-color:hsl(260 75% 58%)}
      85%{background-color:hsl(315 76% 56%)}
      100%{background-color:hsl(360 78% 55%)}
    }

    /* local /dark and /light */
    body.local-dark{
      --bg:#0b0f14;--panel:#111827;--panel2:#151b28;--text:#eef2f7;
      --muted:#9aa4b2;--border:#263043;--accent:#4f7ddf;
      background:#0b0f14 !important;color:#eef2f7 !important;
    }
    body.local-light{
      --bg:#f4f6fa;--panel:#ffffff;--panel2:#eef2f7;--text:#18202b;
      --muted:#667085;--border:#d8dee9;--accent:#3b6fd8;
      background:#f4f6fa !important;color:#18202b !important;
    }



    /* local theme v2: do NOT change chat/log background */
    body.local-dark{
      background:#0b0f14 !important;
      color:#eef2f7 !important;
    }
    body.local-dark main,
    body.local-dark .wrap{
      background:#0b0f14 !important;
    }

    body.local-light{
      background:#f4f6fa !important;
      color:#18202b !important;
    }
    body.local-light main,
    body.local-light .wrap{
      background:#f4f6fa !important;
    }

    /* keep chat/log background under bgc control */
    body.local-dark .chat,
    body.local-dark #chatlog,
    body.local-light .chat,
    body.local-light #chatlog{
      background-color:var(--wid-chat-bgc,var(--chatbg)) !important;
    }

    /* light mode controls: white surface, black border/text */
    body.local-light button,
    body.local-light input,
    body.local-light select,
    body.local-light .inputrow button,
    body.local-light .command-btn{
      background:#fff !important;
      color:#111 !important;
      border-color:#111 !important;
    }
    body.local-light input::placeholder{color:#555 !important}
    body.local-light .inputrow{
      background:#fff !important;
      border-color:#111 !important;
    }

    /* retain readable chrome in dark mode */
    body.local-dark button,
    body.local-dark input,
    body.local-dark select{
      color:#eef2f7;
    }


/* light theme v3: modal/toast/user-list/vote surfaces */
body.local-light .modal,
body.local-light .modal-content,
body.local-light .command-modal,
body.local-light .command-panel,
body.local-light .arasi-modal,
body.local-light [role="dialog"]{
  background:#fff !important;color:#111 !important;border-color:#111 !important;
}

/* /usdjpy /yenyasu — responsive TradingView mini chart card */
.message.tradingview-message{
  width:min(430px,94%);
  max-width:94%;
}
.message.tradingview-message .tradingview-bubble{
  box-sizing:border-box;
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  padding:4px!important;
  overflow:hidden!important;
  white-space:normal!important;
  -webkit-line-clamp:unset!important;
}
.tradingview-mini-wrap{
  display:block;
  width:100%;
  height:220px;
  min-width:0;
  overflow:hidden;
  border-radius:12px;
  background:#131722;
  color-scheme:dark;
}
.tradingview-mini-wrap tv-mini-chart{
  display:block;
  width:100%;
  height:100%;
}
.message.tradingview-message .tradingview-mini-placeholder{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
  color:#cbd5e1!important;
  font-size:12px;
  text-align:center;
}
body.local-light .tradingview-mini-wrap{
  background:#fff;
  color-scheme:light;
}
body.local-light .message.tradingview-message .tradingview-mini-placeholder{
  color:#475569!important;
}
@media(max-width:300px){
  .message.tradingview-message{width:98%!important;max-width:98%!important}
  .tradingview-mini-wrap{height:170px;border-radius:8px}
}
@media(max-width:210px){
  .tradingview-mini-wrap{height:145px}
}
/* map:場所 — APIキー不要のGoogleマップカード */
.message.map-message{width:min(430px,94%);max-width:94%}
.message.map-message .map-bubble{
  box-sizing:border-box;display:block!important;width:100%!important;max-width:100%!important;
  min-width:0!important;padding:5px!important;overflow:hidden!important;
  white-space:normal!important;-webkit-line-clamp:unset!important
}
.map-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;padding:7px 8px 9px}
.map-place-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:850;font-size:13px}
.map-open-link{
  flex:0 0 auto;border-radius:9px;padding:6px 8px;background:#2563eb;color:#fff;
  font-size:11px;font-weight:800;text-decoration:none
}
.google-map-frame-wrap{position:relative;width:100%;height:220px;overflow:hidden;border-radius:12px;background:#dbe2ea}
.google-map-frame-wrap iframe{position:absolute;inset:0;display:block;width:100%;height:100%;border:0}
@media(max-width:300px){
  .message.map-message{width:98%!important;max-width:98%!important}
  .map-card-head{align-items:stretch;flex-direction:column;padding:5px 5px 7px}
  .map-place-label{font-size:11px}
  .map-open-link{text-align:center;font-size:10px;padding:5px 6px}
  .google-map-frame-wrap{height:180px;border-radius:8px}
}
@media(max-width:210px){.google-map-frame-wrap{height:150px}}
body.local-light .modal-header,
body.local-light .modal-body,
body.local-light .modal-footer,
body.local-light .command-head,
body.local-light .command-list,
body.local-light .arasi-head,
body.local-light .arasi-sub,
body.local-light .arasi-list,
body.local-light .arasi-foot{
  background:#fff !important;color:#111 !important;border-color:#111 !important;
}
body.local-light .command-item,
body.local-light .cmd-row,
body.local-light .arasi-row{
  background:#fff !important;color:#111 !important;border-color:#111 !important;
}
body.local-light .command-item *,
body.local-light .cmd-row *,
body.local-light .arasi-row *,
body.local-light .arasi-title,
body.local-light .arasi-sub{
  color:#111 !important;
}
body.local-light .toast,
body.local-light .toast-item,
body.local-light #toast,
body.local-light #toastContainer > *,
body.local-light .user-list-toast,
body.local-light .online-toast{
  background:#fff !important;color:#111 !important;border:1px solid #111 !important;
  box-shadow:0 10px 28px rgba(0,0,0,.18) !important;
}
body.local-light .arasi-bad,
body.local-light .arasi-abstain,
body.local-light .arasi-close,
body.local-light .copy-btn,
body.local-light .modal button,
body.local-light .command-modal button{
  background:#fff !important;color:#111 !important;border:1px solid #111 !important;
}


/* LIGHT v4 — actual help/list selectors + generated overlays */
body.local-light #commandModalBackdrop .command-modal,
body.local-light #commandModalBackdrop .command-head,
body.local-light #commandModalBackdrop .command-list,
body.local-light #commandModalBackdrop .command-row,
body.local-light #commandModalBackdrop .cmd-row,
body.local-light #commandModalBackdrop .command-item,
body.local-light #commandModalBackdrop [class*="command"]{
  background:#fff !important;color:#111 !important;border-color:#111 !important;
}
body.local-light #commandModalBackdrop .command-row *,
body.local-light #commandModalBackdrop .cmd-row *,
body.local-light #commandModalBackdrop .command-item *,
body.local-light #commandModalBackdrop [class*="command"] *{
  color:#111 !important;
}
body.local-light #commandModalBackdrop button{
  background:#fff !important;color:#111 !important;border:1px solid #111 !important;
}

/* /ls is generated as a toast; cover all toast containers and descendants */
body.local-light #toastContainer,
body.local-light #toastContainer > div,
body.local-light #toastHost,
body.local-light #toastHost > div,
body.local-light .toast-container > div,
body.local-light .toastHost > div,
body.local-light .toast,
body.local-light [class*="toast"]{
  color:#111 !important;
}
body.local-light #toastContainer > div,
body.local-light #toastHost > div,
body.local-light .toast-container > div,
body.local-light .toastHost > div,
body.local-light .toast{
  background:#fff !important;border:1px solid #111 !important;
}
body.local-light #toastContainer *,
body.local-light #toastHost *,
body.local-light .toast-container *,
body.local-light .toastHost *,
body.local-light .toast *{
  color:#111 !important;
}

/* generated local-only overlays: class is added by JS below */
body.local-light .light-theme-popup{
  background:#fff !important;color:#111 !important;border:1px solid #111 !important;
  box-shadow:0 10px 28px rgba(0,0,0,.18) !important;
}
body.local-light .light-theme-popup *{color:#111 !important}


/* LIGHT v5 — /ls /dir uses .help-panel inside the chat log */
body.local-light .help-panel{
  background:#fff !important;
  color:#111 !important;
  border:1px solid #111 !important;
  box-shadow:0 10px 28px rgba(0,0,0,.18) !important;
}
body.local-light .help-panel *{
  color:#111 !important;
}


/* LIGHT v6 — message bubbles/toasts need light text on their dark surfaces.
   Do not touch the chat background (bgc remains independent). */
body.local-light .bubble,
body.local-light .msg-bubble,
body.local-light .message-bubble,
body.local-light .message .bubble,
body.local-light .msg .bubble{
  color:#fff !important;
}
body.local-light .bubble *,
body.local-light .msg-bubble *,
body.local-light .message-bubble *,
body.local-light .message .bubble *,
body.local-light .msg .bubble *{
  color:#fff !important;
}

/* toast uses a dark/navy surface in the existing UI, so keep its text white */
body.local-light .toast,
body.local-light #toastContainer > *,
body.local-light #toastHost > *,
body.local-light .toast-container > *,
body.local-light .toastHost > *,
body.local-light [class*="toast"]{
  color:#fff !important;
}
body.local-light .toast *,
body.local-light #toastContainer > * *,
body.local-light #toastHost > * *,
body.local-light .toast-container > * *,
body.local-light .toastHost > * *,
body.local-light [class*="toast"] *{
  color:#fff !important;
}

/* Dynamic-theme helper added earlier must not force toast descendants black. */
body.local-light .light-theme-popup.toast,
body.local-light .toast.light-theme-popup,
body.local-light [class*="toast"].light-theme-popup{
  color:#fff !important;
}
body.local-light .light-theme-popup.toast *,
body.local-light .toast.light-theme-popup *,
body.local-light [class*="toast"].light-theme-popup *{
  color:#fff !important;
}


/* /rainbow FIX v7 — animate the actual chat background for 60 sec */
body.rainbow-mode .chat,
body.rainbow-mode #log{
  animation:rainbowChatBackground 7s linear infinite;
}
@keyframes rainbowChatBackground{
  0%{background-color:#ff4d4d}
  14%{background-color:#ffca3a}
  28%{background-color:#7bdc48}
  42%{background-color:#35d0ba}
  57%{background-color:#4d8dff}
  71%{background-color:#8b5cf6}
  85%{background-color:#f052b5}
  100%{background-color:#ff4d4d}
}

body.rainbow-mode .chat,
body.rainbow-mode #log{
  animation:rainbowChatBackground 7s linear infinite !important;
}


/* /rainbow v8 — 60 sec readable rainbow TEXT, background untouched */
body.rainbow-mode .bubble,
body.rainbow-mode .msg-bubble,
body.rainbow-mode .message-bubble,
body.rainbow-mode .message .bubble,
body.rainbow-mode .msg .bubble,
body.rainbow-mode #log .bubble,
body.rainbow-mode #log .msg-bubble,
body.rainbow-mode #log .message-bubble{
  animation:rainbowReadableText 5.6s linear infinite !important;
  -webkit-text-fill-color:currentColor;
}
body.rainbow-mode .bubble *,
body.rainbow-mode .msg-bubble *,
body.rainbow-mode .message-bubble *,
body.rainbow-mode .message .bubble *,
body.rainbow-mode .msg .bubble *{
  animation:rainbowReadableText 5.6s linear infinite !important;
  -webkit-text-fill-color:currentColor;
}
@keyframes rainbowReadableText{
  0%{color:#2878d8}
  14%{color:#e33b3b}
  28%{color:#b58a00}
  42%{color:#238a4b}
  56%{color:#d83b8d}
  70%{color:#8052c7}
  84%{color:#d96b18}
  100%{color:#2878d8}
}

/* cancel the older rainbow background animation */
body.rainbow-mode,
body.rainbow-mode .chat,
body.rainbow-mode #log{
  animation:none !important;
}


/* /rainbow v9 — explicit light + dark support */
body.rainbow-mode .message-bubble,
body.local-light.rainbow-mode .message-bubble,
body.local-dark.rainbow-mode .message-bubble,
body.rainbow-mode .message.mine .message-bubble,
body.local-light.rainbow-mode .message.mine .message-bubble,
body.local-dark.rainbow-mode .message.mine .message-bubble{
  animation:rainbowReadableTextV9 5.6s linear infinite !important;
  -webkit-text-fill-color:currentColor !important;
}
body.rainbow-mode .message-bubble *,
body.local-light.rainbow-mode .message-bubble *,
body.local-dark.rainbow-mode .message-bubble *{
  animation:rainbowReadableTextV9 5.6s linear infinite !important;
  -webkit-text-fill-color:currentColor !important;
}
@keyframes rainbowReadableTextV9{
  0%{color:#2474d2}
  14%{color:#d93636}
  28%{color:#a77b00}
  42%{color:#168447}
  56%{color:#cf3181}
  70%{color:#7548bd}
  84%{color:#cf6114}
  100%{color:#2474d2}
}


/* wid LIGHT v14 — keep the Send button identical to dark mode */
body.local-light #send,
body.local-light #sendBtn,
body.local-light .send-btn,
body.local-light button[type="submit"]{
  background:#1f3155 !important;
  color:#fff !important;
  border-color:#263b66 !important;
  -webkit-text-fill-color:#fff !important;
  opacity:1 !important;
  visibility:visible !important;
}
body.local-light #send:hover,
body.local-light #sendBtn:hover,
body.local-light .send-btn:hover,
body.local-light button[type="submit"]:hover{
  background:#29406d !important;
  color:#fff !important;
}


#antLayer{position:fixed;inset:0;z-index:10880;pointer-events:none;overflow:hidden}
.ant{position:absolute;width:22px;height:12px;transform-origin:center;will-change:transform,opacity;animation:antTravel 10s linear forwards}
.ant-body{position:absolute;left:7px;top:4px;width:8px;height:5px;background:#16120f;border-radius:50%;box-shadow:-5px 0 0 -1px #16120f,6px 0 0 -1px #16120f}
.ant-body:before,.ant-body:after{content:"";position:absolute;left:2px;top:2px;width:11px;height:1px;background:#16120f;transform-origin:2px center}
.ant-body:before{transform:rotate(28deg);box-shadow:0 4px 0 #16120f,0 -4px 0 #16120f}
.ant-body:after{transform:rotate(-28deg);box-shadow:0 4px 0 #16120f,0 -4px 0 #16120f}
.ant-antenna{position:absolute;left:14px;top:2px;width:7px;height:1px;background:#16120f;transform-origin:left center;transform:rotate(-28deg)}
.ant-antenna:after{content:"";position:absolute;left:0;top:0;width:7px;height:1px;background:#16120f;transform-origin:left center;transform:rotate(56deg)}
@keyframes antTravel{
0%{opacity:0;transform:translate(var(--sx),var(--sy)) rotate(var(--r0)) scale(var(--scale))}
5%{opacity:1}
25%{transform:translate(var(--x1),var(--y1)) rotate(var(--r1)) scale(var(--scale))}
50%{transform:translate(var(--x2),var(--y2)) rotate(var(--r2)) scale(var(--scale))}
75%{transform:translate(var(--x3),var(--y3)) rotate(var(--r3)) scale(var(--scale))}
95%{opacity:1}
100%{opacity:0;transform:translate(var(--ex),var(--ey)) rotate(var(--r4)) scale(var(--scale))}
}


/* /ari v16 — animated legs + antennae */
.ant-body::before,.ant-body::after{display:none!important}
.ant-leg{
  position:absolute;left:9px;top:5px;width:10px;height:1.5px;
  background:#16120f;border-radius:2px;transform-origin:1px 50%;
}
.ant-leg.l1{transform:rotate(-42deg);animation:antLeg1 .18s ease-in-out infinite alternate}
.ant-leg.l2{top:7px;transform:rotate(0deg);animation:antLeg2 .18s ease-in-out infinite alternate}
.ant-leg.l3{top:9px;transform:rotate(42deg);animation:antLeg3 .18s ease-in-out infinite alternate}
.ant-leg.r1{left:4px;transform-origin:9px 50%;transform:rotate(42deg);animation:antLeg3 .18s ease-in-out infinite alternate}
.ant-leg.r2{left:4px;top:7px;transform-origin:9px 50%;transform:rotate(0deg);animation:antLeg2 .18s ease-in-out infinite alternate-reverse}
.ant-leg.r3{left:4px;top:9px;transform-origin:9px 50%;transform:rotate(-42deg);animation:antLeg1 .18s ease-in-out infinite alternate-reverse}
@keyframes antLeg1{from{transform:rotate(-58deg)}to{transform:rotate(-20deg)}}
@keyframes antLeg2{from{transform:rotate(-18deg)}to{transform:rotate(18deg)}}
@keyframes antLeg3{from{transform:rotate(20deg)}to{transform:rotate(58deg)}}
.ant-antenna{animation:antFeel1 .32s ease-in-out infinite alternate}
.ant-antenna::after{animation:antFeel2 .28s ease-in-out infinite alternate}
@keyframes antFeel1{from{transform:rotate(-38deg)}to{transform:rotate(-17deg)}}
@keyframes antFeel2{from{transform:rotate(42deg)}to{transform:rotate(70deg)}}
.ant-body{animation:antBodyBob .16s ease-in-out infinite alternate}
@keyframes antBodyBob{from{transform:translateY(-.5px)}to{transform:translateY(.8px)}}


/* /ari v17 — canvas ants based on the uploaded "ありさん" movement */
#antLayer{
  position:fixed;inset:0;z-index:10880;pointer-events:none;overflow:hidden;
}
#antCanvas{
  position:absolute;inset:0;width:100%;height:100%;display:block;
  pointer-events:none;
}


#sharedPopupLayer{position:fixed;inset:0;z-index:11900;pointer-events:none;overflow:hidden}
.shared-popup{position:absolute;width:min(200px,calc(100vw - 12px));height:min(200px,calc(100vh - 12px));min-width:120px;min-height:110px;border-radius:10px;overflow:hidden;pointer-events:auto;background:rgba(255,255,255,.82);border:1px solid rgba(255,255,255,.55);box-shadow:2px 2px 12px rgba(0,0,0,.48);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);color:#151515}
.shared-popup-head{position:absolute;left:0;right:0;top:0;height:40px;display:flex;align-items:center;padding:0 43px 0 10px;background:#7d7d7d;color:#fff;font-size:12px;font-weight:800;cursor:move;user-select:none;touch-action:none}
.shared-popup-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.shared-popup-close{position:absolute;right:4px;top:3px;width:34px;height:34px;padding:0;border-radius:5px;border:1px solid #900;background:#f01818!important;color:#fff!important;font-size:17px;font-weight:900;cursor:pointer}
.shared-popup-body{position:absolute;left:0;right:0;top:40px;bottom:0;padding:11px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.5;color:#181818;background:rgba(255,255,255,.22)}
@media(max-width:230px),(max-height:230px){.shared-popup{width:calc(100vw - 8px);height:calc(100vh - 8px);min-width:0;min-height:0;border-radius:7px}.shared-popup-head{height:31px;padding:0 34px 0 7px;font-size:10px}.shared-popup-close{width:27px;height:27px;right:2px;top:2px;font-size:14px}.shared-popup-body{top:31px;padding:7px;font-size:10px;line-height:1.35}}

  

    /* Wid ultra-narrow fix v1 — keep input + command + send visible down to ~190px */
    @media (max-width:210px){
      .inputrow{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        display:grid !important;
        grid-template-columns:minmax(0,1fr) 26px 26px !important;
        align-items:center !important;
        gap:3px !important;
        padding:5px !important;
        overflow:hidden !important;
      }
      .inputrow input#msgInput{
        width:100% !important;
        min-width:0 !important;
        max-width:100% !important;
        height:34px !important;
        padding:0 6px !important;
        font-size:11px !important;
      }
      .inputrow #commandBtn.command-btn,
      .inputrow #sendBtn{
        box-sizing:border-box !important;
        width:26px !important;
        min-width:26px !important;
        max-width:26px !important;
        height:34px !important;
        min-height:34px !important;
        padding:0 !important;
        margin:0 !important;
        overflow:hidden !important;
      }
      .inputrow #commandBtn.command-btn{
        font-size:0 !important;
      }
      .inputrow #commandBtn.command-btn::before{
        content:'⌃';
        display:block;
        font-size:15px;
        line-height:32px;
        color:var(--text);
        text-align:center;
      }
      .inputrow #commandBtn.command-btn::after{content:none !important}
      .inputrow #sendBtn{font-size:0 !important}
      .inputrow #sendBtn::after{
        content:'➤' !important;
        display:block !important;
        font-size:13px !important;
        line-height:34px !important;
        color:#fff !important;
        text-align:center !important;
      }

      .chatlog{
        width:100% !important;
        max-width:100% !important;
        min-width:0 !important;
        overflow:hidden !important;
        padding:5px !important;
      }
      .message{
        width:auto !important;
        min-width:0 !important;
        max-width:96% !important;
      }
      .message-meta{
        max-width:100% !important;
        overflow:hidden !important;
        text-overflow:ellipsis !important;
        white-space:nowrap !important;
      }
      .message-bubble{
        box-sizing:border-box !important;
        width:fit-content !important;
        max-width:100% !important;
        min-width:0 !important;
        padding:5px 6px !important;
        font-size:10.5px !important;
        line-height:1.3 !important;
        overflow:hidden !important;
        overflow-wrap:anywhere !important;
        word-break:break-word !important;
        white-space:pre-wrap !important;
        display:-webkit-box !important;
        -webkit-box-orient:vertical !important;
        -webkit-line-clamp:3 !important;
      }
    }

    @media (max-width:195px){
      .inputrow{
        grid-template-columns:minmax(0,1fr) 24px 24px !important;
        gap:2px !important;
        padding:4px !important;
      }
      .inputrow #commandBtn.command-btn,
      .inputrow #sendBtn{
        width:24px !important;
        min-width:24px !important;
        max-width:24px !important;
      }
      .inputrow input#msgInput{padding:0 5px !important;font-size:10.5px !important}
      .inputrow #commandBtn.command-btn::before{font-size:14px !important}
      .inputrow #sendBtn::after{font-size:12px !important}
      .message{max-width:98% !important}
    }

    /* ---------- image receive for WID（受信専用） ---------- */
    .wid-image-bubble{
      box-sizing:border-box;
      width:min(100%,360px);
      max-width:100%;
      padding:4px;
      border-radius:10px 10px 10px 3px;
      background:#232b3d;
      overflow:hidden;
    }
    .message.mine .wid-image-bubble{
      border-radius:10px 10px 3px 10px;
      background:var(--mine);
    }
    .wid-chat-image{
      display:block;
      width:100%;
      max-width:100%;
      height:auto;
      max-height:260px;
      border-radius:7px;
      object-fit:contain;
      background:#0b0d12;
      cursor:zoom-in;
    }
    .wid-image-info{
      padding:3px 3px 0;
      color:var(--muted);
      font-size:8px;
      line-height:1.2;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .message.mine .wid-image-info{color:rgba(255,255,255,.78)}
    .ai-image-check-badge{
      margin-top:3px;
      font-size:7px;
      line-height:1.2;
      opacity:.68;
      text-align:right;
      user-select:none;
    }
    #widImageLightbox{
      position:fixed;
      inset:0;
      z-index:13000;
      display:none;
      align-items:center;
      justify-content:center;
      padding:7px;
      background:rgba(0,0,0,.90);
      cursor:zoom-out;
    }
    #widImageLightbox.open{display:flex}
    #widImageLightbox img{
      display:block;
      max-width:98vw;
      max-height:96vh;
      object-fit:contain;
      border-radius:7px;
    }
    @media(max-width:300px){
      .wid-image-bubble{width:100%;max-width:100%;padding:3px}
      .wid-chat-image{max-height:210px;border-radius:6px}
      .wid-image-info{font-size:7px;padding-top:2px}
    }
    @media(max-width:210px){
      .wid-chat-image{max-height:170px}
    }


    /* =========================================================
       WID FINAL OVERRIDE
       190px前後で後続CSSに上書きされないため、必ず最後に置く
       ========================================================= */
    @media (max-width:300px){
      .chat{
        min-height:0 !important;
        overflow:hidden !important;
        background:var(--wid-chat-bgc,var(--bg)) !important;
        background-color:var(--wid-chat-bgc,var(--bg)) !important;
      }

      #chatlog.chatlog{
        min-height:0 !important;
        height:auto !important;
        overflow-y:scroll !important;
        overflow-x:hidden !important;
        justify-content:flex-start !important;
        -webkit-overflow-scrolling:touch !important;
        overscroll-behavior-y:contain !important;
        touch-action:pan-y !important;
        background:var(--wid-chat-bgc,var(--bg)) !important;
        background-color:var(--wid-chat-bgc,var(--bg)) !important;
      }

      #chatlog.chatlog .message{
        flex:0 0 auto !important;
      }

      #chatlog.chatlog img{
        -webkit-user-drag:none;
        user-select:none;
        touch-action:pan-y !important;
      }
    }

    @media (max-width:210px){
      #chatlog.chatlog{
        overflow-y:scroll !important;
        overflow-x:hidden !important;
        touch-action:pan-y !important;
        background:var(--wid-chat-bgc,var(--bg)) !important;
        background-color:var(--wid-chat-bgc,var(--bg)) !important;
      }

      .chat{
        background:var(--wid-chat-bgc,var(--bg)) !important;
        background-color:var(--wid-chat-bgc,var(--bg)) !important;
      }
    }


    /* ---------- /moe / /pyoko ---------- */
    .pyoko-peek-character{
      position:fixed;
      left:50%;
      bottom:-14px;
      z-index:12000;
      width:min(320px,56vw);
      pointer-events:none;
      transform:translate(-50%,108%);
      transform-origin:50% 100%;
      will-change:transform;
    }
    .pyoko-peek-character img{
      display:block;
      width:100%;
      height:auto;
      user-select:none;
      -webkit-user-drag:none;
      pointer-events:none;
    }
    .pyoko-peek-speech{
      position:absolute;
      top:-10%;
      right:-24%;
      padding:10px 15px;
      border:2px solid #66537f;
      border-radius:18px 18px 18px 5px;
      background:#fff;
      box-shadow:0 5px 0 rgba(102,83,127,.12);
      color:#66537f;
      font-size:clamp(.72rem,2.3vw,.9rem);
      font-weight:900;
      line-height:1.2;
      white-space:nowrap;
      opacity:0;
      transform:scale(.6) rotate(5deg);
    }
    .pyoko-peek-character.is-peeking{animation:pyokoPeekIn 420ms cubic-bezier(.22,1.35,.5,1) forwards;}
    .pyoko-peek-character.is-leaving{animation:pyokoPeekOut 440ms cubic-bezier(.55,0,.85,.5) forwards;}
    .pyoko-peek-character.is-peeking .pyoko-peek-speech{animation:pyokoBubbleIn 260ms 390ms cubic-bezier(.22,1.5,.5,1) forwards;}

    @keyframes pyokoPeekIn{
      0%{transform:translate(-50%,108%) scale(.96)}
      72%{transform:translate(-50%,-3%) scale(1.02)}
      100%{transform:translate(-50%,0) scale(1)}
    }
    @keyframes pyokoPeekOut{
      0%{transform:translate(-50%,0)}
      18%{transform:translate(-50%,-3%) rotate(-2deg)}
      100%{transform:translate(-50%,108%) rotate(2deg)}
    }
    @keyframes pyokoBubbleIn{to{opacity:1;transform:scale(1) rotate(5deg)}}

    @media (max-width:640px){
      .pyoko-peek-character{width:min(270px,70vw)}
      .pyoko-peek-speech{top:-5%;right:-18%;padding:8px 12px}
    }
    @media (max-width:300px){
      .pyoko-peek-character{width:min(160px,82vw);bottom:-8px}
      .pyoko-peek-speech{top:-2%;right:-8%;padding:6px 9px;border-width:1.5px;border-radius:14px 14px 14px 4px;font-size:11px}
    }
    @media (max-width:210px){
      .pyoko-peek-character{width:min(144px,84vw)}
      .pyoko-peek-speech{right:-2%;font-size:10px;padding:5px 8px}
    }


    /* ---------- /virus : 赤い×マークが画面を埋め尽くす ---------- */
    #virusEffectLayer{
      position:fixed;
      inset:0;
      z-index:12500;
      pointer-events:none;
      overflow:hidden;
      contain:layout paint style;
    }
    .virus-mark{
      position:absolute;
      width:20px;
      height:20px;
      border-radius:50%;
      background:
        radial-gradient(circle at 35% 30%,
          #ff6666 0 17%,
          #ef3737 36%,
          #c90808 72%,
          #870000 100%);
      border:2px solid rgba(255,255,255,.96);
      box-shadow:
        0 0 0 1px rgba(85,0,0,.75),
        0 1px 2px rgba(0,0,0,.34);
      opacity:0;
      transform:scale(.12) rotate(var(--vr,0deg));
      animation:virusAppear 240ms cubic-bezier(.15,.9,.25,1.25) var(--vd,0ms) forwards;
      will-change:transform,opacity;
    }
    .virus-mark::before,
    .virus-mark::after{
      content:"";
      position:absolute;
      left:50%;
      top:50%;
      width:13px;
      height:4px;
      border-radius:3px;
      background:#fff;
      box-shadow:0 1px 1px rgba(0,0,0,.14);
      transform-origin:center;
    }
    .virus-mark::before{transform:translate(-50%,-50%) rotate(45deg)}
    .virus-mark::after{transform:translate(-50%,-50%) rotate(-45deg)}
    #virusEffectLayer.is-clearing{
      animation:virusLayerOut .5s ease forwards;
    }
    @keyframes virusAppear{
      0%{opacity:0;transform:scale(.12) rotate(var(--vr,0deg))}
      72%{opacity:1;transform:scale(1.12) rotate(var(--vr,0deg))}
      100%{opacity:1;transform:scale(1) rotate(var(--vr,0deg))}
    }
    @keyframes virusLayerOut{
      to{opacity:0;filter:blur(2px)}
    }


    /* ---------- /piano : 60秒みんなでピアノ ---------- */
    .piano-session-card{
      width:min(420px,92%);
      margin:8px auto;
      padding:10px 12px;
      border:1px solid rgba(125,140,175,.42);
      border-radius:14px;
      background:rgba(255,255,255,.95);
      box-shadow:0 8px 22px rgba(15,23,42,.12);
      color:#263044;
      font-size:13px;
    }
    .piano-session-card.is-ended{opacity:.66}
    .piano-card-head,.piano-card-meta{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
    }
    .piano-card-head{font-weight:900;margin-bottom:6px}
    .piano-card-meta{color:#697386;font-size:11px;margin-bottom:8px}
    .piano-join-btn{
      width:100%;min-height:34px;border:0;border-radius:9px;
      background:#315da8;color:#fff;font-weight:900;cursor:pointer;
    }
    .piano-join-btn:disabled{opacity:.5;cursor:default}

    .piano-panel{
      position:fixed;
      left:50%;
      bottom:10px;
      z-index:13000;
      width:min(520px,calc(100vw - 20px));
      padding:8px;
      border:1px solid rgba(255,255,255,.28);
      border-radius:14px;
      background:rgba(20,26,38,.97);
      box-shadow:0 14px 40px rgba(0,0,0,.38);
      color:#fff;
      transform:translateX(-50%);
      user-select:none;
      -webkit-user-select:none;
      touch-action:none;
    }
    .piano-topbar{
      display:flex;align-items:center;justify-content:space-between;
      gap:8px;height:28px;margin-bottom:6px;
    }
    .piano-title{
      display:flex;align-items:center;gap:6px;min-width:0;
      font-size:12px;font-weight:900;white-space:nowrap;
      overflow:hidden;text-overflow:ellipsis;
    }
    .piano-time{opacity:.72;font-size:10px;font-weight:800}
    .piano-close{
      flex:0 0 26px;width:26px;height:26px;padding:0;border:0;
      border-radius:7px;background:rgba(255,255,255,.13);
      color:#fff;font-size:18px;line-height:1;cursor:pointer;
    }
    .piano-keyboard{
      position:relative;height:104px;overflow:hidden;border-radius:9px;
      background:#10141d;touch-action:none;
    }
    .piano-white-keys{
      display:grid;grid-template-columns:repeat(7,1fr);height:100%;
    }
    .piano-key{
      -webkit-tap-highlight-color:transparent;
      touch-action:none;cursor:pointer;
    }
    .piano-key.white{
      position:relative;min-width:0;border:1px solid #a9afb9;border-top:0;
      border-radius:0 0 5px 5px;background:linear-gradient(#fff,#f3f4f6);
      box-shadow:inset 0 -7px 9px rgba(0,0,0,.06);color:#6a7281;
    }
    .piano-key.white .piano-note-label{
      position:absolute;left:50%;bottom:7px;transform:translateX(-50%);
      font-size:10px;font-weight:900;pointer-events:none;
    }
    .piano-key.black{
      position:absolute;top:0;z-index:4;width:8.4%;height:62%;
      border:1px solid #050608;border-radius:0 0 4px 4px;
      background:linear-gradient(90deg,#101217,#2b2f38 48%,#090a0d);
      box-shadow:0 4px 5px rgba(0,0,0,.42);
    }
    .piano-key.white.is-down{
      background:linear-gradient(#dce8ff,#c8dcff);
      transform:translateY(2px);
    }
    .piano-key.black.is-down{
      background:linear-gradient(90deg,#243a63,#4267a6 48%,#17243d);
      transform:translateY(2px);
    }

    @media(max-width:300px){
      .piano-session-card{
        width:calc(100% - 10px);margin:5px auto;padding:7px;
        border-radius:9px;font-size:11px;
      }
      .piano-card-meta{font-size:9px;margin-bottom:6px}
      .piano-join-btn{min-height:30px;font-size:11px}
      .piano-panel{
        width:calc(100vw - 8px);bottom:4px;padding:5px;border-radius:9px;
      }
      .piano-topbar{height:24px;margin-bottom:4px}
      .piano-title{font-size:10px}
      .piano-time{font-size:9px}
      .piano-close{
        flex-basis:22px;width:22px;height:22px;border-radius:6px;font-size:16px;
      }
      .piano-keyboard{height:82px;border-radius:6px}
      .piano-key.white .piano-note-label{bottom:4px;font-size:8px}
      .piano-key.black{width:9.2%}
    }


    /* =========================================================
       /watergame - みんなでコップに水を入れるターン制ゲーム
       ========================================================= */
    .watergame-card{
      position:relative;
      width:min(430px,94%);
      margin:9px auto;
      padding:10px 11px 11px;
      overflow:hidden;
      border:1px solid rgba(94,145,185,.42);
      border-radius:15px;
      background:
        radial-gradient(circle at 50% 18%,rgba(218,246,255,.94),rgba(255,255,255,.97) 58%,rgba(235,247,255,.97));
      box-shadow:0 9px 25px rgba(26,68,103,.13);
      color:#20344b;
    }
    .watergame-card.is-ended{opacity:.88}
    .watergame-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      font-size:13px;
      font-weight:900;
    }
    .watergame-count{
      color:#678197;
      font-size:10px;
      font-weight:800;
      white-space:nowrap;
    }
    .watergame-turn{
      min-height:20px;
      margin:6px 0 1px;
      text-align:center;
      color:#264b6d;
      font-size:13px;
      font-weight:900;
    }
    .watergame-turn.is-mine{
      color:#0872c9;
      animation:waterTurnPulse .8s ease-in-out infinite alternate;
    }
    .watergame-sub{
      min-height:16px;
      text-align:center;
      color:#70859a;
      font-size:10px;
      font-weight:700;
    }
    .watergame-scene{
      position:relative;
      height:174px;
      margin:2px auto 7px;
      overflow:visible;
    }

    /* 注ぐ側の透明ピッチャー */
    .water-jug{
      position:absolute;
      z-index:7;
      top:3px;
      left:calc(50% + 43px);
      width:43px;
      height:34px;
      opacity:0;
      pointer-events:none;
      border:2px solid rgba(95,132,157,.67);
      border-radius:7px 7px 11px 11px;
      background:linear-gradient(180deg,rgba(255,255,255,.9),rgba(198,233,249,.52));
      box-shadow:
        inset 0 -11px 0 rgba(55,167,232,.36),
        0 4px 8px rgba(0,0,0,.08);
      transform-origin:8px 31px;
    }
    .water-jug::before{
      content:"";
      position:absolute;
      right:-15px;
      top:6px;
      width:17px;
      height:18px;
      border:4px solid rgba(95,132,157,.57);
      border-left:0;
      border-radius:0 14px 14px 0;
    }
    .water-jug::after{
      content:"";
      position:absolute;
      left:-9px;
      top:4px;
      width:12px;
      height:8px;
      border-top:3px solid rgba(95,132,157,.65);
      transform:skewX(-28deg);
    }
    .water-stream{
      position:absolute;
      z-index:6;
      left:calc(50% + 15px);
      top:38px;
      width:var(--water-stream-width,6px);
      height:77px;
      opacity:0;
      pointer-events:none;
      border-radius:99px;
      background:
        linear-gradient(90deg,rgba(209,246,255,.4),rgba(61,181,239,.94) 42%,rgba(193,243,255,.68));
      filter:drop-shadow(0 0 3px rgba(56,189,248,.35));
      transform:scaleY(.08);
      transform-origin:50% 0;
    }

    /* ガラス */
    .water-glass{
      position:absolute;
      z-index:3;
      left:50%;
      bottom:4px;
      width:116px;
      height:126px;
      overflow:hidden;
      transform:translateX(-50%);
      clip-path:polygon(8% 0,92% 0,83% 100%,17% 100%);
      border:3px solid rgba(112,153,180,.66);
      border-top:4px solid rgba(83,132,164,.74);
      border-radius:4px 4px 22px 22px;
      background:
        linear-gradient(90deg,rgba(255,255,255,.42),rgba(255,255,255,.05) 24%,rgba(255,255,255,.18) 72%,rgba(255,255,255,.48)),
        linear-gradient(180deg,rgba(217,242,255,.18),rgba(187,226,246,.08));
      box-shadow:
        inset 8px 0 12px rgba(255,255,255,.42),
        inset -7px 0 11px rgba(126,181,210,.12),
        0 8px 14px rgba(43,91,122,.13);
    }
    .water-glass::after{
      content:"";
      position:absolute;
      z-index:5;
      left:18%;
      top:9px;
      width:11%;
      height:72%;
      pointer-events:none;
      border-radius:99px;
      background:linear-gradient(rgba(255,255,255,.68),rgba(255,255,255,.04));
      transform:rotate(2deg);
    }
    .water-liquid{
      position:absolute;
      z-index:1;
      left:-8%;
      right:-8%;
      bottom:-2px;
      height:0%;
      background:linear-gradient(90deg,rgba(30,160,229,.76),rgba(89,204,247,.84) 42%,rgba(28,147,220,.84));
      transition:height .72s cubic-bezier(.18,.78,.22,1);
      filter:saturate(1.04);
    }
    .water-liquid::before{
      content:"";
      position:absolute;
      left:0;
      top:-7px;
      width:100%;
      height:14px;
      border-radius:50%;
      background:
        radial-gradient(ellipse at 50% 35%,rgba(231,251,255,.88) 0 18%,rgba(85,205,248,.94) 49%,rgba(24,147,220,.95) 73%);
      box-shadow:0 -1px 5px rgba(255,255,255,.45);
    }
    .water-liquid.slosh{animation:waterBodySlosh .68s ease-in-out 2}
    .water-liquid.slosh::before{animation:waterSlosh .68s ease-in-out 2}

    /* 溢れ */
    .water-splash{
      position:absolute;
      z-index:9;
      left:50%;
      bottom:111px;
      width:70px;
      height:42px;
      opacity:0;
      pointer-events:none;
      transform:translateX(-50%);
    }
    .water-splash::before,
    .water-splash::after{
      content:"💧";
      position:absolute;
      font-size:18px;
      opacity:0;
    }
    .water-splash::before{left:3px;top:9px}
    .water-splash::after{right:2px;top:2px}
    .watergame-card.is-overflow .water-splash{opacity:1}
    .watergame-card.is-overflow .water-splash::before{animation:waterDropLeft .85s ease-out forwards}
    .watergame-card.is-overflow .water-splash::after{animation:waterDropRight .9s .05s ease-out forwards}
    .water-puddle{
      position:absolute;
      z-index:2;
      left:50%;
      bottom:0;
      width:135px;
      height:17px;
      opacity:0;
      pointer-events:none;
      border-radius:50%;
      background:radial-gradient(ellipse,rgba(39,166,229,.56),rgba(103,208,247,.2) 62%,transparent 70%);
      transform:translateX(-50%) scale(.2);
    }
    .watergame-card.is-overflow .water-puddle{animation:waterPuddle .9s .23s ease-out forwards}

    .watergame-card.is-pouring .water-jug{animation:waterJugPour 1.05s ease-in-out forwards}
    .watergame-card.is-pouring .water-stream{animation:waterStream 1.05s ease-in-out forwards}

    .watergame-controls{
      display:grid;
      grid-template-columns:repeat(6,1fr);
      gap:5px;
      margin-top:6px;
    }
    .watergame-amount{
      min-width:0;
      min-height:34px;
      padding:0 3px;
      border:1px solid #a9cce4;
      border-radius:8px;
      background:linear-gradient(#fff,#eaf6fd);
      color:#176da9;
      font-size:11px;
      font-weight:900;
      cursor:pointer;
      touch-action:manipulation;
    }
    .watergame-amount:disabled{opacity:.38;cursor:default}
    .watergame-amount:not(:disabled):active{transform:translateY(1px);background:#d9f1ff}

    .watergame-spectator{
      margin-top:6px;
      padding:7px 8px;
      border-radius:9px;
      background:rgba(31,122,181,.08);
      color:#5c7890;
      text-align:center;
      font-size:10px;
      font-weight:800;
      line-height:1.45;
    }
    .watergame-result-line,
    .watergame-spectator-line{
      width:min(430px,94%);
      margin:7px auto;
      padding:9px 11px;
      border-radius:11px;
      text-align:center;
      font-size:12px;
      font-weight:900;
    }
    .watergame-result-line{
      border:1px solid rgba(226,73,73,.28);
      background:rgba(255,232,232,.95);
      color:#b42323;
    }
    .watergame-spectator-line{
      border:1px solid rgba(46,139,192,.22);
      background:rgba(230,247,255,.94);
      color:#3f728e;
    }

    @keyframes waterJugPour{
      0%{opacity:0;transform:translate(9px,-8px) rotate(0deg)}
      14%{opacity:1}
      33%{opacity:1;transform:translate(-2px,4px) rotate(-53deg)}
      72%{opacity:1;transform:translate(-2px,4px) rotate(-53deg)}
      100%{opacity:0;transform:translate(9px,-8px) rotate(0deg)}
    }
    @keyframes waterStream{
      0%,22%{opacity:0;transform:scaleY(.08)}
      32%{opacity:.97;transform:scaleY(1)}
      73%{opacity:.97;transform:scaleY(1)}
      88%,100%{opacity:0;transform:scaleY(.08)}
    }
    @keyframes waterSlosh{
      0%,100%{transform:translateX(0) rotate(0)}
      28%{transform:translateX(-7%) rotate(-3deg)}
      62%{transform:translateX(6%) rotate(2.5deg)}
    }
    @keyframes waterBodySlosh{
      0%,100%{transform:translateX(0)}
      35%{transform:translateX(-2.5%)}
      68%{transform:translateX(2.5%)}
    }
    @keyframes waterTurnPulse{from{transform:scale(1)}to{transform:scale(1.035)}}
    @keyframes waterDropLeft{
      0%{opacity:0;transform:translate(14px,5px) scale(.4)}
      28%{opacity:1}
      100%{opacity:0;transform:translate(-28px,42px) rotate(-25deg) scale(1.2)}
    }
    @keyframes waterDropRight{
      0%{opacity:0;transform:translate(-10px,6px) scale(.4)}
      28%{opacity:1}
      100%{opacity:0;transform:translate(30px,46px) rotate(28deg) scale(1.15)}
    }
    @keyframes waterPuddle{to{opacity:1;transform:translateX(-50%) scale(1)}}

    @media(max-width:300px){
      .watergame-card{
        width:calc(100% - 8px);
        margin:5px auto;
        padding:6px;
        border-radius:10px;
      }
      .watergame-head{font-size:10px}
      .watergame-count{font-size:8px}
      .watergame-turn{min-height:16px;margin-top:4px;font-size:10px}
      .watergame-sub{min-height:13px;font-size:8px}
      .watergame-scene{height:132px;margin-bottom:4px}
      .water-glass{width:79px;height:96px;bottom:3px;border-width:2px}
      .water-jug{left:calc(50% + 27px);width:31px;height:24px}
      .water-jug::before{right:-11px;width:12px;height:13px;border-width:3px}
      .water-jug::after{left:-7px;width:9px}
      .water-stream{left:calc(50% + 10px);top:29px;height:57px}
      .water-splash{bottom:82px;width:54px}
      .water-puddle{width:94px}
      .watergame-controls{grid-template-columns:repeat(3,1fr);gap:4px}
      .watergame-amount{min-height:28px;font-size:9px;border-radius:6px}
      .watergame-spectator{padding:5px;font-size:8px}
      .watergame-result-line,.watergame-spectator-line{
        width:calc(100% - 8px);
        padding:6px;
        font-size:9px;
      }
    }


    /* ---------- Water Game button visibility FIX ---------- */
    .watergame-controls{
      position:relative !important;
      z-index:20 !important;
      width:100% !important;
      display:grid;
      grid-template-columns:repeat(6,minmax(0,1fr));
      gap:6px !important;
      margin:8px 0 7px !important;
      visibility:visible;
      opacity:1;
    }
    .watergame-amount{
      display:flex !important;
      align-items:center !important;
      justify-content:center !important;
      min-width:0 !important;
      min-height:38px !important;
      padding:0 4px !important;
      border:1px solid #79b8df !important;
      border-radius:8px !important;
      background:linear-gradient(#ffffff,#dff3ff) !important;
      color:#075f9d !important;
      font-size:12px !important;
      font-weight:900 !important;
      line-height:1 !important;
      opacity:1;
    }
    .watergame-amount:disabled{
      opacity:.38 !important;
    }

    /* コップの輪郭をPCでも見やすくする */
    .water-glass{
      border-color:rgba(58,119,160,.88) !important;
      border-top-color:rgba(34,101,146,.96) !important;
      background:
        linear-gradient(90deg,rgba(209,239,255,.30),rgba(255,255,255,.08) 26%,rgba(205,238,255,.20) 72%,rgba(207,239,255,.34)),
        rgba(225,246,255,.12) !important;
      box-shadow:
        inset 8px 0 12px rgba(255,255,255,.46),
        inset -7px 0 11px rgba(74,157,203,.18),
        0 8px 14px rgba(43,91,122,.16) !important;
    }

    @media(max-width:300px){
      .watergame-controls{
        grid-template-columns:repeat(3,minmax(0,1fr)) !important;
        gap:4px !important;
        margin:5px 0 5px !important;
      }
      .watergame-amount{
        min-height:30px !important;
        font-size:9px !important;
        padding:0 2px !important;
        border-radius:6px !important;
      }
    }


    /* =========================================================
       Water Game FIXED PANEL
       chatlogの高さ/overflowに影響されない独立固定表示
       ========================================================= */
    .watergame-card{
      position:fixed !important;
      z-index:13200 !important;
      left:50% !important;
      top:50% !important;
      right:auto !important;
      bottom:auto !important;
      width:min(430px,calc(100vw - 24px)) !important;
      max-height:calc(100dvh - 24px) !important;
      margin:0 !important;
      overflow-x:hidden !important;
      overflow-y:auto !important;
      overscroll-behavior:contain;
      -webkit-overflow-scrolling:touch;
      transform:translate(-50%,-50%) !important;
      box-sizing:border-box !important;
    }

    .watergame-head,
    .watergame-turn,
    .watergame-sub,
    .watergame-controls,
    .watergame-scene,
    .watergame-spectator{
      flex:0 0 auto !important;
    }

    .watergame-scene{
      min-height:174px !important;
    }

    @supports not (height:100dvh){
      .watergame-card{
        max-height:calc(100vh - 24px) !important;
      }
    }

    /* WID / ultra narrow:
       入力欄を避けて、その上の領域へ固定する */
    @media(max-width:300px){
      .watergame-card{
        left:4px !important;
        right:4px !important;
        top:4px !important;
        bottom:48px !important;
        width:auto !important;
        max-width:none !important;
        height:auto !important;
        max-height:none !important;
        margin:0 !important;
        padding:6px !important;
        overflow-y:auto !important;
        overflow-x:hidden !important;
        transform:none !important;
        border-radius:10px !important;
      }

      .watergame-scene{
        min-height:132px !important;
        height:132px !important;
      }

      .watergame-controls{
        position:relative !important;
        z-index:30 !important;
        flex:0 0 auto !important;
      }
    }


    /* =========================================================
       Water Game JOIN LOBBY
       ========================================================= */
    .watergame-lobby-card{
      width:min(430px,94%);
      margin:8px auto;
      padding:10px 11px;
      border:1px solid rgba(68,145,194,.32);
      border-radius:13px;
      background:linear-gradient(180deg,rgba(241,251,255,.97),rgba(224,244,255,.96));
      box-shadow:0 7px 20px rgba(27,94,135,.12);
      color:#274b64;
      font-size:12px;
    }
    .watergame-lobby-card.is-started{opacity:.72}
    .watergame-lobby-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      margin-bottom:5px;
      font-weight:900;
    }
    .watergame-lobby-time{
      font-size:10px;
      color:#5e7e94;
      white-space:nowrap;
    }
    .watergame-lobby-info{
      margin-bottom:7px;
      color:#698397;
      font-size:10px;
      font-weight:700;
      line-height:1.45;
    }
    .watergame-lobby-members{
      max-height:58px;
      overflow:auto;
      margin:0 0 7px;
      padding:6px 7px;
      border-radius:8px;
      background:rgba(255,255,255,.7);
      color:#43647a;
      font-size:10px;
      line-height:1.5;
    }
    .watergame-lobby-join{
      width:100%;
      min-height:34px;
      border:0;
      border-radius:9px;
      background:#2689c7;
      color:#fff;
      font-weight:900;
      cursor:pointer;
    }
    .watergame-lobby-join.is-joined{
      background:#536b7c;
    }
    .watergame-lobby-join:disabled{
      opacity:.52;
      cursor:default;
    }
    @media(max-width:300px){
      .watergame-lobby-card{
        width:calc(100% - 8px);
        margin:4px auto;
        padding:6px;
        border-radius:9px;
        font-size:9px;
      }
      .watergame-lobby-head{font-size:9px}
      .watergame-lobby-time,.watergame-lobby-info,.watergame-lobby-members{font-size:8px}
      .watergame-lobby-members{max-height:42px;padding:4px}
      .watergame-lobby-join{min-height:29px;font-size:9px}
    }


    /* =========================================================
       Water Game spectator opt-in + close button
       ========================================================= */
    .watergame-head{
      position:relative;
      padding-right:31px;
    }
    .watergame-head-right{
      display:flex;
      align-items:center;
      gap:5px;
      margin-left:auto;
    }
    .watergame-close{
      position:absolute;
      top:-3px;
      right:-3px;
      width:27px;
      height:27px;
      padding:0;
      border:0;
      border-radius:7px;
      background:rgba(40,67,88,.11);
      color:#36546a;
      font-size:18px;
      font-weight:900;
      line-height:1;
      cursor:pointer;
      display:none;
      align-items:center;
      justify-content:center;
      z-index:40;
    }
    .watergame-close:hover{
      background:rgba(40,67,88,.19);
    }

    .watergame-spectator-line{
      display:flex !important;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      text-align:left !important;
    }
    .watergame-spectator-message{
      flex:1 1 auto;
      min-width:0;
      line-height:1.4;
    }
    .watergame-watch-btn{
      flex:0 0 auto;
      min-height:31px;
      padding:0 12px;
      border:0;
      border-radius:8px;
      background:#2689c7;
      color:#fff;
      font-size:11px;
      font-weight:900;
      cursor:pointer;
      white-space:nowrap;
    }
    .watergame-watch-btn.is-watching{
      background:#536b7c;
    }
    .watergame-watch-btn:disabled{
      opacity:.52;
      cursor:default;
    }

    @media(max-width:300px){
      .watergame-head{
        padding-right:25px;
      }
      .watergame-close{
        top:-2px;
        right:-2px;
        width:22px;
        height:22px;
        border-radius:6px;
        font-size:15px;
      }
      .watergame-spectator-line{
        gap:5px;
        padding:6px !important;
      }
      .watergame-spectator-message{
        font-size:8px;
      }
      .watergame-watch-btn{
        min-height:26px;
        padding:0 7px;
        border-radius:6px;
        font-size:8px;
      }
    }


    .activity-join-card{width:100%;padding:7px;border:1px solid #30405b;border-radius:8px;background:#172033;color:var(--text);font-size:9px}
    .activity-join-head{display:flex;justify-content:space-between;gap:4px;font-weight:900}
    .activity-join-time{font-size:8px;color:#a5b4fc}
    .activity-join-desc,.activity-join-people{margin-top:4px;color:var(--muted);font-size:8px;line-height:1.35}
    .activity-join-btn{width:100%;min-height:27px;margin-top:5px;padding:0 4px;border:1px solid #3b6aa0!important;border-radius:6px!important;background:#2367ad!important;color:#fff!important;font-size:8px;font-weight:900}
    .activity-join-btn.is-joined{background:#42566e!important}.activity-join-btn:disabled{opacity:.5}
    body.local-light .activity-join-card{background:#fff!important;color:#111!important;border-color:#aaa!important}
    body.local-light .activity-join-desc,body.local-light .activity-join-people{color:#555!important}

    /* =========================================================
       /tokei — 世界アナログ時計カード
       ========================================================= */
    .world-clock-card{
      align-self:center;
      width:min(680px,94%);
      padding:13px 14px 14px;
      border:1px solid rgba(255,255,255,.12);
      border-radius:16px;
      background:rgba(20,27,39,.78);
      color:var(--text);
      box-shadow:0 10px 28px rgba(0,0,0,.18);
      backdrop-filter:blur(18px) saturate(145%);
      -webkit-backdrop-filter:blur(18px) saturate(145%);
    }
    .world-clock-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin-bottom:10px;
    }
    .world-clock-title{
      font-size:12px;
      font-weight:900;
      letter-spacing:.02em;
    }
    .world-clock-live{
      padding:2px 7px;
      border-radius:999px;
      background:rgba(66,153,225,.15);
      border:1px solid rgba(96,165,250,.24);
      color:#a9d2ff;
      font-size:9px;
      font-weight:900;
    }
    .world-clock-grid{
      display:grid;
      grid-template-columns:repeat(3,minmax(0,1fr));
      gap:12px;
      align-items:start;
    }
    .world-clock-item{
      min-width:0;
      text-align:center;
    }
    .world-clock-face{
      position:relative;
      width:min(138px,100%);
      aspect-ratio:1;
      margin:0 auto 7px;
      border-radius:50%;
      border:2px solid rgba(255,255,255,.34);
      background:
        radial-gradient(circle at center,rgba(255,255,255,.08) 0 4%,transparent 4.5%),
        repeating-conic-gradient(
          from -1.5deg,
          rgba(255,255,255,.55) 0deg 1.2deg,
          transparent 1.2deg 30deg
        ),
        radial-gradient(circle at 38% 30%,rgba(255,255,255,.10),rgba(255,255,255,.025) 56%,rgba(0,0,0,.14));
      box-shadow:
        inset 0 0 0 6px rgba(0,0,0,.06),
        0 6px 18px rgba(0,0,0,.16);
    }
    .world-clock-center{
      position:absolute;
      left:50%;
      top:50%;
      width:8px;
      height:8px;
      border-radius:50%;
      background:#fff;
      transform:translate(-50%,-50%);
      z-index:5;
      box-shadow:0 0 0 2px rgba(0,0,0,.18);
    }
    .world-clock-hand{
      position:absolute;
      left:50%;
      bottom:50%;
      transform-origin:50% 100%;
      border-radius:999px;
      transform:translateX(-50%) rotate(0deg);
      will-change:transform;
    }
    .world-clock-hour{
      width:4px;
      height:28%;
      background:#f5f7fb;
      z-index:2;
    }
    .world-clock-minute{
      width:3px;
      height:37%;
      background:#d8dee9;
      z-index:3;
    }
    .world-clock-second{
      width:1.5px;
      height:41%;
      background:#ff6b6b;
      z-index:4;
    }
    .world-clock-city{
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
      font-size:11px;
      font-weight:900;
    }
    .world-clock-time{
      margin-top:1px;
      font-variant-numeric:tabular-nums;
      color:var(--muted);
      font-size:10px;
    }
    body.local-light .world-clock-card{
      background:rgba(250,252,255,.82);
      color:#111;
      border-color:rgba(38,53,70,.14);
      box-shadow:0 9px 24px rgba(35,50,67,.10);
    }
    body.local-light .world-clock-face{
      border-color:rgba(34,48,64,.30);
      background:
        radial-gradient(circle at center,rgba(35,48,63,.10) 0 4%,transparent 4.5%),
        repeating-conic-gradient(
          from -1.5deg,
          rgba(35,48,63,.50) 0deg 1.2deg,
          transparent 1.2deg 30deg
        ),
        radial-gradient(circle at 38% 30%,rgba(255,255,255,.95),rgba(235,240,246,.80) 60%,rgba(212,220,230,.78));
    }
    body.local-light .world-clock-hour{background:#17212c}
    body.local-light .world-clock-minute{background:#344252}
    body.local-light .world-clock-center{background:#17212c}
    body.local-light .world-clock-time{color:#5a6673}

    @media(max-width:680px){
      .world-clock-card{
        width:calc(100% - 10px);
        padding:10px 8px 11px;
        border-radius:14px;
      }
      .world-clock-grid{gap:7px}
      .world-clock-face{
        width:min(102px,100%);
        margin-bottom:5px;
      }
      .world-clock-title{font-size:11px}
      .world-clock-city{font-size:9px}
      .world-clock-time{font-size:8px}
    }

    @media(max-width:300px){
      .world-clock-card{
        width:100%;
        padding:7px 5px 8px;
        border-radius:10px;
      }
      .world-clock-head{margin-bottom:6px}
      .world-clock-title{font-size:9px}
      .world-clock-live{font-size:7px;padding:1px 5px}
      .world-clock-grid{gap:3px}
      .world-clock-face{
        width:min(58px,100%);
        border-width:1px;
        box-shadow:inset 0 0 0 3px rgba(0,0,0,.05);
      }
      .world-clock-center{width:5px;height:5px}
      .world-clock-hour{width:3px}
      .world-clock-minute{width:2px}
      .world-clock-second{width:1px}
      .world-clock-city{font-size:7px}
      .world-clock-time{font-size:7px}
    }


    /* =========================================================
       地震情報カード / 自動監視
       ========================================================= */
    .earthquake-info-card{
      align-self:center;
      width:min(620px,94%);
      padding:12px 14px 13px;
      border:1px solid rgba(255,167,79,.28);
      border-radius:15px;
      background:rgba(43,31,24,.84);
      color:var(--text);
      box-shadow:0 10px 28px rgba(0,0,0,.18);
      backdrop-filter:blur(17px) saturate(140%);
      -webkit-backdrop-filter:blur(17px) saturate(140%);
      transform-origin:center;
    }
    .earthquake-info-card.is-quake-shaking{
      animation:earthquakeCardShake .68s cubic-bezier(.36,.07,.19,.97);
    }
    @keyframes earthquakeCardShake{
      0%,100%{transform:translate3d(0,0,0) rotate(0)}
      12%{transform:translate3d(-7px,1px,0) rotate(-.7deg)}
      24%{transform:translate3d(7px,-1px,0) rotate(.7deg)}
      36%{transform:translate3d(-6px,0,0) rotate(-.5deg)}
      48%{transform:translate3d(6px,1px,0) rotate(.5deg)}
      60%{transform:translate3d(-4px,-1px,0) rotate(-.35deg)}
      72%{transform:translate3d(4px,0,0) rotate(.35deg)}
      84%{transform:translate3d(-2px,0,0) rotate(-.2deg)}
    }
    .earthquake-card-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      margin-bottom:9px;
    }
    .earthquake-card-title{
      font-size:12px;
      font-weight:1000;
      letter-spacing:.02em;
    }
    .earthquake-card-badge{
      flex:0 0 auto;
      padding:2px 7px;
      border-radius:999px;
      border:1px solid rgba(255,174,91,.30);
      background:rgba(255,146,51,.14);
      color:#ffc58d;
      font-size:8px;
      font-weight:1000;
    }
    .earthquake-card-grid{
      display:grid;
      grid-template-columns:repeat(2,minmax(0,1fr));
      gap:6px 12px;
    }
    .earthquake-card-cell{
      min-width:0;
    }
    .earthquake-card-label{
      display:block;
      color:var(--muted);
      font-size:8px;
      line-height:1.2;
    }
    .earthquake-card-value{
      display:block;
      margin-top:2px;
      overflow-wrap:anywhere;
      font-size:11px;
      font-weight:800;
      line-height:1.35;
    }
    .earthquake-card-scale{
      color:#ffca8a;
      font-size:14px;
      font-weight:1000;
    }
    .earthquake-card-source{
      margin-top:8px;
      color:var(--muted);
      font-size:7px;
      text-align:right;
    }

    body.local-light .earthquake-info-card{
      background:rgba(255,249,241,.92);
      color:#202020;
      border-color:rgba(190,104,28,.22);
      box-shadow:0 8px 24px rgba(59,41,25,.10);
    }
    body.local-light .earthquake-card-badge{
      background:rgba(224,113,15,.10);
      color:#a95308;
      border-color:rgba(190,104,28,.20);
    }
    body.local-light .earthquake-card-scale{color:#a84f06}
    body.local-light .earthquake-card-label,
    body.local-light .earthquake-card-source{color:#70665c}

    @media(max-width:680px){
      .earthquake-info-card{
        width:calc(100% - 10px);
        padding:10px 11px 11px;
        border-radius:13px;
      }
      .earthquake-card-title{font-size:11px}
      .earthquake-card-value{font-size:10px}
      .earthquake-card-scale{font-size:13px}
    }

    @media(max-width:300px){
      .earthquake-info-card{
        width:100%;
        padding:7px 7px 8px;
        border-radius:9px;
      }
      .earthquake-card-head{margin-bottom:6px}
      .earthquake-card-title{font-size:8px}
      .earthquake-card-badge{font-size:6px;padding:1px 4px}
      .earthquake-card-grid{gap:4px 6px}
      .earthquake-card-label{font-size:6px}
      .earthquake-card-value{font-size:7px}
      .earthquake-card-scale{font-size:9px}
      .earthquake-card-source{font-size:6px;margin-top:5px}
    }


    /* /kurohige : WIDは参加不可。開催状況だけ小さく表示 */
    .kurohige-wid-notice{
      width:100%;
      padding:6px 7px;
      border:1px solid rgba(255,255,255,.12);
      border-radius:8px;
      background:rgba(20,26,38,.78);
      color:var(--text);
      font-size:8px;
      line-height:1.35;
      text-align:center;
    }
    .kurohige-wid-notice strong{display:block;font-size:9px}
    .kurohige-wid-notice .sub{color:var(--muted);font-size:7px}
    body.local-light .kurohige-wid-notice{
      background:rgba(250,252,255,.90);
      color:#17212c;
      border-color:rgba(35,48,63,.13);
    }


    /* QR受信モーダル（WID） */
    #widQrModalBackdrop{
      position:fixed;
      inset:0;
      z-index:2147483647;
      display:none;
      align-items:center;
      justify-content:center;
      padding:5px;
      background:rgba(0,0,0,.58);
    }
    #widQrModalBackdrop.open{display:flex}
    .wid-qr-modal{
      width:min(270px,calc(100vw - 10px));
      max-height:calc(100vh - 10px);
      overflow:auto;
      padding:8px;
      border:1px solid var(--border);
      border-radius:10px;
      background:var(--panel);
      color:var(--text);
    }
    .wid-qr-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:5px;
      margin-bottom:5px;
    }
    .wid-qr-head strong{font-size:10px}
    #widQrClose{
      width:23px;
      height:23px;
      min-width:23px;
      padding:0;
      border-radius:50%;
      font-size:12px;
    }
    .wid-qr-text{
      max-height:120px;
      overflow:auto;
      padding:6px;
      border:1px solid var(--border);
      border-radius:7px;
      font-size:8px;
      line-height:1.4;
      white-space:pre-wrap;
      overflow-wrap:anywhere;
      user-select:text;
      -webkit-user-select:text;
    }
    .wid-qr-copy,
    .wid-qr-open{
      width:100%;
      min-height:28px;
      margin-top:5px;
      padding:4px 6px;
      border-radius:7px;
      font-size:8px;
      font-weight:900;
    }
    .wid-chat-image.is-qr-image{
      background:#fff;
      padding:3px;
      cursor:pointer;
    }


      /* b64: tap decode（WID） */
      .message-bubble.b64-bubble{
        cursor:pointer;
        touch-action:manipulation;
        user-select:none;
        -webkit-user-select:none;
      }
      .message-bubble.b64-bubble .b64-badge{
        display:inline-block;
        margin:0 4px 2px 0;
        padding:1px 4px;
        border:1px solid rgba(255,255,255,.18);
        border-radius:999px;
        background:rgba(255,255,255,.08);
        font-size:7px;
        font-weight:900;
        line-height:1.2;
      }
      .message-bubble.b64-bubble .b64-message-text{
        color:inherit!important;
        -webkit-text-fill-color:currentColor!important;
        white-space:pre-wrap;
        overflow-wrap:anywhere;
        user-select:text;
        -webkit-user-select:text;
      }
      .message-bubble.b64-bubble.is-decoded{
        display:block!important;
        -webkit-line-clamp:unset!important;
        max-height:120px;
        overflow:auto;
      }
      body.local-light main .message:not(.mine) .message-bubble.b64-bubble{
        background:#f6f8fb!important;
        color:#17212b!important;
        -webkit-text-fill-color:#17212b!important;
        border:1px solid rgba(40,55,70,.12)!important;
      }
      body.local-light main .message:not(.mine) .message-bubble.b64-bubble .b64-message-text{
        color:inherit!important;
        -webkit-text-fill-color:currentColor!important;
      }
      body.local-light main .message:not(.mine) .message-bubble.b64-bubble .b64-badge{
        background:#e6ebf1!important;
        color:#334155!important;
        -webkit-text-fill-color:#334155!important;
        border-color:#aeb8c4!important;
      }
      body.local-light main .message.mine .message-bubble.b64-bubble{
        color:#fff!important;
        -webkit-text-fill-color:#fff!important;
      }
      body.local-light main .message.mine .message-bubble.b64-bubble .b64-message-text{
        color:inherit!important;
        -webkit-text-fill-color:currentColor!important;
      }
      body.local-light main .message.mine .message-bubble.b64-bubble .b64-badge{
        background:rgba(255,255,255,.14)!important;
        color:#fff!important;
        -webkit-text-fill-color:#fff!important;
        border-color:rgba(255,255,255,.38)!important;
      }


    /* slide: — compact classic unlock for WID */
    .message-bubble.slide-lock-bubble{
      padding:0!important;
      background:transparent!important;
      border:0!important;
      box-shadow:none!important;
      width:min(176px,100%);
      max-width:100%;
      overflow:visible!important;
    }
    .slide-lock-shell{
      width:100%;
      box-sizing:border-box;
      overflow:hidden;
      border-radius:12px;
      padding:7px;
      color:#fff;
      background:
        radial-gradient(circle at 50% -25%,rgba(255,255,255,.20),transparent 48%),
        linear-gradient(180deg,#303338,#101214 52%,#050607);
      border:1px solid rgba(255,255,255,.20);
      box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 4px 12px rgba(0,0,0,.22);
      user-select:none;
      -webkit-user-select:none;
    }
    .slide-lock-top{
      display:flex;align-items:center;justify-content:center;gap:5px;
      margin:0 0 5px;font-size:8px;color:rgba(255,255,255,.68);
    }
    .slide-lock-icon{
      position:relative;width:8px;height:7px;border-radius:2px;
      background:linear-gradient(#eee,#999);
    }
    .slide-lock-icon::before{
      content:"";position:absolute;left:1px;top:-5px;width:6px;height:6px;
      box-sizing:border-box;border:1.5px solid #ddd;border-bottom:0;border-radius:6px 6px 0 0;
    }
    .slide-lock-track{
      --slide-x:0px;position:relative;height:38px;overflow:hidden;border-radius:9px;
      background:linear-gradient(#050505,#242424);
      border:1px solid rgba(255,255,255,.12);box-shadow:inset 0 2px 4px #000;
      touch-action:pan-y;
    }
    .slide-lock-label{
      position:absolute;inset:0 5px 0 40px;display:flex;align-items:center;justify-content:center;
      white-space:nowrap;overflow:hidden;font-size:10px;color:rgba(255,255,255,.36);
      text-shadow:0 -1px #000;pointer-events:none;
    }
    .slide-lock-label::after{
      content:"slide to unlock";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
      color:transparent;
      background:linear-gradient(105deg,rgba(255,255,255,.18) 30%,#fff 49%,rgba(255,255,255,.18) 66%);
      background-size:230% 100%;-webkit-background-clip:text;background-clip:text;
      animation:slideUnlockShimmer 2.35s linear infinite;
    }
    @keyframes slideUnlockShimmer{from{background-position:135% 0}to{background-position:-90% 0}}
    .slide-lock-thumb{
      position:absolute;z-index:3;left:3px;top:3px;width:31px;height:30px;padding:0;
      border:1px solid rgba(255,255,255,.75);border-radius:7px;
      background:linear-gradient(#fafafa 0%,#d5d5d5 48%,#999 52%,#c8c8c8 100%);
      box-shadow:inset 0 1px #fff,0 1px 2px #000;
      transform:translateX(var(--slide-x));transition:transform .20s ease;touch-action:none;cursor:grab;
    }
    .slide-lock-thumb::before,.slide-lock-thumb::after{
      content:"";position:absolute;top:9px;width:8px;height:8px;
      border-top:2px solid #444;border-right:2px solid #444;transform:rotate(45deg);
    }
    .slide-lock-thumb::before{left:6px}.slide-lock-thumb::after{left:12px}
    .slide-unlocked-text{
      display:none;
      color:inherit!important;
      -webkit-text-fill-color:currentColor!important;
      white-space:pre-wrap;
      overflow-wrap:anywhere;
    }
    .message-bubble.slide-lock-bubble.is-unlocked{
      width:auto;padding:7px 9px!important;background:#232b3d!important;color:#fff!important;
      border-radius:12px 12px 12px 4px!important;
    }
    .message.mine .message-bubble.slide-lock-bubble.is-unlocked{
      border-radius:12px 12px 4px 12px!important;background:#315da8!important;
    }
    .message-bubble.slide-lock-bubble.is-unlocked .slide-lock-shell{display:none}
    .message-bubble.slide-lock-bubble.is-unlocked .slide-unlocked-text{
      display:block;animation:slideTextReveal .25s ease both;
    }
    @keyframes slideTextReveal{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}
    body.local-light main .message:not(.mine) .message-bubble.slide-lock-bubble.is-unlocked{
      background:#f6f8fb!important;
      color:#18202c!important;
      -webkit-text-fill-color:#18202c!important;
      border:1px solid rgba(40,50,65,.12)!important;
    }
    body.local-light main .message:not(.mine) .message-bubble.slide-lock-bubble.is-unlocked .slide-unlocked-text{
      color:inherit!important;
      -webkit-text-fill-color:currentColor!important;
    }
    body.local-light main .message.mine .message-bubble.slide-lock-bubble.is-unlocked{
      background:#3276d2!important;
      color:#fff!important;
      -webkit-text-fill-color:#fff!important;
      border-color:transparent!important;
    }
    body.local-light main .message.mine .message-bubble.slide-lock-bubble.is-unlocked .slide-unlocked-text{
      color:inherit!important;
      -webkit-text-fill-color:currentColor!important;
    }



/* 動画受信（WID） */
.wid-video-bubble{
  width:min(176px,100%);
  overflow:hidden;
  border-radius:11px;
  background:rgba(18,23,32,.94);
  border:1px solid rgba(255,255,255,.10);
}
.wid-chat-video{
  display:block;
  width:100%;
  max-height:210px;
  object-fit:contain;
  background:#000;
}
.wid-video-info{
  padding:5px 7px 6px;
  font-size:8px;
  opacity:.7;
}
body.local-light .wid-video-bubble{
  background:rgba(255,255,255,.94);
  border-color:rgba(20,30,45,.10);
}


/* /saigai - WID compact */
.saigai-info-card{
  width:min(176px,calc(100% - 6px));
  margin:5px auto;
  padding:7px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:11px;
  background:linear-gradient(145deg,rgba(73,20,37,.95),rgba(25,25,34,.97));
  color:#fff;
  box-shadow:0 5px 16px rgba(0,0,0,.18);
}
.saigai-info-card.is-clear{
  background:linear-gradient(145deg,rgba(20,57,47,.95),rgba(24,30,33,.97));
}
.saigai-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:4px;
  margin-bottom:5px;
}
.saigai-card-title{
  font-size:8px;
  line-height:1.25;
  font-weight:850;
}
.saigai-card-top-badge{
  flex:0 0 auto;
  padding:1px 4px;
  border-radius:99px;
  background:rgba(255,255,255,.12);
  font-size:5px;
  font-weight:850;
}
.saigai-card-list{
  display:grid;
  gap:4px;
}
.saigai-card-item{
  padding:5px 5px 5px 7px;
  border-radius:7px;
  background:rgba(0,0,0,.16);
  border:1px solid rgba(255,255,255,.08);
}
.saigai-card-item.severity-5{box-shadow:inset 2px 0 0 rgba(239,97,163,.95)}
.saigai-card-item.severity-4{box-shadow:inset 2px 0 0 rgba(179,92,224,.95)}
.saigai-card-item-head{
  display:flex;
  align-items:flex-start;
  flex-wrap:wrap;
  gap:3px;
}
.saigai-card-level{
  padding:1px 3px;
  border-radius:99px;
  background:rgba(255,255,255,.12);
  font-size:5px;
  font-weight:850;
}
.saigai-card-warning-name{
  font-size:6.5px;
  line-height:1.3;
}
.saigai-card-region{
  display:grid;
  gap:2px;
  margin-top:3px;
}
.saigai-card-office{
  font-size:5.5px;
  font-weight:800;
  opacity:.88;
}
.saigai-card-areas{
  font-size:5.5px;
  line-height:1.4;
  opacity:.75;
  overflow-wrap:anywhere;
}
.saigai-card-clear{
  padding:7px;
  border-radius:7px;
  background:rgba(255,255,255,.06);
  font-size:6.5px;
  line-height:1.45;
}
.saigai-card-more,
.saigai-card-caution{
  margin-top:4px;
  font-size:5.5px;
  line-height:1.4;
}
.saigai-card-caution{
  padding:4px;
  border-radius:6px;
  background:rgba(255,255,255,.06);
}
.saigai-card-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:3px;
  margin-top:5px;
  padding-top:4px;
  border-top:1px solid rgba(255,255,255,.08);
}
.saigai-card-source,
.saigai-card-link{
  font-size:5px;
}
.saigai-card-link{
  color:inherit;
  font-weight:800;
  text-decoration:underline;
}
body.local-light .saigai-info-card{
  color:#22202a;
  border-color:rgba(30,30,45,.11);
  background:linear-gradient(145deg,rgba(255,236,243,.98),rgba(249,247,252,.98));
}
body.local-light .saigai-info-card.is-clear{
  background:linear-gradient(145deg,rgba(232,249,242,.98),rgba(248,251,250,.98));
}
body.local-light .saigai-card-item,
body.local-light .saigai-card-clear,
body.local-light .saigai-card-caution,
body.local-light .saigai-card-top-badge{
  background:rgba(30,30,45,.045);
}


/* ============================================================
   WID Toast position v2 — 入力欄の少し上に浮く透明ブラー
   ============================================================ */
#toastLayer{
  top:auto !important;
  bottom:58px !important;
  left:50% !important;
  transform:translateX(-50%) !important;
  z-index:10001 !important;
  width:min(92vw,260px) !important;
  gap:4px !important;
  align-items:center;
  pointer-events:none;
}

.chat-toast{
  align-self:center !important;
  max-width:100% !important;
  padding:6px 9px !important;
  border:1px solid rgba(255,255,255,.15) !important;
  border-radius:11px !important;
  background:rgba(16,22,32,.40) !important;
  color:#fff !important;
  box-shadow:
    0 6px 18px rgba(0,0,0,.16),
    inset 0 1px 0 rgba(255,255,255,.07) !important;
  backdrop-filter:blur(16px) saturate(150%);
  -webkit-backdrop-filter:blur(16px) saturate(150%);
  font-weight:700;
  text-align:center;
  line-height:1.3;
  font-size:10px;
}

@keyframes toastIn{
  from{opacity:0;transform:translateY(6px) scale(.97)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@keyframes toastOut{
  to{opacity:0;transform:translateY(5px) scale(.98)}
}

body.local-light .chat-toast{
  background:rgba(248,250,253,.48) !important;
  color:#1d2732 !important;
  border-color:rgba(48,64,82,.13) !important;
  box-shadow:
    0 6px 16px rgba(40,55,72,.10),
    inset 0 1px 0 rgba(255,255,255,.7) !important;
}

@media(max-width:300px){
  #toastLayer{
    bottom:54px !important;
    width:calc(100vw - 12px) !important;
  }
  .chat-toast{
    max-width:96% !important;
    padding:5px 7px !important;
    border-radius:9px !important;
    font-size:8.5px;
  }
}

@media(max-width:210px){
  #toastLayer{
    bottom:48px !important;
    width:calc(100vw - 8px) !important;
  }
  .chat-toast{
    padding:4px 6px !important;
    font-size:7.5px;
  }
}


/* Shared Calendar + Calculator — WID compact */
.shared-calendar-card,
.shared-calc-card{
  width:100%;
  box-sizing:border-box;
  margin:5px 0;
  border:1px solid #30405b;
  border-radius:9px;
  background:#172033;
  color:var(--text);
  overflow:hidden;
}
.shared-calendar-card{padding:6px}
.shared-calendar-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:4px;
}
.shared-calendar-title{
  font-size:9px;
  font-weight:900;
}
.shared-calendar-badge{
  font-size:6px;
  font-weight:800;
  padding:1px 4px;
  border-radius:99px;
  background:#22304a;
  color:#b9c5d8;
}
.shared-calendar-weekdays,
.shared-calendar-grid{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:1px;
}
.shared-calendar-weekdays{margin-top:5px}
.shared-calendar-weekday{
  text-align:center;
  font-size:6px;
  color:#8391a5;
}
.shared-calendar-day{
  min-height:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:7px;
  font-weight:800;
}
.shared-calendar-day>span{
  width:16px;
  height:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
}
.shared-calendar-day.is-selected>span{
  background:#ff3b30;
  color:#fff;
  box-shadow:0 0 0 2px rgba(255,59,48,.15);
}

.shared-calc-card{padding:6px}
.shared-calc-head{
  font-size:9px;
  font-weight:900;
  margin-bottom:4px;
}
.shared-calc-expression,
.shared-calc-result{
  border:1px solid #2c3a52;
  background:#0f1725;
  font-family:monospace;
  text-align:right;
  overflow-wrap:anywhere;
}
.shared-calc-expression{
  min-height:20px;
  padding:4px 5px 1px;
  border-bottom:0;
  border-radius:7px 7px 0 0;
  color:#9daabd;
  font-size:8px;
}
.shared-calc-result{
  min-height:25px;
  padding:1px 5px 4px;
  border-top:0;
  border-radius:0 0 7px 7px;
  color:#fff;
  font-size:14px;
  font-weight:900;
}
.shared-calc-result.is-error{
  color:#ff948e;
  font-size:8px;
  padding-top:5px;
}
.shared-calc-keypad{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:2px;
  margin-top:4px;
}
.shared-calc-key{
  height:24px;
  min-width:0;
  padding:0;
  border:1px solid #35445e;
  border-radius:5px;
  background:#202b40;
  color:var(--text);
  font-size:8px;
  font-weight:900;
  touch-action:manipulation;
}
.shared-calc-key.is-operator{color:#ffc36b;background:#3a2d22}
.shared-calc-key.is-equals{color:#8ee6a4;background:#1d3829}
.shared-calc-key.is-clear,
.shared-calc-key.is-back{color:#ffaaa5}
.shared-calc-key:active,
.shared-calc-key.is-pressed{
  transform:translateY(1px) scale(.94);
  background:#315b86;
}
.shared-calc-activity{
  height:13px;
  padding-top:3px;
  text-align:center;
  color:#8190a5;
  font-size:6px;
}

body.local-light .shared-calendar-card,
body.local-light .shared-calc-card{
  background:#fff!important;
  color:#111!important;
  border-color:#aaa!important;
}
body.local-light .shared-calendar-badge{background:#eef1f5;color:#5c6875}
body.local-light .shared-calc-expression,
body.local-light .shared-calc-result{
  background:#f2f5f8;
  border-color:#ccd4dc;
}
body.local-light .shared-calc-expression{color:#687685}
body.local-light .shared-calc-result{color:#17212c}
body.local-light .shared-calc-result.is-error{color:#c83f37}
body.local-light .shared-calc-key{
  background:#edf1f5;
  color:#17212c;
  border-color:#cbd3dc;
}
body.local-light .shared-calc-key.is-operator{background:#fff0d8;color:#9a5600}
body.local-light .shared-calc-key.is-equals{background:#e2f5e7;color:#166c32}

@media(max-width:210px){
  .shared-calendar-title,.shared-calc-head{font-size:8px}
  .shared-calendar-day{min-height:17px;font-size:6px}
  .shared-calendar-day>span{width:15px;height:15px}
  .shared-calc-key{height:22px;font-size:7px}
  .shared-calc-result{font-size:12px}
}


/* Shared Calendar / Calculator flex-collapse fix — WID */
.chatlog > .shared-calendar-card,
.chatlog > .shared-calc-card{
  flex:0 0 auto !important;
  flex-shrink:0 !important;
  height:auto !important;
  min-height:max-content !important;
  max-height:none !important;
  align-self:stretch !important;
  overflow:visible !important;
}

.shared-calendar-card,
.shared-calc-card{
  box-sizing:border-box !important;
  contain:none !important;
}

.shared-calendar-weekdays,
.shared-calendar-grid,
.shared-calc-head,
.shared-calc-expression,
.shared-calc-result,
.shared-calc-keypad,
.shared-calc-activity{
  flex:0 0 auto !important;
}

.shared-calendar-grid,
.shared-calc-keypad{
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow:visible !important;
}

/* 190px前後でも縦スクロールを殺さない */
@media(max-width:210px){
  .chatlog{
    overflow-y:auto !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
  }
  .chatlog > .shared-calendar-card,
  .chatlog > .shared-calc-card{
    flex-shrink:0 !important;
    height:auto !important;
    min-height:max-content !important;
    max-height:none !important;
  }
}

/* LIGHT — command help: keep only soft structural borders */
body.local-light #commandModalBackdrop.command-modal-backdrop{
  background:rgba(241,245,249,.78) !important;
  border:0 !important;
}
body.local-light #commandModalBackdrop .light-theme-popup{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
body.local-light #commandModalBackdrop .command-modal{
  background:#fff !important;
  color:#17212c !important;
  border:1px solid #cbd5e1 !important;
  box-shadow:0 18px 50px rgba(51,65,85,.18) !important;
}
body.local-light #commandModalBackdrop .command-modal-head{
  background:#f8fafc !important;
  border:0 !important;
  border-bottom:1px solid #dbe3eb !important;
  box-shadow:none !important;
}
body.local-light #commandModalBackdrop .command-modal-list{
  background:#f1f5f9 !important;
  border:0 !important;
  box-shadow:none !important;
  scrollbar-color:#94a3b8 #f1f5f9;
}
body.local-light #commandModalBackdrop .command-row{
  background:#fff !important;
  color:#17212c !important;
  border:1px solid #d8e0e8 !important;
  box-shadow:0 2px 7px rgba(51,65,85,.06) !important;
}
body.local-light #commandModalBackdrop .command-row > div,
body.local-light #commandModalBackdrop .command-modal-title,
body.local-light #commandModalBackdrop .command-code,
body.local-light #commandModalBackdrop .command-desc{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
body.local-light #commandModalBackdrop .command-code{color:#17212c !important}
body.local-light #commandModalBackdrop .command-desc{color:#64748b !important}
body.local-light #commandModalBackdrop .command-copy,
body.local-light #commandModalBackdrop .command-modal-close{
  background:#fff !important;
  color:#1f2937 !important;
  border:1px solid #cbd5e1 !important;
  box-shadow:none !important;
}
body.local-light #commandModalBackdrop .command-copy:hover,
body.local-light #commandModalBackdrop .command-modal-close:hover{
  background:#f1f5f9 !important;
  border-color:#94a3b8 !important;
}
body.local-light #commandModalBackdrop .command-modal-list::-webkit-scrollbar-track{
  background:#f1f5f9;
}
body.local-light #commandModalBackdrop .command-modal-list::-webkit-scrollbar-thumb{
  background:#94a3b8;
  border:2px solid #f1f5f9;
  border-radius:999px;
}

/* Modal motion — command help */
.command-modal-backdrop{
  display:flex;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:
    opacity .24s ease,
    visibility 0s linear .28s;
}
.command-modal-backdrop.open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition-delay:0s;
}
.command-modal{
  opacity:0;
  transform:translateY(10px) scale(.965);
  transform-origin:center center;
  transition:
    opacity .2s ease,
    transform .3s cubic-bezier(.2,.8,.2,1);
  will-change:opacity,transform;
}
.command-modal-backdrop.open .command-modal{
  opacity:1;
  transform:translateY(0) scale(1);
}
@media(prefers-reduced-motion:reduce){
  .command-modal-backdrop,
  .command-modal{
    transition:none !important;
  }
}

/* Motion — newly arriving chat bubbles */
.chatlog > .message:not(.history-message){
  transform-origin:left bottom;
  animation:for314MessageInLeft .28s cubic-bezier(.22,1,.36,1) both;
}
.chatlog > .message.mine:not(.history-message){
  transform-origin:right bottom;
  animation-name:for314MessageInRight;
}
@keyframes for314MessageInLeft{
  from{opacity:0;transform:translate3d(-12px,6px,0) scale(.975)}
  to{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@keyframes for314MessageInRight{
  from{opacity:0;transform:translate3d(12px,6px,0) scale(.975)}
  to{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@media(prefers-reduced-motion:reduce){
  .chatlog > .message:not(.history-message){
    animation:none !important;
  }
}

/* Composer-to-bubble flight for the sender's plain-text messages */
.composer-flight-ghost{
  position:fixed;
  z-index:2147483605;
  margin:0;
  box-sizing:border-box;
  overflow:hidden;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  pointer-events:none;
  transform-origin:center center;
  will-change:transform,opacity,filter;
  contain:layout paint style;
}
.chatlog > .message.composer-flight-message{
  animation:none !important;
}
.chatlog > .message.composer-flight-message.composer-flight-target{
  opacity:0 !important;
}
@media(prefers-reduced-motion:reduce){
  .composer-flight-ghost{
    display:none !important;
  }
  .chatlog > .message.composer-flight-message.composer-flight-target{
    opacity:1 !important;
  }
}

/* textcolor: — synchronized bubble text color */
html.for314-textcolor-active .chatlog .message-bubble,
html.for314-textcolor-active .chatlog .message-bubble *{
  color:var(--for314-chat-text-color) !important;
  -webkit-text-fill-color:currentColor !important;
}

/* bubblecolor: — synchronized bubble background with automatic contrast */
html.for314-bubblecolor-active .chatlog .message-bubble:not(.slide-lock-bubble):not(.youtube-bubble){
  background:var(--for314-chat-bubble-color) !important;
  background-color:var(--for314-chat-bubble-color) !important;
}
html.for314-bubblecolor-active:not(.for314-textcolor-active) .chatlog .message-bubble:not(.slide-lock-bubble):not(.youtube-bubble),
html.for314-bubblecolor-active:not(.for314-textcolor-active) .chatlog .message-bubble:not(.slide-lock-bubble):not(.youtube-bubble) *{
  color:var(--for314-chat-bubble-auto-text) !important;
  -webkit-text-fill-color:currentColor !important;
}

/* /chatclear — 90%承認が必要な赤い全削除投票 */
.chat-clear-vote-card{
  align-self:center;
  box-sizing:border-box;
  width:min(100%,640px);
  padding:12px;
  border:2px solid #fca5a5;
  border-radius:12px;
  background:linear-gradient(145deg,#991b1b,#7f1d1d 58%,#450a0a);
  color:#fff !important;
  box-shadow:0 8px 22px rgba(127,29,29,.4);
}
.chat-clear-vote-head{display:flex;align-items:center;justify-content:space-between;gap:7px;font-size:12px;font-weight:950}
.chat-clear-vote-timer{
  flex:0 0 auto;min-width:43px;padding:3px 6px;border:1px solid rgba(255,255,255,.62);
  border-radius:999px;background:rgba(69,10,10,.74);color:#fff !important;
  text-align:center;font-size:9px;font-weight:900;font-variant-numeric:tabular-nums;
}
.chat-clear-vote-description{margin:7px 0 9px;color:#fee2e2 !important;font-size:10px;line-height:1.45;font-weight:750}
.chat-clear-vote-choices{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.chat-clear-vote-choice{
  display:flex !important;align-items:center !important;justify-content:space-between !important;
  min-width:0;min-height:35px;padding:0 8px !important;border:1px solid rgba(255,255,255,.7) !important;
  border-radius:8px !important;background:rgba(69,10,10,.58) !important;color:#fff !important;
  -webkit-text-fill-color:#fff !important;font-size:11px;font-weight:950;cursor:pointer;
}
.chat-clear-vote-choice.selected{
  background:#fff !important;color:#7f1d1d !important;-webkit-text-fill-color:#7f1d1d !important;
  border-color:#fff !important;box-shadow:0 0 0 2px rgba(255,255,255,.22);
}
.chat-clear-vote-choice:disabled{cursor:default;opacity:.56}
.chat-clear-vote-count{
  display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 4px;
  border-radius:999px;background:rgba(255,255,255,.18);font-size:9px;font-variant-numeric:tabular-nums;
}
.chat-clear-vote-choice.selected .chat-clear-vote-count{background:#fee2e2}
.chat-clear-vote-track{height:6px;margin-top:9px;overflow:hidden;border-radius:999px;background:rgba(255,255,255,.2)}
.chat-clear-vote-progress{width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#fecaca,#fff);transition:width .28s ease}
.chat-clear-vote-status{margin-top:6px;color:#fff !important;font-size:9px;line-height:1.35;font-weight:850}
.chat-clear-vote-card.closed{filter:saturate(.72)}
body.local-light .chat-clear-vote-card{
  border-color:#b91c1c !important;background:linear-gradient(145deg,#dc2626,#991b1b 62%,#7f1d1d) !important;color:#fff !important;
}
body.local-light .chat-clear-vote-choice{
  border-color:#fff!important;background:#fff!important;color:#7f1d1d!important;-webkit-text-fill-color:#7f1d1d!important;
}
body.local-light .chat-clear-vote-choice.selected{
  border-color:#fecaca!important;background:#fee2e2!important;color:#7f1d1d!important;-webkit-text-fill-color:#7f1d1d!important;
}
body.local-light .chat-clear-vote-count{
  background:#fee2e2!important;color:#7f1d1d!important;-webkit-text-fill-color:#7f1d1d!important;
}
@media(max-width:230px){
  .chat-clear-vote-card{padding:8px;border-radius:9px}
  .chat-clear-vote-head{font-size:10px}
  .chat-clear-vote-description{font-size:9px}
  .chat-clear-vote-choice{min-height:31px;padding:0 6px !important;font-size:10px}
}

/* oproom: — 5分間だけ表示できるルーム移動リンク */
.open-room-invite-card{
  align-self:center;box-sizing:border-box;width:min(100%,640px);padding:10px;
  border:1px solid #60a5fa;border-radius:10px;
  background:linear-gradient(145deg,#102a4b,#13213a 62%,#101827);color:#f8fafc;
  box-shadow:0 7px 18px rgba(15,23,42,.22);transition:opacity .22s ease,transform .22s ease;
}
.open-room-invite-card.is-expiring{opacity:0;transform:translateY(-4px) scale(.985)}
.open-room-invite-head{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:10px;font-weight:950}
.open-room-invite-timer{
  flex:0 0 auto;min-width:40px;padding:2px 5px;border:1px solid rgba(147,197,253,.7);
  border-radius:999px;background:rgba(15,23,42,.58);color:#dbeafe;text-align:center;
  font-size:8px;font-weight:900;font-variant-numeric:tabular-nums;
}
.open-room-invite-from{margin-top:5px;color:#bfdbfe;font-size:8px;line-height:1.35;font-weight:750}
.open-room-invite-room{
  margin:6px 0;padding:6px 7px;border:1px solid rgba(147,197,253,.42);border-radius:7px;
  background:rgba(15,23,42,.58);color:#fff;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:9px;line-height:1.35;font-weight:850;overflow-wrap:anywhere;
}
.open-room-invite-link{
  box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;min-height:31px;padding:0 7px;
  border:1px solid #93c5fd;border-radius:7px;background:#2563eb;color:#fff !important;
  appearance:none;-webkit-appearance:none;-webkit-text-fill-color:#fff !important;font-family:inherit;
  font-size:9px;font-weight:900;text-align:center;text-decoration:none;cursor:pointer;
}
.open-room-invite-note{margin-top:5px;color:#93c5fd;font-size:8px;line-height:1.3;font-weight:750;text-align:right}
body.local-light .open-room-invite-card{
  border-color:#2563eb !important;background:#fff !important;color:#111827 !important;
  box-shadow:0 7px 18px rgba(37,99,235,.14) !important;
}
body.local-light .open-room-invite-from{color:#1e3a8a !important}
body.local-light .open-room-invite-timer{border-color:#2563eb !important;background:#eff6ff !important;color:#1e3a8a !important}
body.local-light .open-room-invite-room{border-color:#93c5fd !important;background:#eff6ff !important;color:#111827 !important}
body.local-light .open-room-invite-note{color:#1d4ed8 !important}
@media(max-width:230px){
  .open-room-invite-card{padding:7px;border-radius:8px}
  .open-room-invite-head{font-size:9px}
  .open-room-invite-link{min-height:28px;font-size:8px}
}

.open-room-invite-card.is-locked{
  border-color:#c084fc;background:linear-gradient(145deg,#32165b,#21153f 62%,#171329);
  box-shadow:0 7px 18px rgba(88,28,135,.3);
}
.open-room-invite-card.is-locked .open-room-invite-timer{border-color:#d8b4fe;color:#f3e8ff}
.open-room-invite-card.is-locked .open-room-invite-from{color:#e9d5ff}
.open-room-invite-card.is-locked .open-room-invite-room{
  border-color:rgba(216,180,254,.44);background:rgba(46,16,101,.42);color:#f3e8ff;font-family:inherit;
}
.open-room-invite-card.is-locked .open-room-invite-link{border-color:#d8b4fe;background:#7e22ce}
.open-room-invite-card.is-locked .open-room-invite-note{color:#d8b4fe}
body.local-light .open-room-invite-card.is-locked{
  border-color:#9333ea!important;background:#faf5ff!important;box-shadow:0 7px 18px rgba(126,34,206,.15)!important;
}
body.local-light .open-room-invite-card.is-locked .open-room-invite-from{color:#581c87!important}
body.local-light .open-room-invite-card.is-locked .open-room-invite-timer{border-color:#9333ea!important;background:#f3e8ff!important;color:#581c87!important}
body.local-light .open-room-invite-card.is-locked .open-room-invite-room{border-color:#c084fc!important;background:#f3e8ff!important;color:#3b0764!important}
body.local-light .open-room-invite-card.is-locked .open-room-invite-link{
  border-color:#7e22ce!important;background:#7e22ce!important;color:#fff!important;-webkit-text-fill-color:#fff!important;
}
body.local-light .open-room-invite-card.is-locked .open-room-invite-note{color:#7e22ce!important}
.open-room-invite-card.is-expired{border-color:#64748b;background:#1e293b;color:#e2e8f0;box-shadow:none}
.open-room-invite-card.is-expired .open-room-invite-from,.open-room-invite-card.is-expired .open-room-invite-note{color:#94a3b8}
.open-room-invite-card.is-expired .open-room-invite-timer,.open-room-invite-card.is-expired .open-room-invite-room{
  border-color:#64748b;background:#0f172a;color:#cbd5e1;
}
.open-room-invite-card.is-expired .open-room-invite-link{
  border-color:#64748b;background:#475569;cursor:default;pointer-events:none;
}
body.local-light .open-room-invite-card.is-expired{
  border-color:#94a3b8!important;background:#f1f5f9!important;color:#475569!important;box-shadow:none!important;
}
body.local-light .open-room-invite-card.is-expired .open-room-invite-from,
body.local-light .open-room-invite-card.is-expired .open-room-invite-note{color:#64748b!important}
body.local-light .open-room-invite-card.is-expired .open-room-invite-timer,
body.local-light .open-room-invite-card.is-expired .open-room-invite-room{
  border-color:#cbd5e1!important;background:#e2e8f0!important;color:#475569!important;
}
body.local-light .open-room-invite-card.is-expired .open-room-invite-link{
  border-color:#94a3b8!important;background:#94a3b8!important;color:#fff!important;
}

/* oproom: 招待リンクのパスワード設定・表示ロック */
.open-room-password-backdrop{
  position:fixed;inset:0;z-index:2147483400;display:flex;align-items:center;justify-content:center;
  box-sizing:border-box;padding:7px;visibility:hidden;opacity:0;pointer-events:none;
  background:rgba(2,6,23,.74);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
  transition:opacity .2s ease,visibility 0s linear .2s;
}
.open-room-password-backdrop.open{visibility:visible;opacity:1;pointer-events:auto;transition-delay:0s}
.open-room-password-card{
  box-sizing:border-box;width:min(96vw,350px);max-height:94vh;overflow:auto;padding:11px;
  border:1px solid #7e22ce;border-radius:11px;background:#111827;color:#f8fafc;
  box-shadow:0 18px 46px rgba(0,0,0,.48);opacity:0;transform:translateY(8px) scale(.975);
  transition:opacity .2s ease,transform .24s cubic-bezier(.2,.82,.25,1);
}
.open-room-password-backdrop.open .open-room-password-card{opacity:1;transform:translateY(0) scale(1)}
.open-room-password-eyebrow{color:#d8b4fe;font-size:7px;line-height:1.3;font-weight:950;letter-spacing:.03em}
.open-room-password-title{margin:3px 0 0;color:inherit;font-size:11px;line-height:1.4;font-weight:1000}
.open-room-password-message{margin:5px 0 0;color:#dbe4f0;font-size:8px;line-height:1.5;font-weight:700}
.open-room-password-body{margin-top:7px}
.open-room-password-room,.open-room-password-unlocked{
  display:grid;gap:2px;padding:6px 7px;border:1px solid rgba(216,180,254,.5);
  border-radius:7px;background:rgba(88,28,135,.22);
}
.open-room-password-room span,.open-room-password-unlocked span{color:#e9d5ff;font-size:6px;font-weight:900}
.open-room-password-room strong,.open-room-password-unlocked strong{
  color:#fff;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:8px;line-height:1.35;font-weight:900;overflow-wrap:anywhere;
}
.open-room-password-choice{display:grid;grid-template-columns:1fr;gap:5px;margin-top:8px}
.open-room-password-choice button,.open-room-password-form-actions button,.open-room-password-actions button,
.open-room-password-generate,.open-room-password-unlock{
  appearance:none;-webkit-appearance:none;min-height:29px;padding:0 6px;border:1px solid #64748b;
  border-radius:7px;background:#263348;color:#fff;font-size:8px;line-height:1.25;font-weight:950;cursor:pointer;
}
.open-room-password-choice .open-room-password-yes,.open-room-password-send,
.open-room-password-unlock,.open-room-password-open{border-color:#a855f7;background:#7e22ce}
.open-room-password-form{display:grid;gap:6px;margin-top:7px}
.open-room-password-form[hidden],.open-room-password-choice[hidden],.open-room-entry-form[hidden],
.open-room-password-unlocked[hidden],.open-room-password-open[hidden]{display:none!important}
.open-room-password-label{display:grid;gap:3px;color:#e2e8f0;font-size:7px;line-height:1.35;font-weight:900}
.open-room-password-input{
  box-sizing:border-box;width:100%;height:29px;padding:0 6px;border:1px solid #64748b;border-radius:7px;
  outline:none;background:#0b1220;color:#fff;-webkit-text-fill-color:#fff;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:9px;font-weight:800;
}
.open-room-password-input:focus{border-color:#c084fc;box-shadow:0 0 0 2px rgba(192,132,252,.2)}
.open-room-password-tools{display:grid;gap:4px}
.open-room-password-generate{min-height:25px!important;font-size:7px!important}
.open-room-password-reveal{display:inline-flex;align-items:center;gap:3px;color:#dbe4f0;font-size:7px;font-weight:850}
.open-room-password-hint{
  padding:6px 7px;border:1px solid rgba(251,191,36,.5);border-radius:7px;
  background:rgba(120,53,15,.25);color:#fde68a;font-size:7px;line-height:1.45;font-weight:750;
}
.open-room-password-form-actions,.open-room-password-actions{display:grid;grid-template-columns:1fr;gap:5px;margin-top:3px}
.open-room-password-actions{margin-top:8px}
.open-room-password-status{
  margin-top:6px;padding:5px 6px;border:1px solid rgba(74,222,128,.48);border-radius:7px;
  background:rgba(20,83,45,.28);color:#bbf7d0;white-space:pre-wrap;font-size:7px;line-height:1.45;font-weight:850;
}
.open-room-password-status[hidden]{display:none!important}
.open-room-password-status.is-error{border-color:rgba(248,113,113,.6);background:rgba(127,29,29,.3);color:#fecaca}
.open-room-password-timer{margin-bottom:6px;color:#d8b4fe;font-size:7px;line-height:1.35;font-weight:900;text-align:center}
.open-room-entry-form{display:grid;gap:6px}
.open-room-password-unlocked{margin-top:3px}
.open-room-password-actions .open-room-password-open{color:#fff;-webkit-text-fill-color:#fff}
.open-room-password-actions button:only-child{grid-column:1/-1}
.open-room-password-card button:disabled,.open-room-password-card input:disabled{opacity:.5;cursor:default}
.open-room-password-card button:focus-visible{outline:2px solid rgba(216,180,254,.68);outline-offset:1px}
body.local-light .open-room-password-card{border-color:#9333ea!important;background:#fff!important;color:#111827!important}
body.local-light .open-room-password-eyebrow{color:#7e22ce!important}
body.local-light .open-room-password-message,body.local-light .open-room-password-label,
body.local-light .open-room-password-reveal{color:#334155!important}
body.local-light .open-room-password-room,body.local-light .open-room-password-unlocked{border-color:#c084fc!important;background:#faf5ff!important}
body.local-light .open-room-password-room span,body.local-light .open-room-password-unlocked span{color:#7e22ce!important}
body.local-light .open-room-password-room strong,body.local-light .open-room-password-unlocked strong{color:#111827!important}
body.local-light .open-room-password-input{border-color:#aab3bd!important;background:#fff!important;color:#111!important;-webkit-text-fill-color:#111!important}
body.local-light .open-room-password-no,body.local-light .open-room-password-back,
body.local-light .open-room-password-close,body.local-light .open-room-password-generate{
  border-color:#aab3bd!important;background:#eef1f4!important;color:#111!important;
}
body.local-light .open-room-password-hint{border-color:#d97706!important;background:#fffbeb!important;color:#78350f!important}
body.local-light .open-room-password-status{border-color:#16a34a!important;background:#f0fdf4!important;color:#166534!important}
body.local-light .open-room-password-status.is-error{border-color:#dc2626!important;background:#fef2f2!important;color:#991b1b!important}
body.local-light .open-room-password-timer{color:#7e22ce!important}
@media(prefers-reduced-motion:reduce){.open-room-password-backdrop,.open-room-password-card{transition:none!important}}


/* === FOR314 Cloudflare room password auth v1 (WID) === */
.cf-room-auth-backdrop{
  position:fixed;
  inset:0;
  z-index:2147483000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px;
  background:rgba(5,8,14,.46);
  -webkit-backdrop-filter:blur(14px) saturate(1.18);
  backdrop-filter:blur(14px) saturate(1.18);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .16s ease,visibility .16s ease;
}
.cf-room-auth-backdrop.open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}
.cf-room-auth-modal{
  box-sizing:border-box;
  width:min(340px,calc(100vw - 12px));
  max-height:calc(100vh - 12px);
  overflow:auto;
  border:1px solid rgba(255,255,255,.22);
  border-radius:15px;
  padding:13px;
  background:linear-gradient(145deg,rgba(30,34,44,.88),rgba(12,15,22,.76));
  box-shadow:0 16px 46px rgba(0,0,0,.34);
  -webkit-backdrop-filter:blur(20px) saturate(1.25);
  backdrop-filter:blur(20px) saturate(1.25);
  color:#fff;
}
.cf-room-auth-title{
  font-size:14px;
  font-weight:800;
}
.cf-room-auth-room{
  margin-top:5px;
  font:600 10px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace;
  opacity:.72;
  overflow-wrap:anywhere;
}
.cf-room-auth-desc{
  margin-top:9px;
  font-size:11px;
  line-height:1.45;
  opacity:.88;
}
.cf-room-auth-input{
  box-sizing:border-box;
  width:100%;
  height:36px;
  margin-top:10px;
  padding:0 10px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:10px;
  background:rgba(255,255,255,.10);
  color:#fff;
  font:inherit;
  outline:none;
}
.cf-room-auth-error{
  min-height:15px;
  margin-top:5px;
  font-size:10px;
  color:#ffd2d2;
}
.cf-room-auth-actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:6px;
  margin-top:6px;
}
.cf-room-auth-actions button{
  min-height:32px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:9px;
  padding:0 9px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font:inherit;
  font-size:10px;
  font-weight:700;
}
.cf-room-auth-enter{
  background:rgba(255,255,255,.23)!important;
}
body.local-light .cf-room-auth-backdrop{
  background:rgba(225,230,238,.42);
}
body.local-light .cf-room-auth-modal{
  border-color:rgba(0,0,0,.10);
  background:linear-gradient(145deg,rgba(255,255,255,.94),rgba(245,247,251,.82));
  color:#111;
}
body.local-light .cf-room-auth-input{
  border-color:rgba(0,0,0,.14);
  background:rgba(255,255,255,.84);
  color:#111;
}
body.local-light .cf-room-auth-error{
  color:#a72525;
}
body.local-light .cf-room-auth-actions button{
  border-color:rgba(0,0,0,.12);
  background:rgba(255,255,255,.78);
  color:#111;
}
body.local-light .cf-room-auth-enter{
  background:rgba(225,229,238,.96)!important;
}
@media(max-width:230px){
  .cf-room-auth-backdrop{padding:5px}
  .cf-room-auth-modal{width:100%;padding:10px;border-radius:11px}
  .cf-room-auth-actions{display:grid;grid-template-columns:1fr 1fr}
  .cf-room-auth-actions button{padding:0 5px}
}


    /* Global room marker: room ID "room" only */
    .global-room-icon{
      flex:0 0 auto;
      width:14px;
      height:14px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      color:#6ea8ff;
      vertical-align:middle;
    }
    .global-room-icon[hidden]{display:none!important}
    .global-room-icon svg{
      width:100%;
      height:100%;
      display:block;
      fill:none;
      stroke:currentColor;
      stroke-width:1.75;
      stroke-linecap:round;
      stroke-linejoin:round;
    }
    body.local-light .global-room-icon{color:#245a91}


/* Toast priority/time v3 — WID */
#toastLayer{z-index:2147483647 !important;}
.chat-toast{animation:toastIn .18s ease-out, toastOut .22s ease-in 4.1s forwards !important;}

/* FOR314 command categories v1 */
#commandModalBackdrop .command-category{
  display:flex;
  align-items:center;
  gap:9px;
  margin:8px 2px 0;
  padding:4px 3px 2px;
  color:#b8c7ff;
  font-size:11px;
  line-height:1.2;
  font-weight:900;
  letter-spacing:.045em;
}
#commandModalBackdrop .command-category:first-child{margin-top:0}
#commandModalBackdrop .command-category::after{
  content:"";
  flex:1;
  height:1px;
  background:linear-gradient(90deg,rgba(184,199,255,.5),rgba(184,199,255,0));
}
body.local-light #commandModalBackdrop .command-category{color:#52657c !important}
body.local-light #commandModalBackdrop .command-category::after{
  background:linear-gradient(90deg,rgba(82,101,124,.35),rgba(82,101,124,0));
}
@media(max-width:300px){
  #commandModalBackdrop .command-category{font-size:9px;margin-top:5px;padding-top:3px;gap:6px}
}


/* ===== for314 transport badge: Cloudflare / Achex ===== */
.transport-badge{
  display:inline-flex;
  align-items:center;
  gap:3px;
  flex:0 0 auto;
  min-width:34px;
  height:18px;
  padding:0 5px 0 4px;
  border:1px solid rgba(148,163,184,.28);
  border-radius:999px;
  background:rgba(15,23,42,.42);
  color:#c7d2fe;
  font-size:9px;
  line-height:1;
  font-weight:800;
  letter-spacing:.04em;
  vertical-align:middle;
  opacity:.94;
}
.transport-signal-icon{
  width:12px;
  height:12px;
  display:block;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.transport-signal-icon circle{fill:currentColor;stroke:none}
.transport-badge[data-transport="achex"]{color:#86efac;border-color:rgba(134,239,172,.30)}
.transport-badge[data-transport="cloudflare"]{color:#93c5fd;border-color:rgba(147,197,253,.30)}
.transport-badge[data-transport="achex"].is-connecting,
.transport-badge[data-transport="cloudflare"].is-connecting{
  color:#fbbf24;
  border-color:rgba(251,191,36,.36);
}
.transport-badge.is-connecting{
  opacity:.94;
  color:#fbbf24;
  border-color:rgba(251,191,36,.36);
  background:rgba(66,47,5,.36);
}

.transport-offline-x{display:none}
.transport-badge[data-transport="offline"]{
  min-width:26px;
  padding:0 4px;
  color:#fb4b4b;
  border-color:rgba(251,75,75,.42);
  background:rgba(69,10,10,.42);
}
.transport-badge[data-transport="offline"] .transport-offline-x{display:block;stroke-width:2.6}
.transport-badge[data-transport="offline"] .transport-badge-label{display:none}
body.local-light .transport-badge[data-transport="offline"]{
  color:#d81f2a;
  border-color:rgba(216,31,42,.30);
  background:rgba(255,240,241,.88);
}

body.local-light .transport-badge{
  background:rgba(255,255,255,.58);
  color:#245a91;
  border-color:rgba(36,90,145,.20);
}
body.local-light .transport-badge[data-transport="achex"]{color:#16803f;border-color:rgba(22,128,63,.22)}
body.local-light .transport-badge.is-connecting{
  color:#a16207;
  border-color:rgba(161,98,7,.28);
  background:rgba(255,251,235,.88);
}
@media(max-width:520px){
  .transport-badge{height:17px;min-width:31px;padding:0 4px;font-size:8px;gap:2px}
  .transport-signal-icon{width:11px;height:11px}
}


/* ---------- /speedtest card ---------- */
.message.speedtest-message{max-width:min(94%,430px)}
.message.speedtest-message .speedtest-bubble{
  width:min(100%,380px);
  box-sizing:border-box;
  padding:13px 14px;
  white-space:normal;
  overflow:visible;
  border:1px solid rgba(255,255,255,.13);
  background:linear-gradient(145deg,rgba(30,38,54,.96),rgba(19,25,37,.96));
  color:#f6f8fc;
  box-shadow:0 10px 28px rgba(0,0,0,.16);
}
.message.mine.speedtest-message .speedtest-bubble{
  background:linear-gradient(145deg,rgba(37,79,145,.98),rgba(31,61,112,.98));
}
.speedtest-head{display:flex;align-items:center;gap:8px;font-size:15px;line-height:1.25}
.speedtest-signal-icon{width:21px;height:21px;flex:none;color:#8cc9ff}
.message.mine .speedtest-signal-icon{color:#d5ebff}
.speedtest-divider{height:1px;background:rgba(255,255,255,.14);margin:10px 0}
.speedtest-owner{font-weight:700;font-size:13px;margin-bottom:8px}
.speedtest-metrics{display:grid;gap:4px;font-variant-numeric:tabular-nums}
.speedtest-metric-row,.speedtest-use-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-width:0}
.speedtest-metric-row{font-size:12.5px;line-height:1.45}
.speedtest-metric-row span{opacity:.78}
.speedtest-metric-row strong{font-weight:700;white-space:nowrap}
.speedtest-uses{display:grid;gap:5px;margin-top:12px;padding-top:10px;border-top:1px dashed rgba(255,255,255,.13)}
.speedtest-use-row{font-size:12.5px}
.speedtest-use-row span{opacity:.9}
.speedtest-use-row strong{font-weight:700;white-space:nowrap}
.speedtest-overall{display:flex;align-items:baseline;gap:4px;font-size:14px}
.speedtest-overall strong{font-size:17px;letter-spacing:.01em}
.speedtest-progress{padding:8px 0 2px;font-size:13px;font-weight:700}
.speedtest-progress::before{content:'●';display:inline-block;margin-right:7px;animation:speedtestPulse .9s ease-in-out infinite alternate;opacity:.55}
.speedtest-progress-failed{line-height:1.55;font-weight:650}
.speedtest-progress-failed::before{content:'⚠️';animation:none;opacity:1}
@keyframes speedtestPulse{from{transform:scale(.75);opacity:.35}to{transform:scale(1);opacity:1}}
body.local-light .message.speedtest-message .speedtest-bubble{
  background:linear-gradient(145deg,rgba(255,255,255,.98),rgba(242,246,252,.98));
  border-color:rgba(26,41,64,.14);
  color:#182033;
  box-shadow:0 8px 24px rgba(25,45,76,.10);
}
body.local-light .message.mine.speedtest-message .speedtest-bubble{
  background:linear-gradient(145deg,rgba(68,119,194,.98),rgba(47,91,158,.98));
  color:#fff;
}
body.local-light .message:not(.mine).speedtest-message .speedtest-signal-icon{color:#2875c7}
@media(max-width:300px){
  .message.speedtest-message{max-width:100%}
  .message.speedtest-message .speedtest-bubble{width:100%;padding:9px 10px}
  .speedtest-head{font-size:12px;gap:5px}
  .speedtest-signal-icon{width:17px;height:17px}
  .speedtest-owner,.speedtest-metric-row,.speedtest-use-row,.speedtest-progress{font-size:10px}
  .speedtest-metric-row,.speedtest-use-row{gap:6px}
  .speedtest-overall{font-size:11px}.speedtest-overall strong{font-size:13px}
  .speedtest-divider{margin:7px 0}.speedtest-uses{margin-top:8px;padding-top:7px;gap:3px}
}


/* ---------- /speedtest light-mode readability fix v2 ---------- */
body.local-light main .message:not(.mine).speedtest-message .speedtest-bubble,
body.local-light main .message:not(.mine).speedtest-message .speedtest-bubble *{
  color:#182033 !important;
}
body.local-light main .message:not(.mine).speedtest-message .speedtest-signal-icon{
  color:#2875c7 !important;
}
body.local-light main .message:not(.mine).speedtest-message .speedtest-divider{
  background:rgba(24,32,51,.16) !important;
}
body.local-light main .message:not(.mine).speedtest-message .speedtest-uses{
  border-top-color:rgba(24,32,51,.16) !important;
}
body.local-light main .message:not(.mine).speedtest-message .speedtest-metric-row span,
body.local-light main .message:not(.mine).speedtest-message .speedtest-use-row span{
  color:#49566c !important;
}
body.local-light main .message:not(.mine).speedtest-message .speedtest-metric-row strong,
body.local-light main .message:not(.mine).speedtest-message .speedtest-use-row strong,
body.local-light main .message:not(.mine).speedtest-message .speedtest-overall,
body.local-light main .message:not(.mine).speedtest-message .speedtest-overall strong,
body.local-light main .message:not(.mine).speedtest-message .speedtest-owner,
body.local-light main .message:not(.mine).speedtest-message .speedtest-head{
  color:#111827 !important;
}


/* FOR314 typing indicator v1 */
.inputrow{
  position:relative!important;
}
.inputrow .for314-typing-indicator{
  position:absolute;
  left:10px;
  right:78px;
  bottom:0;
  z-index:12;
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  pointer-events:none;
  user-select:none;
  -webkit-user-select:none;
  font-size:7.5px;
  font-weight:650;
  line-height:8px;
  color:rgba(214,224,239,.66);
  text-shadow:0 1px 2px rgba(0,0,0,.26);
}
.inputrow .for314-typing-indicator[hidden]{display:none!important}
body.local-light .inputrow .for314-typing-indicator{
  color:rgba(64,78,96,.62);
  text-shadow:0 1px 0 rgba(255,255,255,.72);
}
@media(max-width:300px){
  .inputrow .for314-typing-indicator{left:7px;right:66px;font-size:6.8px;line-height:7px}
}
@media(max-width:210px){
  .inputrow .for314-typing-indicator{left:6px;right:60px;font-size:6.2px;line-height:7px}
}


/* ---------- /superchat : free color-message card v1 ---------- */
.superchat-message{
  width:100%;
  max-width:100%!important;
  display:flex!important;
  justify-content:center!important;
  padding:4px 0 8px!important;
}
.superchat-message .superchat-content{
  width:min(100%,520px);
  max-width:520px!important;
  margin:0!important;
}
.superchat-card{
  --sc-head:#1f6fc1;
  --sc-body:#2d82d4;
  --sc-text:#fff;
  width:100%;
  overflow:hidden;
  border-radius:14px;
  color:var(--sc-text);
  background:var(--sc-body);
  box-shadow:0 7px 22px rgba(0,0,0,.18),inset 0 0 0 1px rgba(255,255,255,.14);
  text-align:left;
  isolation:isolate;
}
.superchat-tier-blue{--sc-head:#216bc0;--sc-body:#2b7fd0;--sc-text:#fff}
.superchat-tier-cyan{--sc-head:#08b8cc;--sc-body:#17d0e1;--sc-text:#071a20}
.superchat-tier-green{--sc-head:#10bca5;--sc-body:#27d9b9;--sc-text:#07231d}
.superchat-tier-yellow{--sc-head:#ffb300;--sc-body:#ffc72c;--sc-text:#241800}
.superchat-tier-orange{--sc-head:#ef5900;--sc-body:#ff7900;--sc-text:#fff}
.superchat-tier-magenta{--sc-head:#c2185b;--sc-body:#ec1763;--sc-text:#fff}
.superchat-tier-red{--sc-head:#df0000;--sc-body:#ef231b;--sc-text:#fff}
.superchat-card-head{
  min-height:78px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 15px;
  background:var(--sc-head);
}
.superchat-avatar{
  width:54px;
  height:54px;
  flex:0 0 54px;
  border-radius:50%;
  overflow:hidden;
  display:grid;
  place-items:center;
  background:rgba(0,0,0,.68);
  color:#fff;
  font-weight:900;
  font-size:22px;
  box-shadow:0 0 0 1px rgba(255,255,255,.18);
}
.superchat-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.superchat-card-info{min-width:0;flex:1}
.superchat-card-name{
  font-size:15px;
  line-height:1.2;
  font-weight:800;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.superchat-card-amount{
  margin-top:4px;
  font-size:20px;
  line-height:1.05;
  font-weight:900;
  font-variant-numeric:tabular-nums;
}
.superchat-card-time{
  align-self:flex-start;
  padding-top:2px;
  font-size:10px;
  font-weight:700;
  opacity:.7;
  white-space:nowrap;
}
.superchat-card-body{
  min-height:58px;
  display:flex;
  align-items:center;
  padding:14px 16px 16px;
  background:var(--sc-body);
  color:var(--sc-text);
  font-size:18px;
  line-height:1.45;
  font-weight:750;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.superchat-message .message-action-row.superchat-action-row{padding:4px 5px 0}
.superchat-message.mine .superchat-card{box-shadow:0 8px 24px rgba(0,0,0,.2),0 0 0 2px rgba(255,255,255,.10)}
.superchat-tier-magenta,.superchat-tier-red{position:relative}
.superchat-tier-magenta::after,.superchat-tier-red::after{
  content:'';
  position:absolute;
  inset:-35% auto -35% -45%;
  width:34%;
  transform:skewX(-18deg);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.16),transparent);
  pointer-events:none;
  animation:for314SuperChatShine 1.15s ease-out 1;
}
@keyframes for314SuperChatShine{to{left:120%}}

.superchat-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:2147482500;
  display:grid;
  place-items:center;
  padding:16px;
  background:rgba(7,12,22,.48);
  -webkit-backdrop-filter:blur(13px);
  backdrop-filter:blur(13px);
}
.superchat-modal-backdrop[hidden]{display:none!important}
.superchat-modal{
  width:min(94vw,460px);
  max-height:min(88vh,760px);
  overflow:auto;
  padding:18px;
  border:1px solid rgba(255,255,255,.28);
  border-radius:24px;
  background:linear-gradient(145deg,rgba(27,35,50,.91),rgba(20,27,39,.83));
  color:#f7f9fc;
  box-shadow:0 28px 80px rgba(0,0,0,.42);
  -webkit-backdrop-filter:blur(24px) saturate(1.2);
  backdrop-filter:blur(24px) saturate(1.2);
}
body.local-light .superchat-modal{
  background:linear-gradient(145deg,rgba(250,252,255,.94),rgba(233,238,245,.91));
  border-color:rgba(255,255,255,.78);
  color:#172033;
  box-shadow:0 24px 70px rgba(27,40,62,.24);
}
.superchat-modal-head{display:flex;align-items:flex-start;gap:14px;justify-content:space-between}
.superchat-modal-head h2{margin:0;font-size:22px;line-height:1.15;font-weight:900}
.superchat-modal-head p{margin:5px 0 0;font-size:12px;line-height:1.4;opacity:.68}
.superchat-modal-close{
  width:44px;height:44px;flex:0 0 44px;border-radius:14px;border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.08);color:inherit;font-size:30px;line-height:1;cursor:pointer;
}
body.local-light .superchat-modal-close{background:rgba(66,78,96,.07);border-color:rgba(40,55,78,.12)}
.superchat-free-note{
  margin-top:14px;padding:9px 11px;border-radius:12px;background:rgba(255,255,255,.07);
  font-size:11px;line-height:1.35;font-weight:700;opacity:.86;
}
body.local-light .superchat-free-note{background:rgba(49,70,101,.07)}
.superchat-field-label{display:flex;justify-content:space-between;gap:10px;margin:16px 2px 8px;font-size:12px;font-weight:800;opacity:.82}
.superchat-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.superchat-preset{
  min-height:42px;padding:7px 4px;border:0;border-radius:11px;background:var(--sc-head);color:var(--sc-text);
  font-size:13px;font-weight:900;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(255,255,255,.16);
}
.superchat-preset.selected{outline:3px solid rgba(255,255,255,.93);outline-offset:1px;transform:translateY(-1px)}
body.local-light .superchat-preset.selected{outline-color:#182033}
.superchat-custom-row{
  display:flex;align-items:center;gap:8px;margin-top:9px;padding:0 12px;border-radius:12px;
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);font-weight:900;
}
body.local-light .superchat-custom-row{background:rgba(255,255,255,.72);border-color:rgba(46,63,89,.12)}
.superchat-custom-row input{
  width:100%;height:42px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-weight:800;
}
.superchat-message-input{
  width:100%;min-height:82px;resize:vertical;box-sizing:border-box;border-radius:13px;padding:11px 12px;
  border:1px solid rgba(255,255,255,.13);outline:none;background:rgba(255,255,255,.08);color:inherit;
  font:inherit;font-size:14px;line-height:1.5;
}
.superchat-message-input:focus,.superchat-custom-row:focus-within{border-color:rgba(110,181,255,.82);box-shadow:0 0 0 3px rgba(71,151,239,.16)}
body.local-light .superchat-message-input{background:rgba(255,255,255,.76);border-color:rgba(46,63,89,.13)}
.superchat-preview-label{margin-top:13px}
.superchat-modal-preview{min-height:118px;display:flex;align-items:center}
.superchat-preview-card{box-shadow:none}
.superchat-preview-card .superchat-card-head{min-height:64px;padding:9px 12px}
.superchat-preview-card .superchat-avatar{width:44px;height:44px;flex-basis:44px;font-size:18px}
.superchat-preview-card .superchat-card-body{min-height:44px;padding:10px 13px 12px;font-size:15px}
.superchat-modal-actions{display:grid;grid-template-columns:1fr 1.4fr;gap:9px;margin-top:15px}
.superchat-modal-actions button{min-height:46px;border-radius:14px;font-size:14px;font-weight:900;cursor:pointer}
.superchat-cancel{border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.07);color:inherit}
.superchat-send{border:0;background:#1677ff;color:#fff;box-shadow:0 7px 18px rgba(22,119,255,.26)}
body.local-light .superchat-cancel{border-color:rgba(44,61,86,.12);background:rgba(255,255,255,.7)}

@media(max-width:520px){
  .superchat-message{padding-inline:2px!important}
  .superchat-message .superchat-content{width:100%}
  .superchat-card{border-radius:12px}
  .superchat-card-head{min-height:68px;padding:10px 12px;gap:10px}
  .superchat-avatar{width:48px;height:48px;flex-basis:48px;font-size:19px}
  .superchat-card-name{font-size:14px}.superchat-card-amount{font-size:18px}
  .superchat-card-body{min-height:50px;padding:12px 13px 14px;font-size:16px}
  .superchat-modal-backdrop{padding:10px}
  .superchat-modal{width:min(96vw,460px);padding:16px;border-radius:21px}
}
@media(max-width:330px){
  .superchat-presets{grid-template-columns:repeat(2,minmax(0,1fr))}
  .superchat-modal-head h2{font-size:18px}
  .superchat-modal{padding:12px;border-radius:17px}
  .superchat-card-head{min-height:58px;padding:8px;gap:8px}
  .superchat-avatar{width:38px;height:38px;flex-basis:38px;font-size:15px}
  .superchat-card-name{font-size:11px}.superchat-card-amount{font-size:15px}.superchat-card-time{font-size:8px}
  .superchat-card-body{min-height:40px;padding:9px 10px;font-size:13px}
  .superchat-modal-actions{grid-template-columns:1fr}
}
@media(max-width:220px){
  .superchat-modal-backdrop{padding:4px}
  .superchat-modal{width:calc(100vw - 8px);padding:9px;border-radius:13px}
  .superchat-modal-head p,.superchat-free-note,.superchat-preview-label{display:none}
  .superchat-field-label{margin-top:10px}
  .superchat-preset{min-height:34px;font-size:10px}
  .superchat-custom-row input{height:34px}
  .superchat-message-input{min-height:62px;font-size:11px}
}
@media(prefers-reduced-motion:reduce){.superchat-tier-magenta::after,.superchat-tier-red::after{animation:none}}


/* ---------- /for314 : local text amplifier ---------- */
.for314-amplifier-tool-card{
  width:min(560px,calc(100% - 18px));margin:12px auto 16px;padding:14px;
  border:1px solid rgba(255,255,255,.16);border-radius:20px;color:var(--text,#eef3ff);
  background:linear-gradient(145deg,rgba(26,34,48,.80),rgba(18,24,35,.68));
  box-shadow:0 15px 40px rgba(0,0,0,.20),inset 0 1px 0 rgba(255,255,255,.10);
  -webkit-backdrop-filter:blur(18px) saturate(145%);backdrop-filter:blur(18px) saturate(145%);
}
body.local-light .for314-amplifier-tool-card{color:#172033;border-color:rgba(38,55,80,.12);background:linear-gradient(145deg,rgba(255,255,255,.88),rgba(240,245,252,.78));box-shadow:0 14px 36px rgba(45,64,91,.12),inset 0 1px 0 rgba(255,255,255,.92)}
.for314-amplifier-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.for314-amplifier-title{font-size:18px;font-weight:900;letter-spacing:.01em}.for314-amplifier-subtitle{margin-top:2px;font-size:10px;opacity:.55}
.for314-amplifier-close{width:34px;height:34px;flex:0 0 34px;border-radius:11px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.07);color:inherit;font-size:23px;line-height:1;cursor:pointer}
body.local-light .for314-amplifier-close{border-color:rgba(39,55,80,.12);background:rgba(60,80,110,.06)}
.for314-amplifier-label{display:flex;flex-direction:column;gap:7px;font-size:11px;font-weight:800;opacity:.92}
.for314-amplifier-input,.for314-amplifier-output,.for314-amplifier-count-input{box-sizing:border-box;width:100%;border:1px solid rgba(255,255,255,.13);outline:none;color:inherit;background:rgba(5,10,18,.30);font:inherit;-webkit-appearance:none;appearance:none}
body.local-light .for314-amplifier-input,body.local-light .for314-amplifier-output,body.local-light .for314-amplifier-count-input{border-color:rgba(40,57,82,.13);background:rgba(255,255,255,.72)}
.for314-amplifier-input{min-height:58px;resize:vertical;border-radius:13px;padding:10px 11px;font-size:14px;line-height:1.45}
.for314-amplifier-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;margin:11px 0 12px}
.for314-amplifier-count-field,.for314-amplifier-newline-field{display:flex;flex-direction:column;gap:7px;font-size:11px;font-weight:800}.for314-amplifier-count-input{height:40px;border-radius:12px;padding:0 11px;font-size:14px;font-variant-numeric:tabular-nums}.for314-amplifier-newline-field{min-width:88px}
.for314-amplifier-toggle{height:40px;padding:0 14px;border-radius:12px;border:1px solid rgba(255,255,255,.13);background:rgba(255,255,255,.07);color:inherit;font-size:12px;font-weight:900;cursor:pointer}
.for314-amplifier-toggle.on{background:#1677ff;border-color:#1677ff;color:#fff;box-shadow:0 5px 15px rgba(22,119,255,.24)}body.local-light .for314-amplifier-toggle:not(.on){border-color:rgba(40,57,82,.13);background:rgba(255,255,255,.70)}
.for314-amplifier-output-label{flex-direction:row;align-items:center;justify-content:space-between;gap:10px}.for314-amplifier-status{font-size:9px;font-weight:700;opacity:.55;text-align:right}.for314-amplifier-status.error{color:#ff6675;opacity:1}
.for314-amplifier-output{min-height:154px;margin-top:7px;resize:vertical;border-radius:14px;padding:11px 12px;font-size:13px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.for314-amplifier-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:11px}.for314-amplifier-actions button{min-height:42px;border-radius:13px;font-size:13px;font-weight:900;cursor:pointer}
.for314-amplifier-copy{border:0;background:#1677ff;color:#fff;box-shadow:0 6px 16px rgba(22,119,255,.22)}.for314-amplifier-clear{border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.07);color:inherit}body.local-light .for314-amplifier-clear{border-color:rgba(40,57,82,.13);background:rgba(255,255,255,.72)}
.for314-amplifier-input:focus,.for314-amplifier-output:focus,.for314-amplifier-count-input:focus{border-color:rgba(92,165,255,.85);box-shadow:0 0 0 3px rgba(40,130,245,.14)}
@media(max-width:520px){.for314-amplifier-tool-card{width:calc(100% - 12px);margin:9px auto 13px;padding:12px;border-radius:18px}.for314-amplifier-title{font-size:16px}.for314-amplifier-input{font-size:13px}.for314-amplifier-output{min-height:138px;font-size:12px}}
@media(max-width:260px){.for314-amplifier-tool-card{width:calc(100% - 6px);padding:8px;border-radius:13px}.for314-amplifier-subtitle{display:none}.for314-amplifier-controls{grid-template-columns:1fr;gap:7px}.for314-amplifier-newline-field{min-width:0}.for314-amplifier-actions{grid-template-columns:1fr}.for314-amplifier-output{min-height:106px}}


.for314-amplifier-shared-card{position:relative}
.for314-amplifier-shared-activity{min-height:16px;margin-top:8px;font-size:9px;font-weight:700;line-height:1.35;opacity:.52;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.local-light .for314-amplifier-shared-activity{opacity:.58}

/* ---------- /chat : ephemeral chat-in-chat ---------- */
.ephemeral-mini-chat-card{
  /* chatlog は flex-column。flex-shrink を止めないと、ログ量が多い時にカードが線まで潰れる。 */
  flex:0 0 auto!important;
  flex-shrink:0!important;
  align-self:center;
  box-sizing:border-box;
  min-height:228px;
  width:min(520px,calc(100% - 18px));margin:12px auto 16px;overflow:hidden;
  border:1px solid rgba(255,255,255,.15);border-radius:21px;color:var(--text,#eef3ff);
  background:linear-gradient(145deg,rgba(25,33,47,.82),rgba(13,19,29,.72));
  box-shadow:0 15px 38px rgba(0,0,0,.20),inset 0 1px 0 rgba(255,255,255,.09);
  -webkit-backdrop-filter:blur(18px) saturate(145%);backdrop-filter:blur(18px) saturate(145%);
}
body.local-light .ephemeral-mini-chat-card{color:#172033;border-color:rgba(38,55,80,.12);background:linear-gradient(145deg,rgba(255,255,255,.92),rgba(239,245,252,.84));box-shadow:0 14px 34px rgba(45,64,91,.12),inset 0 1px 0 rgba(255,255,255,.94)}
.ephemeral-mini-chat-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px 10px;border-bottom:1px solid rgba(255,255,255,.08)}
body.local-light .ephemeral-mini-chat-head{border-bottom-color:rgba(40,57,82,.09)}
.ephemeral-mini-chat-title{font-size:14px;font-weight:900;letter-spacing:.01em}.ephemeral-mini-chat-note{margin-top:2px;font-size:8px;font-weight:700;opacity:.46}
.ephemeral-mini-chat-badge{flex:0 0 auto;padding:4px 7px;border-radius:999px;background:rgba(86,152,255,.15);border:1px solid rgba(86,152,255,.22);font-size:9px;font-weight:900;color:#9bc7ff}
body.local-light .ephemeral-mini-chat-badge{background:rgba(35,116,235,.08);border-color:rgba(35,116,235,.13);color:#276bc9}
.ephemeral-mini-chat-log{box-sizing:border-box;min-height:128px;max-height:230px;overflow:auto;padding:11px 11px 8px;scrollbar-width:thin;overscroll-behavior:contain}
.ephemeral-mini-chat-empty{display:flex;align-items:center;justify-content:center;min-height:100px;font-size:10px;font-weight:700;opacity:.38;text-align:center}.ephemeral-mini-chat-empty[hidden]{display:none}
.ephemeral-mini-chat-row{display:flex;flex-direction:column;align-items:flex-start;margin:0 0 8px;max-width:88%}.ephemeral-mini-chat-row.mine{align-items:flex-end;margin-left:auto}
.ephemeral-mini-chat-meta{display:flex;align-items:center;gap:5px;margin:0 5px 3px;font-size:8px;line-height:1.2;opacity:.48}.ephemeral-mini-chat-row.mine .ephemeral-mini-chat-meta{flex-direction:row-reverse}.ephemeral-mini-chat-name{font-weight:800;max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ephemeral-mini-chat-time{font-variant-numeric:tabular-nums}
.ephemeral-mini-chat-bubble{max-width:100%;padding:7px 9px;border-radius:13px 13px 13px 4px;background:rgba(255,255,255,.09);border:1px solid rgba(255,255,255,.08);font-size:12px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.ephemeral-mini-chat-row.mine .ephemeral-mini-chat-bubble{border-radius:13px 13px 4px 13px;background:#1677ff;border-color:#1677ff;color:#fff;box-shadow:0 4px 12px rgba(22,119,255,.18)}
body.local-light .ephemeral-mini-chat-row:not(.mine) .ephemeral-mini-chat-bubble{background:rgba(42,61,89,.07);border-color:rgba(42,61,89,.08)}
.ephemeral-mini-chat-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:7px;padding:8px;border-top:1px solid rgba(255,255,255,.08);background:rgba(5,9,15,.10)}
body.local-light .ephemeral-mini-chat-composer{border-top-color:rgba(40,57,82,.09);background:rgba(255,255,255,.34)}
.ephemeral-mini-chat-input{box-sizing:border-box;width:100%;min-height:34px;max-height:92px;resize:none;overflow:auto;border:1px solid rgba(255,255,255,.12);border-radius:12px;outline:none;padding:8px 10px;background:rgba(5,10,18,.28);color:inherit;font:inherit;font-size:12px;line-height:1.35;-webkit-appearance:none;appearance:none}
body.local-light .ephemeral-mini-chat-input{border-color:rgba(40,57,82,.12);background:rgba(255,255,255,.72)}.ephemeral-mini-chat-input:focus{border-color:rgba(79,151,255,.78);box-shadow:0 0 0 3px rgba(40,130,245,.12)}
.ephemeral-mini-chat-send{height:34px;min-width:54px;padding:0 11px;border:0;border-radius:11px;background:#1677ff;color:#fff;font-size:11px;font-weight:900;cursor:pointer;box-shadow:0 4px 12px rgba(22,119,255,.20)}
.ephemeral-mini-chat-send:active{transform:translateY(1px)}
@media(max-width:520px){.ephemeral-mini-chat-card{width:calc(100% - 12px);margin:9px auto 13px;border-radius:18px}.ephemeral-mini-chat-log{min-height:116px;max-height:205px}.ephemeral-mini-chat-title{font-size:13px}.ephemeral-mini-chat-bubble{font-size:11px}.ephemeral-mini-chat-input{font-size:11px}}
@media(max-width:260px){.ephemeral-mini-chat-card{width:calc(100% - 6px);min-height:190px;border-radius:13px}.ephemeral-mini-chat-note{display:none}.ephemeral-mini-chat-head{padding:8px}.ephemeral-mini-chat-badge{display:none}.ephemeral-mini-chat-log{min-height:94px;max-height:170px;padding:7px}.ephemeral-mini-chat-composer{grid-template-columns:1fr;padding:6px}.ephemeral-mini-chat-send{width:100%}}





/* ---------- /dos : ephemeral Browser DOS card ---------- */
.for314-dos-card{
  flex:0 0 auto!important;
  flex-shrink:0!important;
  align-self:center;
  box-sizing:border-box;
  width:min(760px,calc(100% - 18px));
  margin:12px auto 16px;
  overflow:hidden;
  border:1px solid rgba(120,255,140,.20);
  border-radius:21px;
  color:#d9ffdd;
  background:linear-gradient(145deg,rgba(10,18,12,.94),rgba(3,8,4,.91));
  box-shadow:0 16px 40px rgba(0,0,0,.25),inset 0 1px 0 rgba(180,255,192,.06);
  -webkit-backdrop-filter:blur(18px) saturate(125%);
  backdrop-filter:blur(18px) saturate(125%);
}
body.local-light .for314-dos-card{
  color:#13351a;
  border-color:rgba(45,110,58,.20);
  background:linear-gradient(145deg,rgba(247,255,248,.96),rgba(226,244,230,.92));
  box-shadow:0 14px 34px rgba(45,85,55,.13),inset 0 1px 0 rgba(255,255,255,.96);
}
.for314-dos-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px 10px;border-bottom:1px solid rgba(120,255,140,.11)}
body.local-light .for314-dos-card-head{border-bottom-color:rgba(45,110,58,.12)}
.for314-dos-card-title-wrap{min-width:0}.for314-dos-card-title{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;font-weight:900;letter-spacing:.03em}.for314-dos-card-note{margin-top:2px;max-width:390px;font-size:8px;font-weight:700;opacity:.50;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.for314-dos-card-actions{display:flex;align-items:center;gap:6px;flex:0 0 auto}.for314-dos-card-badge{padding:4px 7px;border-radius:999px;background:rgba(91,230,111,.11);border:1px solid rgba(91,230,111,.20);color:#a8efb2;font-size:9px;font-weight:900}body.local-light .for314-dos-card-badge{background:rgba(40,137,61,.08);border-color:rgba(40,137,61,.15);color:#26733a}
.for314-dos-card-close{display:grid;place-items:center;width:28px;height:28px;padding:0;border:1px solid rgba(255,255,255,.10);border-radius:999px;background:rgba(255,255,255,.06);color:inherit;font-size:18px;line-height:1;cursor:pointer}body.local-light .for314-dos-card-close{border-color:rgba(30,75,40,.12);background:rgba(255,255,255,.68)}.for314-dos-card-close:active{transform:scale(.96)}
.for314-dos-frame-wrap{background:#000;padding:0;overflow:hidden}.for314-dos-iframe{display:block;width:100%;height:clamp(360px,calc(75vw + 120px),620px);border:0;background:#000;color-scheme:dark}
.for314-dos-card-foot{padding:8px 11px 10px;border-top:1px solid rgba(120,255,140,.09);font-size:9px;line-height:1.35;opacity:.50;text-align:center}body.local-light .for314-dos-card-foot{border-top-color:rgba(45,110,58,.11)}
@media(max-width:520px){.for314-dos-card{width:calc(100% - 12px);margin:9px auto 13px;border-radius:18px}.for314-dos-card-head{padding:9px 10px}.for314-dos-card-title{font-size:13px}.for314-dos-card-note{max-width:240px}.for314-dos-iframe{height:clamp(350px,calc(75vw + 110px),610px)}.for314-dos-card-foot{font-size:8px}}
@media(max-width:300px){.for314-dos-card{width:calc(100% - 6px);border-radius:13px}.for314-dos-card-head{padding:8px}.for314-dos-card-note{display:none}.for314-dos-card-badge{display:none}.for314-dos-iframe{height:360px}.for314-dos-card-foot{padding:6px;font-size:7px}}


/* ===== Long text: collapse after 200 characters ===== */
.message-bubble .message-collapsible-text{
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.message-bubble .message-more-toggle{
  display:block;
  appearance:none;
  -webkit-appearance:none;
  margin:6px 0 0;
  padding:2px 0;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  font-size:11px;
  font-weight:700;
  line-height:1.25;
  text-decoration:underline;
  text-underline-offset:2px;
  opacity:.72;
  cursor:pointer;
}
.message-bubble .message-more-toggle:active{opacity:1}

/* ===== Long text: light-mode readability fix ===== */
body.local-light .message-bubble .message-collapsible-text{
  color:inherit!important;
  -webkit-text-fill-color:currentColor!important;
}
body.local-light .message-bubble .message-more-toggle{
  appearance:none!important;
  -webkit-appearance:none!important;
  background:transparent!important;
  background-color:transparent!important;
  background-image:none!important;
  border:0!important;
  border-color:transparent!important;
  box-shadow:none!important;
  outline:0!important;
  color:inherit!important;
  -webkit-text-fill-color:currentColor!important;
}
body.local-light .message:not(.mine) .message-bubble .message-more-toggle{
  color:#315da8!important;
  -webkit-text-fill-color:#315da8!important;
  opacity:.9;
}
body.local-light .message.mine .message-bubble .message-collapsible-text,
body.local-light .message.mine .message-bubble .message-more-toggle{
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}

/* ===== WID composer: Enter改行制限に対応する1行textarea ===== */
.inputrow textarea#msgInput{
  flex:1 1 auto;
  min-width:0;
  width:auto;
  height:40px;
  min-height:40px;
  max-height:40px;
  margin:0;
  padding:8px 12px;
  resize:none;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:10px;
  outline:none;
  background:#0f1422;
  color:var(--text);
  font:inherit;
  line-height:22px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  -webkit-appearance:none;
  appearance:none;
}
.inputrow textarea#msgInput:focus{border-color:#4c6fa9}
body.local-light .inputrow textarea#msgInput{
  background:#fff!important;
  color:#111!important;
  -webkit-text-fill-color:#111!important;
  border-color:#111!important;
}
body.local-light .inputrow textarea#msgInput::placeholder{color:#555!important}
body.local-dark .inputrow textarea#msgInput{color:#eef2f7}
@media(max-width:300px){
  .inputrow textarea#msgInput{
    height:33px;
    min-height:33px;
    max-height:33px;
    padding:6px 8px;
    border-radius:8px;
    font-size:12px;
    line-height:19px;
  }
}
@media(max-width:210px){
  .inputrow textarea#msgInput{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
    padding:7px 6px!important;
    font-size:11px!important;
    line-height:18px!important;
  }
}
@media(max-width:195px){
  .inputrow textarea#msgInput{padding:7px 5px!important;font-size:10.5px!important}
}
/* Native-alert inspired alert: command dialog */
.native-like-alert-backdrop{
  position:fixed;inset:0;z-index:2147483646;
  display:grid;place-items:center;padding:12px;
  background:rgba(0,0,0,.34);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
  opacity:0;transition:opacity .12s ease;
}
.native-like-alert-backdrop.open{opacity:1}
.native-like-alert-backdrop.closing{opacity:0;pointer-events:none}
.native-like-alert-dialog{
  width:min(320px,calc(100vw - 24px));overflow:hidden;
  color:#111;background:rgba(250,250,250,.98);
  border:1px solid rgba(0,0,0,.12);border-radius:14px;
  box-shadow:0 18px 55px rgba(0,0,0,.32);
  text-align:center;transform:scale(.96);transition:transform .12s ease;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.native-like-alert-backdrop.open .native-like-alert-dialog{transform:scale(1)}
.native-like-alert-message{
  min-height:72px;display:grid;place-items:center;
  padding:22px 18px 18px;font-size:14px;font-weight:500;line-height:1.45;
  white-space:pre-wrap;overflow-wrap:anywhere;
}
.native-like-alert-ok{
  display:block;width:100%;min-height:44px;margin:0;padding:9px 12px;
  border:0;border-top:1px solid rgba(0,0,0,.13);border-radius:0;
  color:#007aff;background:transparent;font:600 15px/1 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  cursor:pointer;-webkit-tap-highlight-color:transparent;
}
.native-like-alert-ok:hover{background:rgba(0,122,255,.07)}
.native-like-alert-ok:active{background:rgba(0,122,255,.14)}
.native-like-alert-ok:focus-visible{outline:3px solid rgba(0,122,255,.32);outline-offset:-3px}
body:not(.local-light) .native-like-alert-dialog{
  color:#fff;background:rgba(42,42,44,.98);border-color:rgba(255,255,255,.16);
}
body:not(.local-light) .native-like-alert-ok{border-top-color:rgba(255,255,255,.17);color:#0a84ff}
@media (prefers-reduced-motion:reduce){
  .native-like-alert-backdrop,.native-like-alert-dialog{transition:none}
}
