﻿/* =========================================================
   沐眠之地｜登入頁
   login.css

   功能：
   01. 登入首頁
   02. 開始旅程
   03. 音樂 / 公告
   04. 舊玩家登入
   05. 公告視窗
   06. 手機版
========================================================= */


/* =========================================================
   01. 基礎設定
========================================================= */

* {
    box-sizing: border-box;
}


html,
body {
    width: 100%;
    height: 100%;

    margin: 0;
    padding: 0;
}


body {
    overflow: hidden;

    background: #10162a;

    transition: opacity 0.6s ease;
}


body.leaving {
    opacity: 0;
}



/* =========================================================
   02. 登入主畫面
========================================================= */

.login-page {
    position: relative;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    overflow: hidden;

    background-image:
        url("../assets/login/login-desktop.webp");

    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;

    opacity: 1;
}



/* =========================================================
   03. 開始旅程
========================================================= */

.start-button {
    position: absolute;

    left: 50%;
    bottom: -6%;

    transform:
        translateX(-50%);

    width:
        clamp(
            320px,
            35vw,
            570px
        );

    margin: 0;
    padding: 0;

    border: none;
    outline: none;

    background: transparent;

    cursor: pointer;

    z-index: 10;

    animation:
        buttonBreathing
        3s
        ease-in-out
        infinite;

    transition:
        filter 0.3s ease,
        transform 0.25s ease;
}


.start-button img {
    display: block;

    width: 100%;
    height: auto;

    pointer-events: none;
    user-select: none;
}


.start-button:hover {
    transform:
        translateX(-50%)
        scale(1.035);

    filter:
        brightness(1.08)
        drop-shadow(
            0 0 16px
            rgba(255, 240, 205, 0.55)
        );
}


.start-button:active {
    transform:
        translateX(-50%)
        scale(0.97);
}


@keyframes buttonBreathing {

    0%,
    100% {

        filter:
            brightness(1)
            drop-shadow(
                0 0 5px
                rgba(255, 239, 205, 0.18)
            );
    }

    50% {

        filter:
            brightness(1.06)
            drop-shadow(
                0 0 15px
                rgba(255, 239, 205, 0.42)
            );
    }
}



/* =========================================================
   04. 音樂 / 公告按鈕
========================================================= */

.login-tools {
    position: absolute;

    top: 5%;
    right: 3%;

    z-index: 20;

    display: flex;

    flex-direction: column;

    gap: 18px;
}


.tool-button {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    width: 64px;
    min-height: 64px;

    padding:
        7px
        4px;

    border:
        1px solid
        rgba(255, 255, 255, 0.65);

    border-radius: 50%;

    color: #ffffff;

    background:
        rgba(55, 62, 105, 0.22);

    backdrop-filter:
        blur(5px);

    -webkit-backdrop-filter:
        blur(5px);

    cursor: pointer;

    text-shadow:
        0 1px 6px
        rgba(0, 0, 0, 0.35);

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}


.tool-button:hover {
    transform:
        scale(1.08);

    background:
        rgba(255, 255, 255, 0.2);

    box-shadow:
        0 0 18px
        rgba(225, 231, 255, 0.45);
}


.tool-icon {
    font-size: 24px;

    line-height: 1;
}


.tool-text {
    margin-top: 4px;

    font-size: 11px;

    letter-spacing: 2px;
}



/* =========================================================
   05. 舊玩家登入 Overlay
========================================================= */

.login-overlay {
    position: fixed;

    inset: 0;

    z-index: 120;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(13, 17, 39, 0.48);

    backdrop-filter:
        blur(8px);

    -webkit-backdrop-filter:
        blur(8px);

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.28s ease,
        visibility 0.28s ease;
}


.login-overlay.is-open {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}



/* =========================================================
   06. 舊玩家登入卡片
========================================================= */

.login-panel {
    position: relative;

    width:
        min(
            90vw,
            430px
        );

    padding:
        42px
        42px
        34px;

    border:
        1px solid
        rgba(220, 198, 154, 0.88);

    border-radius: 24px;

    color: #514a61;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.97),
            rgba(242, 240, 249, 0.96)
        );

    box-shadow:
        0 25px 80px
        rgba(8, 12, 36, 0.38);

    transform:
        translateY(14px)
        scale(0.97);

    transition:
        transform 0.28s ease;
}


.login-overlay.is-open
.login-panel {

    transform:
        translateY(0)
        scale(1);
}



/* =========================================================
   07. 登入卡片關閉
========================================================= */

