/* YGG Portal - Rigel assistant (extracted from the homepage; later rules override earlier ones, as before) */
/* Main Rigel container */
#ygg-rigel-assistant {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 9000;
    pointer-events: none;
    font-family: Arial, Helvetica, sans-serif;
}

/* Character area */
#ygg-rigel-character {
    position: relative;
    width: 285px;
    height: 410px;
    pointer-events: none;
}

/*
 * Two images are stacked.
 * JS crossfades between them instead of replacing one image,
 * preventing ugly flashing during expression changes.
 */
.ygg-rigel-layer {
    position: absolute;
    left: 0;
    bottom: 0;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: left bottom;

    opacity: 0;

    transition:
        opacity 220ms ease-in-out,
        transform 260ms ease-out;

    transform: translateY(0);

    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.ygg-rigel-layer.is-visible {
    opacity: 1;
}

/* Dialogue bubble */
#ygg-rigel-dialogue {
    position: absolute;

    /*
     * Bubble appears to Rigel's RIGHT.
     */
    left: 245px;
    bottom: 185px;

    /*
     * Short messages stay compact.
     * Long responses such as Server Info expand naturally.
     */
    width: max-content;
    min-width: 235px;
    max-width: min(430px, calc(100vw - 285px));

    height: auto;

    box-sizing: border-box;

    padding: 16px 18px;

    color: #443329;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.98) 0%,
            rgba(255,250,235,.98) 100%
        );

    border: 2px solid #b99c72;
    border-radius: 16px;

    box-shadow:
        0 5px 18px rgba(0,0,0,.22),
        inset 0 0 0 2px rgba(255,255,255,.7);

    pointer-events: auto;

    transition:
        width 220ms ease,
        max-width 220ms ease,
        opacity 180ms ease,
        transform 180ms ease;
}

/* Speech pointer aimed toward Rigel */
#ygg-rigel-dialogue::before {
    content: "";

    position: absolute;

    left: -17px;
    bottom: 38px;

    width: 0;
    height: 0;

    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 17px solid #b99c72;
}

#ygg-rigel-dialogue::after {
    content: "";

    position: absolute;

    left: -13px;
    bottom: 40px;

    width: 0;
    height: 0;

    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 14px solid #fffaf0;
}

/* Rigel name */
.ygg-rigel-name {
    margin: 0 0 6px;

    color: #8c4c2d;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 900;
}

/* Dialogue */
.ygg-rigel-text {
    margin: 0 0 12px;

    font-size: 14px;
    line-height: 1.45;

    color: #443329;
}

/* Main option stack */
.ygg-rigel-options {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* Choice buttons */
.ygg-rigel-choice,
.ygg-rigel-back,
.ygg-rigel-link {
    display: block;

    width: 100%;

    box-sizing: border-box;

    padding: 8px 11px;

    border: 1px solid #cbb38d;
    border-radius: 8px;

    background:
        linear-gradient(
            180deg,
            #fffdf6 0%,
            #f3e5ca 100%
        );

    color: #60442f;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 700;

    text-align: left;
    text-decoration: none;

    cursor: pointer;

    transition:
        transform .12s ease,
        background .12s ease,
        border-color .12s ease;
}

.ygg-rigel-choice:hover,
.ygg-rigel-back:hover,
.ygg-rigel-link:hover {
    background:
        linear-gradient(
            180deg,
            #fff7dc 0%,
            #ead09e 100%
        );

    border-color: #a67a43;

    transform: translateX(2px);
}

/* Primary external/action link */
.ygg-rigel-link {
    margin-top: 10px;

    text-align: center;

    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            #9d6744 0%,
            #704129 100%
        );

    border-color: #60351f;
}

.ygg-rigel-link:hover {
    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            #b57a51 0%,
            #7d482c 100%
        );
}

/* Back always appears at bottom of detail screens */
.ygg-rigel-back {
    width: auto;

    margin-top: 13px;
    padding: 7px 12px;

    text-align: left;

    background: transparent;
}

