/* The learning group: white paper and expressive speech cards, inspired by the user's Chats reference.
   Stable avatar colours identify speakers. A 4px rhythm, ink-led type and flat colour keep long chats readable. */
.community-entry{display:flex;align-items:center;gap:12px;background:var(--surface);border-radius:24px;padding:18px 16px;margin:18px 0;box-shadow:var(--shadow)}
.community-entry>span:nth-child(2){flex:1;min-width:0}.community-entry b{display:block;font:800 17px var(--round)}.community-entry small{display:block;color:var(--muted);font-size:12px;margin-top:6px}
.community-entry-art{position:relative;display:block;width:64px;height:48px;flex:none}.community-entry-art i{position:absolute;display:grid;place-items:center;width:32px;height:32px;background:#ff7375;color:#25242b;border-radius:14px 14px 4px 14px;font:800 16px var(--jp);font-style:normal;left:0;top:0}.community-entry-art i:nth-child(2){background:#ffc447;left:30px;top:4px;transform:rotate(8deg)}.community-entry-art i:nth-child(3){background:#9cbff6;left:15px;top:22px;width:28px;height:28px}
body.community-open{overflow:hidden;background:#faf9f7;color:#242326;color-scheme:light}
.community-open .view{padding:0;max-width:680px}.community-open .tabs{display:none}
.community-screen{--chat-paper:#faf9f7;--chat-ink:#242326;--chat-muted:#68656b;--chat-coral:#ff777a;--chat-lemon:#f8da58;--chat-orange:#ffbc5c;--chat-blue:#8cbaf5;--chat-lilac:#d0bbeb;--chat-mint:#9bd8bc;height:var(--chat-height,100dvh);display:flex;flex-direction:column;position:relative;background:var(--chat-paper);color:var(--chat-ink);font-family:var(--font);overflow:hidden}
.chat-header{padding:12px 24px 16px;padding-top:max(12px,env(safe-area-inset-top));flex:none;background:var(--chat-paper);z-index:2}.chat-topline{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;letter-spacing:.03em;color:var(--chat-muted)}
.chat-back,.chat-profile-button{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;flex:none;color:var(--chat-ink)}.chat-back{margin-left:-12px}.chat-profile-button{background:#eeece8;font-size:22px}.chat-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:4px}.chat-heading h1{font:850 40px/1.2 var(--round);letter-spacing:-1.5px}.chat-title-dot{color:#f46272;padding-left:2px}.chat-heading p{font-size:12px;color:var(--chat-muted);margin-top:8px}.chat-live{font-size:11px;white-space:nowrap;display:flex;align-items:center;gap:6px}.chat-live:before{content:'';width:6px;height:6px;background:#b8b3b8;border-radius:50%}.chat-live.connected:before{background:#428563}
.chat-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 20px 28px;overscroll-behavior:contain;scrollbar-width:thin}.chat-history{display:flex;justify-content:center;gap:16px;padding:4px 0}.chat-history button{font-size:12px;font-weight:600;padding:10px 8px;color:var(--chat-muted);text-decoration:underline;text-underline-offset:4px}.chat-date{text-align:center;font-size:11px;color:var(--chat-muted);padding:16px 0 12px;font-weight:500}
.chat-bubble{--bubble:var(--chat-coral);position:relative;display:flex;align-items:flex-start;gap:12px;padding:22px 20px 24px;margin:0 0 14px;background:var(--bubble);border-radius:40px 44px 34px 42px;color:var(--chat-ink);min-width:0}.chat-tone-1{--bubble:var(--chat-orange);border-radius:28px 40px 42px 36px}.chat-tone-2{--bubble:var(--chat-mint);border-radius:40px 32px 44px 32px}.chat-tone-3{--bubble:var(--chat-blue);border-radius:44px 40px 36px 44px}.chat-tone-4{--bubble:var(--chat-lilac);border-radius:32px 42px 36px 40px}.chat-tone-5{--bubble:var(--chat-lemon);border-radius:38px 36px 44px 34px}
.chat-bubble:after{content:'';position:absolute;bottom:-9px;left:64px;width:18px;height:18px;background:var(--bubble);clip-path:polygon(0 0,100% 0,16% 100%)}.chat-bubble.is-mine:after{left:auto;right:58px;transform:scaleX(-1)}.chat-bubble.is-deleted{--bubble:#eeece8;color:var(--chat-muted)}
.chat-avatar{width:42px;height:42px;flex:none;display:grid;place-items:center;background:rgba(255,255,255,.55);border:2px solid rgba(255,255,255,.6);border-radius:50%;font-size:23px;line-height:1}.chat-message-main{flex:1;min-width:0}.chat-meta{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 6px;padding-right:20px;font-size:13px;line-height:1.4}.chat-meta>b{font-weight:750;overflow-wrap:anywhere}.chat-meta time{font-size:10px;color:#47434b}.chat-role{font-size:9px;background:rgba(255,255,255,.4);padding:1px 5px;border-radius:6px;font-weight:600}.chat-text{font-size:15px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;user-select:text;-webkit-user-select:text}.is-deleted .chat-text{font-size:13px}
.chat-actions{position:absolute;right:12px;top:12px;z-index:1}.chat-actions[open]{z-index:3}.chat-actions summary{list-style:none;cursor:pointer;width:36px;height:36px;display:grid;place-items:center;font-size:10px;letter-spacing:2px}.chat-actions summary::-webkit-details-marker{display:none}.chat-actions>div{position:absolute;right:0;top:32px;background:white;border-radius:14px;min-width:140px;box-shadow:0 8px 28px #24232622;padding:4px}.chat-actions button{display:block;width:100%;text-align:left;padding:12px;font-size:13px;border-radius:10px}.chat-actions button:hover{background:#f2f0f3}
.chat-empty{padding:36px 12px 48px;text-align:center;color:var(--chat-ink)}.chat-empty h2{font:800 26px/1.4 var(--round);letter-spacing:-.5px;margin-top:20px}.chat-empty p{font-size:14px;line-height:1.8;color:var(--chat-muted);margin-top:12px}.chat-empty small{display:block;font-size:11px;color:var(--chat-muted);margin-top:24px}.chat-empty-kana{position:relative;display:block;width:160px;height:120px;border-radius:48px 48px 12px 48px;background:var(--chat-coral);margin:12px auto 40px;font:800 72px/120px var(--jp);transform:rotate(-8deg)}.chat-empty-kana>span{position:absolute;right:-24px;bottom:-20px;width:84px;height:64px;border-radius:28px 28px 28px 4px;background:var(--chat-blue);font:700 24px/64px var(--jp);transform:rotate(12deg)}.chat-loading{padding:64px 0;text-align:center;color:var(--chat-muted);font-size:14px}.chat-retry{border-radius:24px;padding:12px 24px;background:var(--chat-ink);color:white;font-size:14px;margin-top:24px}
.chat-composer{flex:none;padding:12px 20px max(12px,env(safe-area-inset-bottom));background:var(--chat-paper);border-top:1px solid #2423260c;z-index:2}.chat-input-row{display:flex;align-items:flex-end;gap:8px;background:white;border:1px solid #24232614;border-radius:28px;padding:6px 6px 6px 18px}.chat-input-row textarea{display:block;flex:1;min-width:0;resize:none;border:0;background:transparent;color:var(--chat-ink);font:15px/24px var(--font);padding:8px 0;min-height:40px;max-height:124px;outline-offset:3px}.chat-input-row textarea::placeholder{color:#8b858c;font-size:13px}.chat-send{display:grid;place-items:center;background:var(--chat-ink);color:white;border-radius:50%;width:44px;height:44px;flex:none}.chat-send:disabled{opacity:.25}.chat-compose-foot{display:flex;align-items:center;justify-content:space-between;font-size:10px;color:var(--chat-muted);padding:8px 8px 0}.chat-compose-foot button{font-size:11px;min-height:24px;padding:0 4px}.chat-feedback{padding:8px 24px;font-size:12px;background:#fff0f1;color:#96394c;flex:none}.chat-new{position:absolute;bottom:128px;left:50%;transform:translateX(-50%);padding:10px 18px;border-radius:24px;background:var(--chat-ink);color:white;font-size:12px;box-shadow:0 6px 24px #24232620;z-index:4;white-space:nowrap}
.chat-profile-dialog{color:var(--chat-ink);background:var(--chat-paper);border:0;border-radius:28px;padding:24px;width:min(440px,calc(100% - 32px));max-height:90dvh;overflow:auto;box-shadow:0 24px 80px #0003}.chat-profile-dialog::backdrop{background:#18151e66;backdrop-filter:blur(4px)}.chat-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.chat-dialog-heading h2{font:800 22px/1.4 var(--round)}.chat-dialog-heading button{width:36px;height:36px;flex:none}.chat-profile-dialog p{font-size:12px;line-height:1.7;color:var(--chat-muted);margin:12px 0 20px}.chat-profile-dialog label,.chat-profile-dialog legend{font-size:13px;font-weight:600}.chat-profile-dialog input[name=name]{display:block;width:100%;margin:8px 0 20px;padding:14px;border:1px solid #2423261a;border-radius:14px;background:#eeece8;font-size:16px;color:var(--chat-ink)}.chat-profile-dialog fieldset{border:0;padding:0;margin:0 0 24px}.chat-avatars{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-top:12px}.chat-avatars label{position:relative;cursor:pointer}.chat-avatars input{position:absolute;opacity:0;width:100%;height:100%;margin:0}.chat-avatars span{display:grid;place-items:center;aspect-ratio:1;border-radius:50%;background:white;font-size:24px;border:2px solid transparent}.chat-avatars input:checked+span{border-color:var(--chat-ink);background:#f8da58}.chat-avatars input:focus-visible+span{outline:3px solid var(--sky)}.chat-save{padding:14px 20px;background:var(--chat-ink);color:white;width:100%;border-radius:24px;font-size:15px;font-weight:700}.chat-profile-error{color:#9e3346!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(min-width:700px){.community-screen{border-inline:1px solid #2423260c}.chat-header{padding:20px 40px}.chat-scroll{padding-inline:40px}.chat-composer{padding-inline:40px}.chat-bubble{padding:24px;gap:16px}.chat-text{font-size:16px}.chat-heading h1{font-size:44px}}
@media(max-width:350px){.chat-header{padding-inline:16px}.chat-scroll{padding-inline:12px}.chat-bubble{padding:20px 16px;gap:8px}.chat-avatar{width:34px;height:34px;font-size:20px}.chat-heading h1{font-size:36px}.chat-avatars{gap:4px}.chat-avatars span{font-size:20px}}

.chat-avatar img,.chat-profile-button img,.chat-avatars img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}.chat-avatar,.chat-profile-button{overflow:hidden}.chat-avatars{grid-template-columns:repeat(3,1fr);gap:16px 12px}.chat-avatars label{width:100%;max-width:100px;text-align:center;margin:auto}.chat-avatars span{border-width:3px;overflow:hidden}.chat-avatars small{display:block;font-size:10px;font-weight:500;margin-top:5px}.chat-avatars input{height:calc(100% - 20px)}.chat-moderation{margin-top:24px;border-top:1px solid #24232614;padding-top:16px}.chat-moderation h3{font-size:14px;margin:0 0 8px}.chat-muted-list>div{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;font-size:13px}.chat-muted-list button{padding:8px;color:#344c85;font-size:12px}.chat-muted-list p{margin-bottom:0}
/* 日语输入法: あ toggle in the input row, candidate bar above it, optional 五十音 pad below. */
.ime-toggle{display:grid;place-items:center;width:36px;height:36px;margin:4px 0 4px -10px;border-radius:50%;flex:none;font:700 17px/1 var(--jp);color:var(--chat-muted);background:#f1efeb;transition:background .15s,color .15s}
.ime-toggle[aria-pressed=true]{background:var(--chat-ink);color:#fff}
.ime-bar{display:flex;gap:6px;overflow-x:auto;padding:0 2px 10px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.ime-bar::-webkit-scrollbar{display:none}
.ime-bar button{flex:none;min-height:36px;padding:0 14px;border-radius:18px;background:#fff;border:1px solid #24232614;font:600 16px var(--jp);color:var(--chat-ink)}
.ime-bar button:first-child{background:var(--chat-lemon);border-color:transparent}
.ime-bar button.more{color:var(--chat-muted);font-weight:500}
.ime-hint{font-size:12px;color:var(--chat-muted);padding:9px 4px;white-space:nowrap}
.ime-pad{padding-top:10px;-webkit-user-select:none;user-select:none;touch-action:manipulation}
.ime-grid{display:grid;grid-template-columns:repeat(10,1fr);grid-template-rows:repeat(5,auto);grid-auto-flow:column;gap:4px}
.ime-fn{display:grid;grid-template-columns:repeat(8,1fr) 1.6fr;gap:4px;margin-top:6px}
.ime-key{min-height:38px;padding:0;border-radius:10px;background:#fff;border:1px solid #2423260f;font:500 17px var(--jp);color:var(--chat-ink);box-shadow:0 1px 0 #24232614}
.ime-key:active{background:var(--chat-lemon)}
.ime-key.fn{background:#eeece8;font-size:15px}
.ime-pad-toggle[aria-pressed=true]{font-weight:700;color:var(--chat-ink)}
/* Same paper, ink and lemon as the conversation. Art leads; sending stays explicit. */
.chat-sticker{margin:12px 0 0;width:160px;max-width:100%;text-align:center}.chat-sticker img{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:contain}.chat-sticker figcaption{font-size:12px;font-weight:650;margin-top:4px}
.chat-compose-foot{gap:8px;flex-wrap:wrap;padding-top:4px}.chat-compose-foot .chat-sticker-toggle{display:flex;align-items:center;gap:5px;min-height:44px;font-size:12px;color:var(--chat-ink)}.chat-sticker-toggle:disabled{opacity:.4}.chat-count{margin-left:auto;white-space:nowrap}
/* Inline tray stays below its toggle and leaves the conversation visible. */
.chat-sticker-panel{display:flex;flex-direction:column;height:min(37dvh,300px);min-height:160px;border-top:1px solid #24232612;padding-top:8px}
.sticker-open .ime-pad,.sticker-open .ime-bar{display:none!important}
.chat-sticker-toggle[aria-expanded=true]{font-weight:750}
.chat-sticker-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:116px;align-content:start;gap:8px;padding:4px 0 12px;overflow-y:auto;min-height:0;flex:1;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}
.chat-sticker-grid button{display:flex;flex-direction:column;align-items:center;background:#fff;border:2px solid transparent;border-radius:16px;padding:6px 2px;color:var(--chat-ink);min-width:0;min-height:44px}
.chat-sticker-grid img{flex:none;width:100%;max-width:80px;height:auto;aspect-ratio:1;object-fit:contain}.chat-sticker-grid b{font:500 11px/1.5 var(--jp);margin-top:4px;white-space:nowrap}
.chat-sticker-grid button[aria-pressed=true]{background:#fff5c4;border-color:var(--chat-ink)}.chat-sticker-grid button:disabled{opacity:.6}
.chat-sticker-panel>footer{padding:8px 0 0;flex:none;border-top:1px solid #24232612}.chat-sticker-panel footer>div{display:flex;align-items:center;gap:8px}.chat-sticker-selection{font:500 12px/1.5 var(--jp);flex:1;min-width:0}
.chat-sticker-panel [data-send-sticker]{min-height:44px;min-width:68px;padding:10px 16px;border-radius:24px;background:var(--chat-ink);color:#fff;white-space:nowrap;font:650 13px var(--jp)}.chat-sticker-panel [data-send-sticker]:disabled{opacity:.35}.chat-sticker-panel [data-close-stickers]{width:44px;height:44px;display:grid;place-items:center;border-radius:50%;color:var(--chat-muted)}
.chat-sticker-error{font-size:12px;line-height:1.6;color:#96394c;margin-bottom:8px}
@media(max-width:350px){.chat-sticker-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.chat-sticker-grid img{max-width:68px}}

/* Compact chat controls: one header row, one input row, one shared lower tray. */
body.community-open .view{padding:0;animation:none}
.chat-header{padding:8px 16px;padding-top:max(8px,env(safe-area-inset-top))}.chat-topline-title{display:flex;align-items:center;justify-content:center;gap:8px;min-width:0}.chat-topline-title>span:first-child{font-size:12px;letter-spacing:0}.chat-live{font-size:0;width:6px;overflow:hidden;gap:0}.chat-profile-button{width:40px;height:40px}.chat-back{margin-left:0}
.chat-composer{padding:8px 12px max(8px,env(safe-area-inset-bottom))}.chat-input-row{gap:8px;padding:0;background:transparent;border:0;border-radius:0;align-items:center}.chat-text-frame{display:flex;align-items:flex-end;flex:1;min-width:0;background:#fff;border:1px solid #24232614;border-radius:22px;padding:4px}.chat-input-row textarea{font-size:16px;line-height:24px;padding:8px 10px;min-height:40px;max-height:100px}.chat-input-row textarea::placeholder{font-size:14px}.chat-send{width:40px;height:40px}.chat-send:disabled{display:none}.chat-voice-toggle{display:grid;place-items:center;width:40px;height:44px;flex:none;border-radius:50%;color:var(--chat-ink)}.chat-voice-toggle:disabled{opacity:.35}.chat-sticker-toggle{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;width:44px;min-height:48px;flex:none;color:var(--chat-ink)}.chat-sticker-toggle small{font:500 9px/1.4 var(--jp)}.chat-sticker-toggle[aria-expanded=true]{color:#7d5a00}
.chat-compose-foot{display:none;gap:8px;padding:0 4px;font-size:10px;flex-wrap:nowrap}.keyboard-open .chat-compose-foot{display:flex}.chat-compose-foot button{min-width:44px;min-height:40px;font-size:14px}.chat-count{flex:1;text-align:right}.chat-compose-foot [data-close-keyboard]{font-size:24px}.chat-composer:not(.keyboard-open) .ime-bar{display:none}.chat-composer.voice-mode .ime-bar{display:none}.ime-pad{max-height:min(42dvh,310px);overflow-y:auto;padding-top:0;overscroll-behavior:contain}.ime-key{min-height:36px}.ime-bar{padding-bottom:6px}.chat-sticker-panel{margin-top:8px}.chat-record{width:100%;min-height:40px;border-radius:18px;font-size:15px;font-weight:650;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.recording .chat-record{background:#edf5e8;color:#325b30}.record-cancel .chat-record{background:#fff0f1;color:#96394c}.chat-record-status{padding:12px 8px 4px;text-align:center;font-size:13px;color:#325b30}.record-cancel .chat-record-status{color:#96394c}.chat-voice-pending{display:flex;align-items:center;gap:8px;padding:8px 4px 0;font-size:12px}.chat-voice-pending span{flex:1;color:var(--chat-muted)}.chat-voice-pending button{min-height:44px;padding:8px 12px;border-radius:20px;background:#fff}.chat-voice-pending button[data-retry-voice]{background:var(--chat-ink);color:#fff}.chat-voice-message{display:flex;align-items:center;gap:12px;min-height:48px;min-width:140px;width:min(100%,240px);margin-top:6px;padding:8px 12px;border-radius:18px;background:#ffffff38;font-size:15px;font-weight:650}.chat-voice-message small{margin-left:auto;font-size:11px;font-weight:400}.chat-voice-message[aria-pressed=true]{background:#ffffff80}.voice-waves{display:grid;place-items:center}.chat-voice-message[aria-pressed=true] .voice-waves{animation:voice-pulse .8s ease-in-out infinite alternate}@keyframes voice-pulse{to{opacity:.35}}
@media(prefers-reduced-motion:reduce){.chat-voice-message[aria-pressed=true] .voice-waves{animation:none}}
@media(min-width:700px){.chat-header{padding-inline:28px}.chat-composer{padding-inline:24px}}
