/**
 * =========================================================
 * SUNIVA Experience Engine
 * Guide Styles v1.0.0
 *
 * 配置先
 * /html/assets/css/suniva/guide.css
 * =========================================================
 */


/* =========================================================
   Guide共通変数
   ========================================================= */

.suniva-guide-widget {
    --suniva-guide-primary: #c9a96e;
    --suniva-guide-secondary: #f5e8df;
    --suniva-guide-accent: #efb7c5;
    --suniva-guide-text: #473d38;
    --suniva-guide-background: #fffdfb;

    position: fixed;
    z-index: 9000;
    right:
        max(22px, env(safe-area-inset-right));
    bottom:
        max(22px, env(safe-area-inset-bottom));
    color: var(--suniva-guide-text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        "Yu Gothic",
        "YuGothic",
        "Hiragino Kaku Gothic ProN",
        "Hiragino Sans",
        Meiryo,
        sans-serif;
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    isolation: isolate;
}

.suniva-guide-widget *,
.suniva-guide-widget *::before,
.suniva-guide-widget *::after {
    box-sizing: border-box;
}


/* =========================================================
   Launcher
   ========================================================= */

.suniva-guide-launcher {
    position: relative;
    display: grid;
    width: 76px;
    height: 76px;
    padding: 0;
    place-items: center;
    overflow: visible;
    border:
        1px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    color: var(--suniva-guide-text);
    background:
        linear-gradient(
            145deg,
            #ffffff,
            var(--suniva-guide-secondary)
        );
    box-shadow:
        0 18px 48px
        rgba(83, 62, 44, 0.2),
        0 0 0 6px
        rgba(255, 255, 255, 0.5);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        box-shadow 300ms ease,
        transform 300ms
            cubic-bezier(0.22, 1, 0.36, 1);
}

.suniva-guide-launcher:hover {
    box-shadow:
        0 22px 58px
        rgba(83, 62, 44, 0.25),
        0 0 0 8px
        rgba(255, 255, 255, 0.62);
    transform:
        translateY(-4px)
        scale(1.025);
}

.suniva-guide-launcher:focus-visible {
    outline:
        3px solid
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            60%,
            transparent
        );
    outline-offset: 6px;
}

.suniva-guide-launcher-visual {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    overflow: hidden;
    border-radius: inherit;
    font-size: 35px;
}

.suniva-guide-character-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.suniva-guide-status {
    position: absolute;
    right: 1px;
    bottom: 3px;
    width: 17px;
    height: 17px;
    border:
        3px solid #ffffff;
    border-radius: 50%;
    background: #73b889;
    box-shadow:
        0 3px 10px
        rgba(39, 94, 56, 0.25);
}


/* =========================================================
   呼びかけアニメーション
   ========================================================= */

.suniva-guide-widget.is-calling
    .suniva-guide-launcher {
    animation:
        sunivaGuideCall 2.4s
        ease-in-out infinite;
}

.suniva-guide-widget.is-calling
    .suniva-guide-launcher::before,
.suniva-guide-widget.is-speaking
    .suniva-guide-launcher::before {
    position: absolute;
    z-index: -1;
    inset: -8px;
    content: "";
    border:
        1px solid
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            52%,
            transparent
        );
    border-radius: 50%;
    opacity: 0;
    animation:
        sunivaGuideRing 2.2s
        ease-out infinite;
}

.suniva-guide-widget.is-speaking
    .suniva-guide-launcher {
    box-shadow:
        0 20px 55px
        rgba(83, 62, 44, 0.23),
        0 0 34px
        color-mix(
            in srgb,
            var(--suniva-guide-accent)
            48%,
            transparent
        );
}

@keyframes sunivaGuideCall {
    0%,
    100% {
        transform:
            translateY(0)
            rotate(0);
    }

    8% {
        transform:
            translateY(-3px)
            rotate(-3deg);
    }

    16% {
        transform:
            translateY(-3px)
            rotate(3deg);
    }

    24% {
        transform:
            translateY(0)
            rotate(0);
    }
}

@keyframes sunivaGuideRing {
    0% {
        opacity: 0.65;
        transform: scale(0.88);
    }

    100% {
        opacity: 0;
        transform: scale(1.28);
    }
}