/* Server info layout */
.ygg-rigel-server-info {
    width: 365px;
    max-width: 100%;
}

.ygg-rigel-server-title {
    margin: 0 0 9px;

    color: #7d482c;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    font-weight: 900;
}

.ygg-rigel-info-grid {
    display: grid;
    grid-template-columns: auto 1fr;

    gap: 4px 12px;

    font-size: 12.5px;
    line-height: 1.35;
}

.ygg-rigel-info-grid strong {
    white-space: nowrap;
    color: #755239;
}

.ygg-rigel-info-note {
    margin-top: 9px;

    padding-top: 8px;

    border-top: 1px solid rgba(120,90,55,.22);

    font-size: 12px;
    line-height: 1.4;
}

/* Small entrance animation */
@keyframes yggRigelEntrance {
    from {
        transform: translateX(-35px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#ygg-rigel-character {
    animation: yggRigelEntrance .55s ease-out both;
}

/* Mobile */
@media (max-width: 600px) {

    #ygg-rigel-character {
        width: 180px;
        height: 270px;
    }

    #ygg-rigel-dialogue {
        left: 145px;
        bottom: 120px;

        min-width: 180px;
        width: max-content;

        max-width: calc(100vw - 160px);

        padding: 11px 12px;

        border-radius: 12px;
    }

    .ygg-rigel-name {
        font-size: 14px;
    }

    .ygg-rigel-text {
        font-size: 11px;
    }

    .ygg-rigel-choice,
    .ygg-rigel-back,
    .ygg-rigel-link {
        padding: 7px 8px;
        font-size: 10.5px;
    }

    .ygg-rigel-server-info {
        width: 250px;
    }

    .ygg-rigel-info-grid {
        grid-template-columns: 1fr;
        gap: 1px;
        font-size: 10px;
    }

    .ygg-rigel-info-grid strong {
        margin-top: 4px;
    }

    .ygg-rigel-info-note {
        font-size: 9.5px;
    }
}

@media (prefers-reduced-motion: reduce) {

    #ygg-rigel-character,
    .ygg-rigel-layer,
    #ygg-rigel-dialogue {
        animation: none !important;
        transition: none !important;
    }
}
/* YGG RIGEL ASSISTANT - 25% SMALLER */
#ygg-rigel-assistant {
    transform: scale(0.75) !important;
    transform-origin: bottom left !important;
}
/* YGG RIGEL SIZE OVERRIDE - TEST 2 */
@media (min-width: 701px) {
    #ygg-rigel-character {
        width: 570px !important;
        height: 820px !important;
    }

    #ygg-rigel-dialogue {
        left: 470px !important;
        bottom: 360px !important;
    }
}
/* =========================================================
   YGG RIGEL DISPLAY FIX
   Preserve original 1245x625 aspect ratio.
   ========================================================= */

@media (min-width: 701px) {

    #ygg-rigel-character {
        width: 1000px !important;
        height: 502px !important;
    }

    #ygg-rigel-character .ygg-rigel-layer {
        width: 1000px !important;
        height: 502px !important;

        object-fit: contain !important;
        object-position: left bottom !important;

        image-rendering: auto !important;
    }

    #ygg-rigel-dialogue {
        left: 430px !important;
        bottom: 265px !important;
    }

}
/* YGG RIGEL - MOVE ENTIRE WIDGET LEFT */
@media (min-width: 701px) {
    #ygg-rigel-assistant {
        left: -220px !important;
    }
}
/* YGG RIGEL - MOVE FURTHER LEFT */
@media (min-width: 701px) {
    #ygg-rigel-assistant {
        left: -400px !important;
    }
}
/* YGG RIGEL - MOVE DIALOGUE ONLY TO THE RIGHT */
@media (min-width: 701px) {
    #ygg-rigel-dialogue {
        left: 650px !important;
    }
}
/* =========================================================
   YGG RIGEL - NATURAL EXPRESSION TRANSITION
   Intermediate frames move quickly.
   Final expression settles smoothly.
   ========================================================= */

