/* ============================================================
   EVmorning 使用者登入 v1 — 首次加入會員視覺入口
   設計參考:LINE-style mobile login mockup
   - 滿版 brand 綠底圖 + 底部 3D 吉祥物場景裝飾
   - 中央圓形 logo + LINE ID 一鍵登入鈕
   - 條款同意(預設勾選;未勾選時阻止 OAuth)
   - safe-area-inset 處理 iPhone notch / Dynamic Island
   ============================================================ */

:root {
    --evm-green:        #20B03D;     /* 品牌主綠 */
    --evm-green-deep:   #178030;     /* 按鈕文字 + 強調 */
    --evm-line-green:   #06C755;     /* LINE 官方綠(icon 用) */
    --evm-bg:           #1FB856;     /* 頁面 hero 綠 */
    --evm-bg-2:         #18A84B;     /* 漸層暗端 */
    --evm-bg-3:         #21C25D;     /* 漸層亮端 */
    --evm-text:         #FFFFFF;
    --evm-mute:         rgba(255, 255, 255, 0.78);
    --evm-warn:         #FFE08A;
    --login-radius-pill: 999px;
    --login-font: -apple-system, BlinkMacSystemFont, 'PingFang TC',
                  'Microsoft JhengHei', 'Noto Sans TC',
                  system-ui, sans-serif;
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--login-font);
    color: var(--evm-text);
    background: var(--evm-bg);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
input { -webkit-appearance: none; appearance: none; }

/* ============================================================
   Stage — 滿版綠底 + 漸層 + 底部 scene
   ============================================================ */
.login-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 50% 0%,
            var(--evm-bg-3) 0%,
            var(--evm-bg)   42%,
            var(--evm-bg-2) 100%);
}

/* ============================================================
   iOS chrome (status bar + 登入 title)
   ============================================================ */
.login-chrome {
    position: relative;
    z-index: 4;
    width: 100%;
    padding: calc(var(--safe-top) + 8px) 24px 8px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--evm-text);
}

.login-chrome__time {
    justify-self: start;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.login-chrome__icons {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--evm-text);
}

.login-chrome__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    justify-self: center;
}

/* ============================================================
   Brand mark(中央)
   ============================================================ */
.login-brand {
    position: relative;
    z-index: 4;
    margin-top: clamp(36px, 11vh, 90px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: translateY(12px);
    animation: rise 620ms cubic-bezier(0.16, 1, 0.3, 1) 80ms forwards;
}

@keyframes rise { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
}

.login-brand__mark {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.login-brand__mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.login-brand__name {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* ============================================================
   LINE 登入鈕(白色 pill)
   ============================================================ */
.login-line-btn {
    position: relative;
    z-index: 4;
    margin-top: clamp(26px, 7vh, 56px);
    width: calc(100% - 56px);
    max-width: 340px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #FFFFFF;
    color: var(--evm-green-deep);
    border-radius: var(--login-radius-pill);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow:
        0 1px 0  rgba(0, 0, 0, 0.04),
        0 14px 32px -12px rgba(0, 0, 0, 0.30),
        0 4px 10px -2px  rgba(0, 0, 0, 0.10);
    transition:
        transform 0.12s ease-out,
        box-shadow 0.18s ease-out,
        background 0.2s ease-out;
    opacity: 0;
    animation: rise 620ms cubic-bezier(0.16, 1, 0.3, 1) 200ms forwards;
}

.login-line-btn:active {
    transform: translateY(1px) scale(0.99);
    box-shadow:
        0 1px 0  rgba(0, 0, 0, 0.04),
        0 6px 14px -6px  rgba(0, 0, 0, 0.22);
}

.login-line-btn.is-shake {
    animation: shake 0.4s ease-in-out, rise 620ms cubic-bezier(0.16, 1, 0.3, 1) 200ms forwards;
}

.login-line-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-line-btn__label {
    line-height: 1;
    transform: translateY(1px);
}

/* ============================================================
   條款同意
   ============================================================ */
.login-terms {
    position: relative;
    z-index: 4;
    margin-top: 22px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 360px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--evm-mute);
    cursor: pointer;
    user-select: none;
    opacity: 0;
    animation: rise 620ms cubic-bezier(0.16, 1, 0.3, 1) 320ms forwards;
    text-align: left;
}

.login-terms input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.login-terms__mark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.10);
    display: grid;
    place-items: center;
    color: transparent;
    flex-shrink: 0;
    transition:
        background 0.18s ease-out,
        border-color 0.18s ease-out,
        color 0.18s ease-out;
}

.login-terms input:checked ~ .login-terms__mark {
    background: #FFFFFF;
    border-color: #FFFFFF;
    color: var(--evm-green);
}

.login-terms__link {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    color: var(--evm-text);
    transition: color 0.15s ease-out;
}
.login-terms__link:active { color: var(--evm-warn); }

/* ============================================================
   底部 3D 吉祥物場景
   ============================================================ */
.login-hero {
    position: absolute;
    inset: auto 0 0 0;
    width: 100%;
    height: 44vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to top,
        #000 65%,
        rgba(0, 0, 0, 0.5) 85%,
        transparent 100%);
            mask-image: linear-gradient(to top,
        #000 65%,
        rgba(0, 0, 0, 0.5) 85%,
        transparent 100%);
    opacity: 0;
    animation: fadeIn 800ms ease-out 240ms forwards;
}

.login-hero picture,
.login-hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
}

/* ============================================================
   最底小圓形品牌標
   ============================================================ */
.login-mini {
    position: absolute;
    left: 50%;
    bottom: calc(18px + var(--safe-bottom));
    transform: translateX(-50%);
    width: 42px;
    height: 42px;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    animation: fadeIn 600ms ease-out 400ms forwards;
}

.login-mini img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

/* ============================================================
   Responsive — 較短螢幕
   ============================================================ */
@media (max-height: 720px) {
    .login-brand { margin-top: 28px; }
    .login-brand__mark { width: 96px; height: 96px; }
    .login-brand__name { font-size: 22px; }
    .login-line-btn { margin-top: 22px; height: 48px; font-size: 16px; }
    .login-hero { height: 34vh; }
}

@media (max-height: 600px) {
    .login-brand { margin-top: 14px; gap: 12px; }
    .login-brand__mark { width: 80px; height: 80px; }
    .login-hero { height: 30vh; }
    .login-mini { width: 36px; height: 36px; }
}

/* 横擺(iPad mini 模擬手機)
   — scene 維持底部,但 hero 縮更小 */
@media (max-height: 500px) and (orientation: landscape) {
    .login-stage { flex-direction: row; align-items: stretch; padding-left: 0; }
    .login-chrome { grid-template-columns: 1fr; padding: var(--safe-top) 0 0; }
    .login-chrome__time,
    .login-chrome__icons { display: none; }
    .login-chrome__title { font-size: 18px; }
    .login-brand { margin-top: 8px; gap: 10px; }
    .login-brand__mark { width: 72px; height: 72px; }
    .login-line-btn { margin-top: 14px; height: 44px; font-size: 15px; max-width: 280px; }
    .login-terms { margin-top: 14px; padding: 0 16px; font-size: 12px; }
    .login-hero { width: 50%; height: 100%; object-position: right bottom; }
    .login-mini { display: none; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .login-brand,
    .login-line-btn,
    .login-terms,
    .login-hero,
    .login-mini { animation: none; opacity: 1; transform: none; }
}

/* ============================================================
   Focus visibility(keyboard a11y)
   ============================================================ */
:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 3px;
    border-radius: 999px;
}
.login-terms:focus-within .login-terms__mark {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.30);
}