/* =========================================================
   Idle Prompt
   ========================================================= */

.suniva-guide-idle-prompt {
    position: absolute;
    right: 0;
    bottom: calc(100% + 17px);
    width: max-content;
    max-width: min(280px, 76vw);
    padding: 13px 18px;
    border:
        1px solid rgba(139, 106, 55, 0.14);
    border-radius: 18px 18px 5px 18px;
    color: var(--suniva-guide-text);
    background:
        rgba(255, 253, 251, 0.96);
    box-shadow:
        0 16px 46px
        rgba(67, 49, 35, 0.16);
    -webkit-backdrop-filter:
        blur(16px);
    backdrop-filter:
        blur(16px);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    animation:
        sunivaGuidePromptIn
        500ms
        cubic-bezier(0.22, 1, 0.36, 1)
        both;
}

.suniva-guide-idle-prompt[hidden] {
    display: none;
}

.suniva-guide-idle-prompt::after {
    position: absolute;
    right: 25px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    content: "";
    border-right:
        1px solid rgba(139, 106, 55, 0.12);
    border-bottom:
        1px solid rgba(139, 106, 55, 0.12);
    background:
        rgba(255, 253, 251, 0.96);
    transform: rotate(45deg);
}

@keyframes sunivaGuidePromptIn {
    from {
        opacity: 0;
        transform:
            translateY(10px)
            scale(0.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}


/* =========================================================
   Panel
   ========================================================= */

.suniva-guide-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 18px);
    display: grid;
    width:
        min(390px, calc(100vw - 32px));
    height:
        min(620px, calc(100svh - 130px));
    grid-template-rows:
        auto minmax(0, 1fr) auto auto;
    overflow: hidden;
    border:
        1px solid rgba(139, 106, 55, 0.14);
    border-radius: 28px 28px 8px 28px;
    background:
        color-mix(
            in srgb,
            var(--suniva-guide-background)
            95%,
            transparent
        );
    box-shadow:
        0 28px 90px
        rgba(62, 44, 31, 0.22);
    -webkit-backdrop-filter:
        blur(24px);
    backdrop-filter:
        blur(24px);
    opacity: 0;
    transform:
        translateY(16px)
        scale(0.97);
    transform-origin:
        right bottom;
    transition:
        opacity 280ms ease,
        transform 420ms
            cubic-bezier(0.22, 1, 0.36, 1);
}

.suniva-guide-panel[hidden] {
    display: none;
}

.suniva-guide-panel.is-visible {
    opacity: 1;
    transform: none;
}


/* =========================================================
   Header
   ========================================================= */

.suniva-guide-header {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 15px 14px 18px;
    border-bottom:
        1px solid rgba(139, 106, 55, 0.1);
    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--suniva-guide-secondary)
                64%,
                #ffffff
            ),
            rgba(255, 255, 255, 0.76)
        );
}

.suniva-guide-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.suniva-guide-avatar {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border:
        2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow:
        0 8px 22px
        rgba(83, 62, 44, 0.14);
}

.suniva-guide-identity-text {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.suniva-guide-name {
    overflow: hidden;
    color: var(--suniva-guide-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suniva-guide-role {
    color:
        color-mix(
            in srgb,
            var(--suniva-guide-text)
            62%,
            transparent
        );
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.suniva-guide-close {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border:
        1px solid rgba(139, 106, 55, 0.12);
    border-radius: 50%;
    color:
        color-mix(
            in srgb,
            var(--suniva-guide-text)
            68%,
            transparent
        );
    background:
        rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 23px;
    font-weight: 300;
    line-height: 1;
    transition:
        color 220ms ease,
        background-color 220ms ease,
        transform 220ms ease;
}

.suniva-guide-close:hover {
    color: var(--suniva-guide-text);
    background: #ffffff;
    transform: rotate(6deg);
}


/* =========================================================
   Messages
   ========================================================= */

.suniva-guide-messages {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 12px;
    padding: 20px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color:
        rgba(139, 106, 55, 0.2)
        transparent;
    scrollbar-width: thin;
}

.suniva-guide-messages::-webkit-scrollbar {
    width: 5px;
}

.suniva-guide-messages::-webkit-scrollbar-track {
    background: transparent;
}

.suniva-guide-messages::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background:
        rgba(139, 106, 55, 0.2);
}

.suniva-guide-message {
    width: fit-content;
    max-width: 88%;
    padding: 12px 15px;
    border-radius: 18px;
    opacity: 0;
    animation:
        sunivaGuideMessageIn
        450ms
        cubic-bezier(0.22, 1, 0.36, 1)
        forwards;
}

.suniva-guide-message--guide {
    align-self: flex-start;
    border:
        1px solid rgba(139, 106, 55, 0.1);
    border-radius: 18px 18px 18px 5px;
    color: var(--suniva-guide-text);
    background:
        rgba(255, 255, 255, 0.9);
    box-shadow:
        0 8px 22px
        rgba(76, 56, 41, 0.07);
}

.suniva-guide-message--user {
    align-self: flex-end;
    border-radius: 18px 18px 5px 18px;
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--suniva-guide-primary)
                82%,
                #6f522f
            ),
            var(--suniva-guide-primary)
        );
    box-shadow:
        0 8px 22px
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            22%,
            transparent
        );
}