.ygg-rigel-layer {
    transition: opacity 90ms ease-out !important;
}
/* =========================================================
   YGG RIGEL - CLEAN SPRITE-STYLE FACE TRANSITION
   No crossfade/ghost faces.
   ========================================================= */

.ygg-rigel-layer {
    transition: none !important;
}
/* =========================================================
   YGG RIGEL - DESKTOP ONLY
   Hide Rigel and dialogue completely on mobile.
   ========================================================= */

@media (max-width: 700px) {
    #ygg-rigel-assistant {
        display: none !important;
    }
}
/* =========================================================
   YGG RIGEL - DESKTOP ONLY
   Hide Rigel and dialogue completely on mobile.
   ========================================================= */

@media (max-width: 700px) {
    #ygg-rigel-assistant {
        display: none !important;
    }
}
/* =========================================================
   YGG RIGEL - RESPONSIVE COLLISION PROTECTION

   Rigel requires enough horizontal space for:
   character + dialogue + login interface.

   Hide the entire assistant on smaller desktop/tablet/mobile
   screens instead of shrinking or overlapping the login.
   ========================================================= */

@media (max-width: 1399px) {
    #ygg-rigel-assistant {
        display: none !important;
    }
}

@media (min-width: 1400px) {
    #ygg-rigel-assistant {
        display: block !important;
    }
}
/* YGG RIGEL - MOVE 15% RIGHT */
#ygg-rigel-assistant {
    transform: translateX(30%) scale(0.375) !important;
    transform-origin: bottom left !important;
}
/* YGG RIGEL - ALLOW SMALL BROWSER RESOLUTIONS */
@media screen {
    #ygg-rigel-assistant {
        display: block !important;
        visibility: visible !important;
    }
}
/* YGG RIGEL - RESPONSIVE VISIBILITY V2 */

/* Hide Rigel when browser viewport is too small */
@media screen and (max-width: 899px),
       screen and (max-height: 649px) {

    #ygg-rigel-assistant {
        display: none !important;
    }

}

/* Show Rigel when enough space is available */
@media screen and (min-width: 900px) and (min-height: 650px) {

    #ygg-rigel-assistant {
        display: block !important;
        visibility: visible !important;
    }

}
/* YGG RIGEL CLOSE BUTTON V1 */
#ygg-rigel-dialogue {
    position: absolute;
}

#ygg-rigel-close {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    background: rgba(90, 55, 35, 0.10);
    color: #75452b;
    font-size: 19px;
    font-weight: bold;
    line-height: 25px;
    text-align: center;
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
}

#ygg-rigel-close:hover {
    background: rgba(140, 75, 35, 0.22);
    color: #a34e24;
}
/* YGG RIGEL — CALLOUT SIZE ADJUSTMENT */
#ygg-rigel-dialogue {
    transform: translateX(1px) scale(1.65) !important;
    transform-origin: left top !important;
}

/* ---------- Homepage rebuild: Rigel can be minimised to a launcher ---------- */
#ygg-rigel-assistant.is-collapsed { display: none !important; }
#rigel-launcher {
    position: fixed; left: 18px; bottom: 82px; z-index: 9001;
    display: flex; align-items: center; gap: 10px;
    padding: 6px 16px 6px 6px; border: 2px solid #b99c72; border-radius: 999px;
    background: linear-gradient(180deg, #fffdf6, #f3e5ca); color: #60442f;
    font: 700 13px Arial, Helvetica, sans-serif; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
#rigel-launcher[hidden] { display: none; }
#rigel-launcher:hover { filter: brightness(1.05); }
#rigel-launcher .face {
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid #cbb38d;
    background: #fff url('/ragnarok/assets/photos/rigel/rigel01.png') no-repeat;
    background-size: 700px auto; background-position: -323px -40px;
}
@media screen and (max-width: 899px), screen and (max-height: 649px) {
    #rigel-launcher { display: none; }
}
/* Compact launcher (face only) until the side margin is wide enough for the label. */
@media (max-width: 1699px) {
    #rigel-launcher { padding: 5px; left: 12px; }
    #rigel-launcher .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
