.faq-widget {
    position: fixed;
    right: clamp(14px, 2vw, 28px);
    bottom: 18px;
    z-index: 80;
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.faq-widget__button {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(14, 165, 233, 0.36);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.faq-widget__button:hover,
.faq-widget__button:focus-visible {
    background: #0284c7;
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.42);
    transform: translateY(-1px);
    outline: none;
}

.faq-widget__panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(380px, calc(100vw - 28px));
    height: min(720px, calc(100vh - 110px));
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
    overflow: hidden;
    display: none;
}

.faq-widget--open .faq-widget__panel {
    display: flex;
    flex-direction: column;
}

.faq-widget__header {
    background: linear-gradient(90deg, #4fa7ff, #17c7ea);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.faq-widget__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.faq-widget__header-actions {
    display: flex;
    gap: 8px;
}

.faq-widget__header-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.faq-widget__header-btn:hover,
.faq-widget__header-btn:focus-visible {
    background: rgba(255, 255, 255, 0.34);
    outline: none;
}

.faq-widget__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(to bottom, #eef2f6 0%, #ffffff 30%);
}

.faq-widget__message {
    max-width: 84%;
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-line;
}

.faq-widget__message--ai {
    background: #ffffff;
    color: #222222;
    border: 1px solid #dde6f0;
    border-top-left-radius: 8px;
}

.faq-widget__message--ai a {
    color: #0066cc;
    text-decoration: underline;
}

.faq-widget__message--ai a:hover {
    color: #004499;
}

.faq-widget__message--ai a.faq-widget__subtle-btn,
.faq-widget__message--ai a.faq-widget__contact-btn {
    color: #ffffff;
    text-decoration: none;
}

.faq-widget__message--user {
    margin-left: auto;
    background: #e8f5ff;
    color: #222222;
    border: 1px solid #c9e7ff;
    border-top-right-radius: 8px;
}

.faq-widget__choice-title {
    margin: 10px 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #7b8794;
    letter-spacing: 0.03em;
}

.faq-widget__choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-widget__choice-btn {
    width: 100%;
    border: 1px solid #dde6f0;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    color: #222222;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s, transform 0.1s;
}

.faq-widget__choice-btn:hover,
.faq-widget__choice-btn:focus-visible {
    background: #f8fbff;
    outline: none;
}

.faq-widget__choice-btn:active {
    transform: scale(0.99);
}

.faq-widget__choice-btn .faq-widget__arrow {
    color: #2b97d9;
    font-size: 18px;
    line-height: 1;
    margin-left: 12px;
    flex-shrink: 0;
}

.faq-widget__actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-widget__subtle-btn,
.faq-widget__contact-btn {
    border: none;
    border-radius: 10px;
    padding: 0 12px;
    min-height: 48px;
    font-size: 14px;
    font-weight: 700;
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    background-image: none;
    line-height: normal;
    margin: 0;
}

.faq-widget__subtle-btn {
    background-color: #5bc0f8;
    color: #ffffff;
}

.faq-widget__contact-btn {
    background-color: #ff4b4b;
    color: #ffffff;
}

.faq-widget__subtle-btn:hover,
.faq-widget__subtle-btn:focus-visible {
    background-color: #4ab0e8;
    outline: none;
}

.faq-widget__contact-btn:hover,
.faq-widget__contact-btn:focus-visible {
    background-color: #e84040;
    outline: none;
}

.faq-widget__note {
    margin-top: 8px;
    font-size: 12px;
    color: #7b8794;
    line-height: 1.5;
}

.faq-widget__input-area {
    border-top: 1px solid #e5ebf2;
    background: #ffffff;
    padding: 12px;
    flex: 0 0 auto;
}

.faq-widget__input-box {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1px solid #dbe5ef;
    border-radius: 16px;
    background: #ffffff;
    padding: 10px 12px;
}

.faq-widget__textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    font-size: 14px;
    font-family: inherit;
    color: #222222;
    min-height: 36px;
    max-height: 80px;
    line-height: 1.5;
    background: transparent;
    padding: 6px 0;
}

.faq-widget__textarea::-webkit-inner-spin-button,
.faq-widget__textarea::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.faq-widget__textarea::placeholder {
    color: #9aa6b2;
}

.faq-widget__send-btn {
    border: none;
    border-radius: 10px;
    background: #1fa8ff;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 10px 18px;
    min-width: 54px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: normal;
    margin: 0;
}

.faq-widget__send-btn:hover,
.faq-widget__send-btn:focus-visible {
    background: #1496e8;
    outline: none;
}

.faq-widget__send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.faq-widget__helper {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #7b8794;
}

@media screen and (max-width: 420px) {
    .faq-widget {
        right: 12px;
        bottom: 14px;
    }

    .faq-widget__button {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    .faq-widget__panel {
        bottom: 64px;
        height: calc(100vh - 92px);
        border-radius: 16px;
    }

    .faq-widget__title {
        font-size: 18px;
    }
}