.suniva-guide-message-title {
    display: block;
    margin-bottom: 5px;
    color:
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            72%,
            #594128
        );
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.suniva-guide-message-body {
    font-size: 13px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

@keyframes sunivaGuideMessageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}


/* =========================================================
   Thinking
   ========================================================= */

.suniva-guide-thinking {
    display: flex;
    min-width: 42px;
    height: 18px;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.suniva-guide-thinking i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background:
        var(--suniva-guide-primary);
    animation:
        sunivaGuideThinking
        1.15s ease-in-out infinite;
}

.suniva-guide-thinking
    i:nth-child(2) {
    animation-delay: 120ms;
}

.suniva-guide-thinking
    i:nth-child(3) {
    animation-delay: 240ms;
}

@keyframes sunivaGuideThinking {
    0%,
    65%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    32% {
        opacity: 1;
        transform: translateY(-5px);
    }
}


/* =========================================================
   Actions
   ========================================================= */

.suniva-guide-actions {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border-top:
        1px solid rgba(139, 106, 55, 0.08);
    background:
        rgba(255, 255, 255, 0.5);
    overflow-x: auto;
    scrollbar-width: none;
}

.suniva-guide-actions::-webkit-scrollbar {
    display: none;
}

.suniva-guide-action {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 14px;
    border:
        1px solid rgba(139, 106, 55, 0.14);
    border-radius: 999px;
    color: var(--suniva-guide-text);
    background:
        rgba(255, 255, 255, 0.82);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    transition:
        color 220ms ease,
        background-color 220ms ease,
        border-color 220ms ease,
        box-shadow 220ms ease,
        transform 220ms ease;
}

.suniva-guide-action:hover {
    border-color:
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            48%,
            transparent
        );
    background: #ffffff;
    box-shadow:
        0 7px 18px
        rgba(76, 56, 41, 0.08);
    transform: translateY(-1px);
}

.suniva-guide-start {
    color: #ffffff;
    border-color: transparent;
    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--suniva-guide-primary)
                82%,
                #76562f
            ),
            var(--suniva-guide-primary)
        );
}

.suniva-guide-start:hover {
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--suniva-guide-primary)
                72%,
                #604425
            ),
            var(--suniva-guide-primary)
        );
}

.suniva-guide-stop {
    color:
        color-mix(
            in srgb,
            var(--suniva-guide-text)
            68%,
            transparent
        );
}

.suniva-guide-voice {
    min-width: 38px;
    padding-inline: 10px;
}

.suniva-guide-action[hidden] {
    display: none;
}

.suniva-guide-widget.is-voice-muted
    .suniva-guide-voice {
    opacity: 0.55;
}


/* =========================================================
   Question Form
   ========================================================= */

.suniva-guide-question-form {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) auto;
    gap: 8px;
    padding:
        10px 12px
        max(
            12px,
            env(safe-area-inset-bottom)
        );
    border-top:
        1px solid rgba(139, 106, 55, 0.09);
    background:
        rgba(255, 253, 251, 0.84);
}