.login-close {
    position: absolute;

    top: 12px;
    right: 16px;

    width: 36px;
    height: 36px;

    padding: 0;

    border: 0;

    background: transparent;

    color: #756a82;

    font-family: inherit;

    font-size: 28px;

    line-height: 1;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        color 0.18s ease;
}


.login-close:hover {
    color: #3f3850;

    transform:
        scale(1.08);
}



/* =========================================================
   08. 登入標題
========================================================= */

.login-panel-heading {
    margin-bottom: 28px;

    text-align: center;
}


.login-panel-kicker {
    margin:
        0
        0
        8px;

    color: #a58d65;

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.28em;
}


.login-panel-heading h2 {
    margin:
        0
        0
        10px;

    color: #4b4358;

    font-size: 24px;
    font-weight: 500;

    letter-spacing: 0.12em;
}


.login-panel-heading > p:last-child {
    margin: 0;

    color:
        rgba(81, 74, 97, 0.72);

    font-size: 12px;

    line-height: 1.8;
}



/* =========================================================
   09. 登入表單
========================================================= */

.player-login-form {
    display: flex;

    flex-direction: column;

    gap: 18px;
}


.login-field {
    display: flex;

    flex-direction: column;

    gap: 8px;
}


.login-field > span {
    padding-left: 3px;

    color: #665d73;

    font-size: 11px;
    font-weight: 500;

    letter-spacing: 0.15em;
}


.login-field input {
    width: 100%;
    height: 46px;

    padding:
        0
        15px;

    border:
        1px solid
        rgba(114, 104, 133, 0.24);

    border-radius: 12px;

    outline: none;

    color: #4d465a;

    background:
        rgba(255, 255, 255, 0.68);

    font-family: inherit;

    font-size: 13px;

    box-shadow:
        inset
        0 1px 2px
        rgba(53, 45, 73, 0.03);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


.login-field input::placeholder {
    color:
        rgba(91, 82, 108, 0.38);
}


.login-field input:focus {
    border-color:
        rgba(181, 151, 100, 0.68);

    background:
        rgba(255, 255, 255, 0.94);

    box-shadow:
        0 0 0 3px
        rgba(209, 188, 149, 0.13);
}



/* =========================================================
   10. 登入訊息
========================================================= */

.login-message {
    min-height: 18px;

    margin:
        -4px
        0
        -2px;

    color: #a95f67;

    font-size: 11px;

    line-height: 1.6;

    text-align: center;
}


.login-message.is-success {
    color: #71866d;
}



/* =========================================================
   11. 登入按鈕
========================================================= */

.player-login-button {
    width: 100%;
    height: 48px;

    margin-top: 1px;

    border:
        1px solid
        rgba(205, 182, 139, 0.9);

    border-radius: 14px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #79728d,
            #53506d
        );

    font-family: inherit;

    font-size: 12px;
    font-weight: 500;

    letter-spacing: 0.18em;

    cursor: pointer;

    box-shadow:
        0 8px 22px
        rgba(62, 56, 86, 0.19);

    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        box-shadow 0.18s ease;
}


.player-login-button:hover {
    transform:
        translateY(-1px);

    filter:
        brightness(1.08);

    box-shadow:
        0 10px 28px
        rgba(62, 56, 86, 0.25);
}


.player-login-button:active {
    transform:
        scale(0.98);
}


.player-login-button:disabled {
    opacity: 0.55;

    cursor: wait;

    transform: none;
}



/* =========================================================
   12. 建立新旅人
========================================================= */

.new-player-area {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    margin-top: 24px;

    padding-top: 20px;

    border-top:
        1px solid
        rgba(81, 70, 95, 0.12);

    color:
        rgba(81, 74, 97, 0.64);

    font-size: 11px;
}


.new-player-button {
    margin: 0;
    padding: 0;

    border: 0;

    color: #8c7655;

    background: transparent;

    font-family: inherit;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    text-decoration:
        underline;

    text-underline-offset:
        3px;

    transition:
        color 0.18s ease;
}


.new-player-button:hover {
    color: #5f4f38;
}



/* =========================================================
   13. 公告 Overlay
========================================================= */

.notice-overlay {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(15, 18, 40, 0.48);

    backdrop-filter:
        blur(6px);

    -webkit-backdrop-filter:
        blur(6px);

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}


.notice-overlay.is-open {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}



/* =========================================================
   14. 公告卡片
========================================================= */

