.live2d-widget {
    position: fixed;
    right: 8px;
    bottom: 0;
    z-index: 40;
    width: min(300px, 48vw);
    height: min(460px, 48svh);
    pointer-events: none;
}
.live2d-canvas { display: block; width: 100% !important; height: 100% !important; pointer-events: none; }
.live2d-widget[data-body="full"] { width: min(340px, 52vw); height: min(660px, 70svh); }
.live2d-interact { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.live2d-interact:focus-visible { outline: 2px solid #72938f; outline-offset: -4px; }
.live2d-retry { position: absolute; bottom: 14px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid #d4dfda; border-radius: 4px; background: #fffffff2; color: #708582; cursor: pointer; pointer-events: auto; }
.live2d-retry:hover { border-color: #b78a7e; color: #9d5149; }
.live2d-retry svg { width: 16px; height: 16px; }
.live2d-widget[hidden], .live2d-widget [hidden] { display: none; }
.live2d-message { position: absolute; bottom: 16px; right: 52px; max-width: 180px; color: #9d5149; font-size: 10px; text-align: right; line-height: 1.6; }
@media (max-width: 700px) {
    .live2d-widget { right: 0; width: min(210px, 48vw); height: min(340px, 48svh); }
}
.companion-bubble { position: absolute; right: calc(100% - 24px); bottom: 60%; width: 280px; max-width: calc(100vw - 24px); padding: 13px 15px 14px; border: 1px solid #d8e3de; border-top: 2px solid #b97d70; border-radius: 6px; background: #fffffff7; color: #354c51; box-shadow: 0 5px 22px #294a4510; pointer-events: auto; }
.companion-bubble::after { content: ''; position: absolute; right: -7px; bottom: 20px; width: 12px; height: 12px; background: #fff; border-right: 1px solid #d8e3de; border-top: 1px solid #d8e3de; transform: rotate(45deg); }
.companion-bubble-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 11px; color: #7c8d88; }
.companion-bubble-head button { display: grid; place-items: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #8e9b95; cursor: pointer; flex-shrink: 0; }
.companion-bubble-head button:hover { color: #9d5149; background: #f7eeeb; }
.companion-bubble svg { width: 14px; height: 14px; }
.companion-bubble p { margin: 0; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.companion-bubble .companion-detail { margin-top: 7px; color: #6d817c; font-size: 12px; }
.companion-action { display: inline-flex; margin-top: 9px; color: #8a5349; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.companion-bubble[data-kind="failed"], .companion-bubble[data-kind="precheck"] { border-top-color: #b66363; }
.companion-bubble[data-kind="success"] { border-top-color: #6b9685; }
.companion-notifications { position: absolute; right: 4px; bottom: 10px; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #d4dfda; border-radius: 4px; background: #fffffff2; color: #668179; pointer-events: auto; cursor: pointer; }
.companion-notifications[aria-pressed="false"] { color: #a3aaa5; }
.companion-notifications svg { width: 15px; height: 15px; }
.companion-voice { position: absolute; right: 42px; bottom: 10px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #d4dfda; border-radius: 4px; background: #fffffff2; color: #a3aaa5; pointer-events: auto; cursor: pointer; }
.companion-voice[aria-pressed="true"] { color: #8a5349; border-color: #d8b6ac; }
.companion-voice svg { width: 15px; height: 15px; }
.companion-voice:focus-visible { outline: 2px solid #72938f; outline-offset: 2px; }
.companion-settings, .companion-shuffle { position: absolute; bottom: 10px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #d4dfda; border-radius: 4px; background: #fffffff2; color: #668179; pointer-events: auto; cursor: pointer; }
.companion-settings { right: 80px; }
.companion-shuffle { right: 118px; }
.companion-settings svg, .companion-shuffle svg { width: 15px; height: 15px; }
.companion-shuffle:disabled { opacity: .4; cursor: default; }
.companion-settings-dialog { position: fixed; inset: auto min(324px, max(16px, calc(100vw - 406px))) 18px auto; width: min(390px, calc(100vw - 32px)); max-width: none; max-height: calc(100svh - 36px); margin: 0; padding: 20px; overflow-y: auto; border: 1px solid #d4dfda; border-top: 2px solid #b97d70; border-radius: 6px; background: #fffefa; color: #354c51; box-shadow: 0 12px 40px #294a4524; pointer-events: auto; }
.companion-settings-dialog::backdrop { background: #293e4112; }
.live2d-widget[data-body="full"] .companion-settings-dialog { right: min(364px, max(16px, calc(100vw - 406px))); }
.companion-settings-form { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: 14px; max-height: calc(100svh - 78px); margin: 0; }
.companion-choice-fields { display: grid; gap: 14px; min-height: 0; overflow: auto; padding: 2px; }
.companion-settings-form header, .companion-settings-form footer { display: flex; align-items: center; gap: 10px; }
.companion-settings-form header { justify-content: space-between; }
.companion-settings-form h2 { margin: 0; font-size: 17px; line-height: 1.5; letter-spacing: 0; }
.companion-settings-form header button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #708582; cursor: pointer; }
.companion-settings-form button svg { width: 16px; height: 16px; flex-shrink: 0; }
.companion-settings-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; background: #edf2ef; border-radius: 4px; }
.companion-settings-form fieldset label { position: relative; margin: 0; cursor: pointer; }
.companion-settings-form fieldset input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.companion-settings-form fieldset span { display: flex; justify-content: center; align-items: center; min-height: 44px; padding: 5px 4px; border: 1px solid transparent; border-radius: 3px; font-size: 12px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.companion-settings-form fieldset input:checked + span { background: #fff; border-color: #b5c9bf; color: #795147; }
.companion-settings-form fieldset input:focus-visible + span { outline: 2px solid #72938f; outline-offset: -2px; }
.companion-settings-form .companion-body-filter { margin-bottom: 12px; }
.companion-settings-form .companion-body-filter span { min-height: 32px; }
.companion-field { display: grid; gap: 7px; margin: 0 0 7px; color: #667c75; font-size: 12px; }
.companion-settings-form input[type="search"], .companion-settings-form select { box-sizing: border-box; width: 100%; height: 38px; min-width: 0; padding: 7px 9px; border: 1px solid #d3ded8; border-radius: 4px; background: #fff; color: #354c51; font: inherit; font-size: 13px; }
.companion-settings-form input:focus, .companion-settings-form select:focus { outline: 2px solid #b4c9bd; outline-offset: 1px; }
.companion-settings-status { display: block; min-height: 18px; color: #9d5149; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.companion-settings-form footer { justify-content: flex-end; }
.companion-settings-form footer button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 13px; border: 1px solid #cddbd3; border-radius: 4px; background: #fff; color: #526d61; font: inherit; font-size: 13px; cursor: pointer; }
.companion-settings-form .companion-apply { border-color: #6e8d7d; background: #6e8d7d; color: #fff; }
.companion-settings-form button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 700px) {
    .live2d-widget[data-body="full"] { width: min(300px, 72vw); height: min(540px, 68svh); }
    .live2d-widget[data-body="full"] .companion-settings-dialog { right: 12px; }
    .companion-settings-dialog { inset: 12px 12px auto auto; width: min(390px, calc(100vw - 24px)); max-height: min(640px, calc(100svh - 24px)); padding: 14px; }
    .companion-settings-form { max-height: min(610px, calc(100svh - 54px)); }
    .companion-bubble { right: 12px; bottom: calc(100% - 12px); width: min(280px, calc(100vw - 24px)); max-height: calc(52svh - 12px); overflow-y: auto; }
    .companion-bubble::after { right: 40px; bottom: -7px; transform: rotate(135deg); }
    .companion-bubble p { font-size: 13px; }
    .live2d-widget[data-body="full"] .companion-bubble { bottom: 56%; right: 12px; }
}