.suniva-guide-question-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 14px;
    border:
        1px solid rgba(139, 106, 55, 0.16);
    border-radius: 999px;
    outline: none;
    color: var(--suniva-guide-text);
    background:
        rgba(255, 255, 255, 0.9);
    font-size: 13px;
    transition:
        border-color 220ms ease,
        box-shadow 220ms ease,
        background-color 220ms ease;
}

.suniva-guide-question-input::placeholder {
    color:
        color-mix(
            in srgb,
            var(--suniva-guide-text)
            42%,
            transparent
        );
}

.suniva-guide-question-input:focus {
    border-color:
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            56%,
            transparent
        );
    background: #ffffff;
    box-shadow:
        0 0 0 4px
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            12%,
            transparent
        );
}

.suniva-guide-question-input:disabled {
    cursor: wait;
    opacity: 0.6;
}

.suniva-guide-question-send {
    min-width: 58px;
    min-height: 44px;
    padding: 9px 14px;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            color-mix(
                in srgb,
                var(--suniva-guide-primary)
                82%,
                #76562f
            ),
            var(--suniva-guide-primary)
        );
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition:
        box-shadow 220ms ease,
        opacity 220ms ease,
        transform 220ms ease;
}

.suniva-guide-question-send:hover {
    box-shadow:
        0 8px 20px
        color-mix(
            in srgb,
            var(--suniva-guide-primary)
            24%,
            transparent
        );
    transform: translateY(-1px);
}

.suniva-guide-question-send:disabled {
    cursor: wait;
    opacity: 0.5;
    transform: none;
}


/* =========================================================
   商品紹介ボタン
   ========================================================= */