.notice-panel {
    position: relative;

    width:
        min(
            90vw,
            540px
        );

    max-height: 75vh;

    overflow-y: auto;

    padding:
        38px
        40px;

    border:
        1px solid
        rgba(224, 203, 161, 0.9);

    border-radius: 22px;

    color: #51465f;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.96),
            rgba(241, 239, 250, 0.95)
        );

    box-shadow:
        0 20px 70px
        rgba(10, 12, 35, 0.35);
}


.notice-panel h2 {
    margin:
        0
        0
        28px;

    text-align: center;

    font-weight: 500;

    letter-spacing: 5px;
}


.notice-content {
    line-height: 1.9;
}


.notice-date {
    font-size: 12px;

    opacity: 0.55;
}


.notice-content h3 {
    font-weight: 500;
}


.mian-warning {
    margin-top: 25px;

    padding-top: 18px;

    border-top:
        1px solid
        rgba(81, 70, 95, 0.15);
}


.notice-close {
    position: absolute;

    top: 12px;
    right: 16px;

    border: 0;

    background: transparent;

    color: #756a82;

    font-size: 28px;

    cursor: pointer;
}


/* =========================================================
   15. 手機版｜穩定版
========================================================= */

@media screen and (max-width: 768px) {

    html,
    body {
        width: 100%;
        height: 100%;

        margin: 0;
        padding: 0;

        overflow: hidden;

        background: #10162a;
    }


    /* -----------------------------------------------------
       登入主畫面
    ----------------------------------------------------- */

    .login-page {
        position: relative;

        width: 100%;
        height: 100dvh;
        min-height: 100dvh;

        margin: 0;
        padding: 0;

        overflow: hidden;

        background-image:
            url("../assets/login/login-mobile.webp");

        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
    }


    /* -----------------------------------------------------
       開始旅程
    ----------------------------------------------------- */

    .start-button {
        bottom: 10%;

        width:
            min(
                78vw,
                430px
            );
    }


    /* -----------------------------------------------------
       音樂 / 公告
    ----------------------------------------------------- */

    .login-tools {
        top:
            calc(
                env(safe-area-inset-top)
                + 3%
            );

        right: 4%;

        gap: 12px;
    }


    .tool-button {
        width: 52px;
        min-height: 52px;
    }


    .tool-icon {
        font-size: 20px;
    }


    .tool-text {
        font-size: 9px;
    }


    /* -----------------------------------------------------
       舊玩家登入 Overlay
    ----------------------------------------------------- */

    .login-overlay {
        align-items: center;

        padding:
            calc(
                18px
                + env(safe-area-inset-top)
            )
            16px
            calc(
                18px
                + env(safe-area-inset-bottom)
            );
    }


    /* -----------------------------------------------------
       舊玩家登入卡
    ----------------------------------------------------- */

    .login-panel {
        width: 100%;
        max-width: 390px;

        padding:
            38px
            24px
            28px;

        border-radius: 22px;
    }


    .login-panel-heading {
        margin-bottom: 24px;
    }


    .login-panel-heading h2 {
        font-size: 21px;
    }


    .login-panel-heading > p:last-child {
        font-size: 11px;
    }


    .player-login-form {
        gap: 15px;
    }


    .login-field input {
        height: 45px;
        font-size: 16px;
    }


    .player-login-button {
        height: 47px;
    }


    /* -----------------------------------------------------
       公告
    ----------------------------------------------------- */

    .notice-panel {
        width: 92vw;

        max-height:
            calc(
                100dvh
                - env(safe-area-inset-top)
                - env(safe-area-inset-bottom)
                - 40px
            );

        padding:
            34px
            25px;
    }
}

/* =========================================================
   16. 小尺寸手機
========================================================= */

@media (max-width: 430px) {

    .start-button {
        width: 82vw;

        bottom: 25%;
    }


    .login-panel {
        max-width:
            calc(
                100vw - 28px
            );

        padding:
            35px
            20px
            25px;
    }


    .login-panel-heading h2 {
        font-size: 19px;
    }


    .new-player-area {
        flex-wrap: wrap;

        row-gap: 5px;
    }

}



/* =========================================================
   17. 無 Hover 裝置
========================================================= */

@media (hover: none) {

    .start-button:hover {
        transform:
            translateX(-50%);

        filter: none;
    }


    .tool-button:hover,
    .login-close:hover,
    .player-login-button:hover {
        transform: none;
    }

}



/* =========================================================
   18. Reduced Motion
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .login-page,
    .start-button {
        animation: none;
    }


    .login-overlay,
    .login-panel,
    .player-login-button,
    .tool-button,
    .notice-overlay {
        transition: none;
    }

}