[data-suniva-product-guide] {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border:
        1px solid
        var(--suniva-guide-primary, #c9a96e);
    border-radius: 999px;
    color:
        var(--suniva-guide-primary, #8b6a37);
    background:
        rgba(255, 255, 255, 0.86);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition:
        color 220ms ease,
        background-color 220ms ease,
        box-shadow 220ms ease,
        transform 220ms ease;
}

[data-suniva-product-guide]::before {
    content: "🌸";
}

[data-suniva-product-guide]:hover {
    color: #ffffff;
    background:
        var(--suniva-guide-primary, #c9a96e);
    box-shadow:
        0 10px 24px
        rgba(139, 106, 55, 0.18);
    transform: translateY(-2px);
}


/* =========================================================
   Guide実行状態
   ========================================================= */

.suniva-guide-widget.is-guiding
    .suniva-guide-status {
    background:
        var(--suniva-guide-primary);
    animation:
        sunivaGuideStatus
        1.7s ease-in-out infinite;
}

.suniva-guide-widget.is-speaking
    .suniva-guide-status {
    background:
        var(--suniva-guide-accent);
}

@keyframes sunivaGuideStatus {
    0%,
    100% {
        box-shadow:
            0 0 0 0
            color-mix(
                in srgb,
                var(--suniva-guide-primary)
                38%,
                transparent
            );
    }

    50% {
        box-shadow:
            0 0 0 7px
            transparent;
    }
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 1024px) {
    .suniva-guide-widget {
        right:
            max(
                18px,
                env(safe-area-inset-right)
            );
        bottom:
            max(
                18px,
                env(safe-area-inset-bottom)
            );
    }

    .suniva-guide-launcher {
        width: 70px;
        height: 70px;
    }

    .suniva-guide-panel {
        height:
            min(
                590px,
                calc(100svh - 115px)
            );
    }
}


/* =========================================================
   Smartphone
   ========================================================= */

@media (max-width: 767px) {
    .suniva-guide-widget {
        right:
            max(
                12px,
                env(safe-area-inset-right)
            );
        bottom:
            max(
                12px,
                env(safe-area-inset-bottom)
            );
    }

    .suniva-guide-launch-guide-launcher {
        width: 64px;
        height: 64px;
        box-shadow:
            0 14px 38px
            rgba(83, 62, 44, 0.2),
            0 0 0 4px
            rgba(255, 255, 255, 0.52);
    }

    .suniva-guide-launcher-visual {
        font-size: 30px;
    }

    .suniva-guide-status {
        width: 15px;
        height: 15px;
        border-width: 3px;
    }

    .suniva-guide-idle-prompt {
        bottom:
            calc(100% + 13px);
        max-width:
            min(250px, 72vw);
        padding: 11px 15px;
        border-radius:
            16px 16px 5px 16px;
        font-size: 12px;
    }

    .suniva-guide-panel {
        position: fixed;
        right: 8px;
        bottom:
            max(
                84px,
                calc(
                    env(safe-area-inset-bottom)
                    + 76px
                )
            );
        left: 8px;
        width: auto;
        height:
            min(
                610px,
                calc(
                    100svh -
                    104px -
                    env(safe-area-inset-top) -
                    env(safe-area-inset-bottom)
                )
            );
        border-radius: 24px;
        transform:
            translateY(18px)
            scale(0.98);
    }

    .suniva-guide-header {
        min-height: 70px;
        padding: 11px 12px 11px 14px;
    }

    .suniva-guide-avatar {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }

    .suniva-guide-name {
        font-size: 14px;
    }

    .suniva-guide-role {
        font-size: 9px;
    }

    .suniva-guide-close {
        width: 36px;
        height: 36px;
        font-size: 21px;
    }

    .suniva-guide-messages {
        gap: 10px;
        padding: 15px 13px;
    }

    .suniva-guide-message {
        max-width: 90%;
        padding: 10px 13px;
        border-radius: 16px;
    }

    .suniva-guide-message--guide {
        border-radius:
            16px 16px 16px 5px;
    }

    .suniva-guide-message--user {
        border-radius:
            16px 16px 5px 16px;
    }

    .suniva-guide-message-body {
        font-size: 12px;
        line-height: 1.7;
    }

    .suniva-guide-actions {
        min-height: 52px;
        padding: 7px 9px;
    }

    .suniva-guide-action {
        min-height: 36px;
        padding: 7px 12px;
        font-size: 10px;
    }

    .suniva-guide-question-form {
        gap: 6px;
        padding:
            8px 9px
            max(
                9px,
                env(safe-area-inset-bottom)
            );
    }

    .suniva-guide-question-input {
        min-height: 42px;
        padding: 9px 12px;
        font-size: 12px;
    }

    .suniva-guide-question-send {
        min-width: 54px;
        min-height: 42px;
        padding-inline: 11px;
        font-size: 10px;
    }
}


/* =========================================================
   極小スマートフォン
   ========================================================= */

@media (max-width: 370px) {
    .suniva-guide-panel {
        right: 5px;
        left: 5px;
    }

    .suniva-guide-question-send {
        min-width: 48px;
        padding-inline: 8px;
    }

    .suniva-guide-role {
        display: none;
    }
}


/* =========================================================
   横向きスマートフォン
   ========================================================= */

@media (
    max-height: 520px
) and (
    orientation: landscape
) {
    .suniva-guide-widget {
        right: 10px;
        bottom: 10px;
    }

    .suniva-guide-launcher {
        width: 54px;
        height: 54px;
    }

    .suniva-guide-panel {
        position: fixed;
        top: 7px;
        right: 72px;
        bottom: 7px;
        left: auto;
        width:
            min(390px, calc(100vw - 90px));
        height: auto;
        border-radius: 22px;
    }

    .suniva-guide-header {
        min-height: 62px;
    }

    .suniva-guide-avatar {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .suniva-guide-messages {
        padding: 12px;
    }

    .suniva-guide-actions {
        min-height: 46px;
    }
}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (
    prefers-reduced-motion: reduce
) {
    .suniva-guide-launcher,
    .suniva-guide-panel,
    .suniva-guide-message,
    .suniva-guide-action,
    .suniva-guide-question-send,
    .suniva-guide-close {
        transition-duration: 0.01ms;
    }

    .suniva-guide-widget.is-calling
        .suniva-guide-launcher,
    .suniva-guide-widget.is-calling
        .suniva-guide-launcher::before,
    .suniva-guide-widget.is-speaking
        .suniva-guide-launcher::before,
    .suniva-guide-thinking i,
    .suniva-guide-widget.is-guiding
        .suniva-guide-status {
        animation: none;
    }

    .suniva-guide-message {
        opacity: 1;
    }
}


/* =========================================================
   Print
   ========================================================= */

@media print {
    .suniva-guide-widget {
        display: none !important;
    }
}