/* ==========================================================================
   貓貓谷 註冊彈窗精修 2026-11-06（v5：質感版，修正電腦版導覽列遮擋與矮螢幕）
   以 10/17–10/25 的米金色舊款為底，原廠美術只用在最有分量的地方：
   - 頂部主視覺：遊戲登入畫面插畫（UI/LoginBack.img/Title/0）
   - 標題徽記、註冊成功：升級特效的金色楓葉（Effect/BasicEff.img/LevelUp/9）
   其餘以排版、細金線、留白與柔和陰影收斂，不堆小圖示。
   只覆蓋 #register-modal 的外觀。不改 HTML、表單、按鈕文字、JS 與任何事件。
   手機的高度、捲動、鍵盤與安全區由 registration-mobile-scroll（11/06）負責，這裡不覆蓋。
   還原：刪掉引用這個檔案的那一行 <link>。
   ========================================================================== */

html body #register-modal.modal-overlay {
    --rp-paper: #fbf6ea;
    --rp-paper-2: #f4ead3;
    --rp-surface: #fffdf7;
    --rp-ink: #2b2118;
    --rp-ink-2: #5d4a38;
    --rp-muted: #8a7560;
    --rp-line: #e8dcc3;
    --rp-line-2: #dccba7;
    --rp-gold: #b8862f;
    --rp-gold-soft: rgba(184, 134, 47, 0.18);
    --rp-cta-1: #e9a03b;
    --rp-cta-2: #d4781f;
    --rp-cta-ink: #fffaf1;
    --rp-link: #a8641a;
    --rp-red: #a8432f;
    --rp-red-bg: #fbeee8;
    --rp-ok: #3e7a4c;
    --rp-hero-h: 172px;
    --rp-overlap: 44px;
    --rp-pill-y: 14px;
    --rp-art: url("art/hero-maple-village.webp");
    background: rgba(18, 12, 6, 0.72) !important;
    backdrop-filter: blur(10px) saturate(0.9);
    color: var(--rp-ink) !important;
}

html[data-meow-theme="dark"] body #register-modal.modal-overlay {
    --rp-paper: #1f1813;
    --rp-paper-2: #19130f;
    --rp-surface: #2a211a;
    --rp-ink: #f4eadb;
    --rp-ink-2: #d9c8b0;
    --rp-muted: #a8957e;
    --rp-line: #3a2e24;
    --rp-line-2: #4a3b2d;
    --rp-gold: #d2a24c;
    --rp-gold-soft: rgba(210, 162, 76, 0.22);
    --rp-link: #e9b25e;
    --rp-red: #f0a08c;
    --rp-red-bg: #33221d;
    --rp-ok: #8fcf9c;
    background: rgba(0, 0, 0, 0.78) !important;
}

/* ---------- 1. 視窗：象牙紙＋一條細金線，柔和陰影 ---------- */
html body #register-modal.modal-overlay .modal-container {
    max-width: 480px !important;
    /* 高度上限沿用 auth-refresh 的 calc(100dvh - 110px)（上留 90px 給導覽列、下留 20px），這裡不覆蓋 */
    background: linear-gradient(180deg, var(--rp-paper) 0%, var(--rp-paper-2) 100%) !important;
    color: var(--rp-ink) !important;
    border: 0 !important;
    border-radius: 22px !important;
    box-shadow:
        0 0 0 1px rgba(184, 134, 47, 0.55),
        0 30px 80px rgba(0, 0, 0, 0.45),
        0 8px 24px rgba(0, 0, 0, 0.18) !important;
    scrollbar-width: thin;
    scrollbar-color: var(--rp-line-2) transparent;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 72px 0 140px;
}

html body #register-modal.modal-overlay :is(.modal-step, .modal-form, .modal-header, .modal-body, .modal-footer) {
    background: transparent !important;
    box-shadow: none !important;
}

/* ---------- 2. 主視覺：原廠插畫，上方淡淡壓暗、下方溶進紙面 ---------- */
html body #register-modal.modal-overlay .modal-progress {
    position: relative;
    display: block !important;
    height: var(--rp-hero-h);
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: var(--rp-art) center 58% / cover no-repeat !important;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
}

html body #register-modal.modal-overlay .modal-progress::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(20, 12, 4, 0.38) 0%, rgba(20, 12, 4, 0) 34%),
        linear-gradient(180deg, rgba(251, 246, 234, 0) 48%, var(--rp-paper) 100%);
    pointer-events: none;
}

html[data-meow-theme="dark"] body #register-modal.modal-overlay .modal-progress::after {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 34%),
        linear-gradient(180deg, rgba(31, 24, 19, 0) 40%, var(--rp-paper) 100%);
}

/* 步驟：磨砂玻璃膠囊。三個元素都以 --rp-pill-y 為基準：膠囊高 30，圓點 20（上下各 5），線 2（上下各 14） */
html body #register-modal.modal-overlay .modal-progress::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: var(--rp-pill-y);
    left: 50%;
    width: 184px;
    height: 30px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
}

html body #register-modal.modal-overlay .modal-progress-step {
    position: absolute !important;
    z-index: 2;
    top: calc(var(--rp-pill-y) + 5px);
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 7px !important;
    height: 20px;
    margin: 0 !important;
    padding: 0 !important;
    background: none;
}

html body #register-modal.modal-overlay .modal-progress-step:first-child {
    right: calc(50% + 26px);
}

html body #register-modal.modal-overlay .modal-progress-step:last-child {
    left: calc(50% + 26px);
}

html body #register-modal.modal-overlay .step-number {
    display: grid !important;
    place-items: center;
    box-sizing: border-box !important;
    flex: none;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    font-size: 11px !important;
    font-weight: 800;
    line-height: 1 !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    background: transparent !important;
    color: #fff !important;
    box-shadow: none !important;
}

html body #register-modal.modal-overlay .modal-progress-step.active .step-number {
    background: #fff !important;
    border-color: #fff !important;
    color: #6b4a1c !important;
}

html body #register-modal.modal-overlay .modal-progress-step.completed .step-number {
    background: #e9c46a !important;
    border-color: #e9c46a !important;
    color: #4a3410 !important;
}

html body #register-modal.modal-overlay .modal-progress-step .step-label,
html body #register-modal.modal-overlay .modal-progress-step.active .step-label {
    display: block !important;
    width: 26px;
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 20px !important;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

html body #register-modal.modal-overlay .modal-progress-line {
    z-index: 2;
    position: absolute !important;
    top: calc(var(--rp-pill-y) + 14px);
    left: 50%;
    transform: translateX(-50%);
    width: 36px !important;
    height: 2px !important;
    margin: 0 !important;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35) !important;
    overflow: hidden;
}

html body #register-modal.modal-overlay .modal-progress-line::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: #fff;
    transition: width 0.6s ease;
}

html body #register-modal.modal-overlay .modal-progress:has(.modal-progress-step:last-child.active) .modal-progress-line::before {
    width: 100%;
}

/* 關閉鈕：同款玻璃圓，捲動時固定在右上角 */
html body #register-modal.modal-overlay .modal-close {
    position: sticky !important;
    top: 11px !important;
    right: auto !important;
    z-index: 5;
    display: grid !important;
    place-items: center;
    width: 36px !important;
    height: 36px !important;
    margin: 11px 12px -47px auto !important;
    padding: 0 !important;
    font-size: 20px !important;
    font-weight: 300;
    line-height: 1 !important;
    border-radius: 50% !important;
    color: #fff !important;
    /* 帶一點深色，捲到紙面上時也看得清楚 */
    background: rgba(36, 24, 12, 0.42) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 6px 18px rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    transition: background 0.2s ease;
}

html body #register-modal.modal-overlay .modal-close:hover {
    background: rgba(36, 24, 12, 0.62) !important;
    color: #fff !important;
    transform: none !important;
}

/* ---------- 3. 標題區：金色楓葉徽記＋乾淨的大標 ---------- */
html body #register-modal.modal-overlay .modal-step {
    position: relative;
    z-index: 2;
    padding: 0 32px 20px !important;
}

html body #register-modal.modal-overlay .modal-header {
    margin: calc(-1 * var(--rp-overlap)) 0 16px !important;
    text-align: center;
}

html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
    content: "";
    display: block;
    width: 46px;
    height: 35px;
    margin: 0 auto 4px;
    background: url("art/maple-leaf.png") center / contain no-repeat;
    filter: drop-shadow(0 4px 10px rgba(214, 160, 40, 0.45));
}

html body #register-modal.modal-overlay .modal-title {
    margin: 0 0 6px !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.06em !important;
    color: var(--rp-ink) !important;
    text-shadow: none !important;
}

html body #register-modal.modal-overlay .modal-subtitle {
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--rp-muted) !important;
}

/* PC 提示：低調的便條，重點字仍是紅色 */
html body #register-modal.modal-overlay .modal-pc-notice {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 0 !important;
    padding: 10px 14px !important;
    font-size: 12.5px !important;
    line-height: 1.6 !important;
    letter-spacing: 0 !important;
    text-align: left;
    color: var(--rp-ink-2) !important;
    background: var(--rp-red-bg) !important;
    border: 1px solid rgba(168, 67, 47, 0.18) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

html body #register-modal.modal-overlay .modal-pc-notice i {
    margin-top: 3px;
    color: var(--rp-red) !important;
}

html body #register-modal.modal-overlay .modal-pc-notice strong {
    color: var(--rp-red) !important;
}

html body #register-modal.modal-overlay .modal-launcher-notice {
    color: var(--rp-muted) !important;
}

/* ---------- 4. 欄位 ---------- */
html body #register-modal.modal-overlay .modal-form {
    display: flex !important;
    flex-direction: column;
    gap: 12px !important;
}

html body #register-modal.modal-overlay .form-group {
    display: flex !important;
    flex-direction: column;
    margin: 0 !important;
    gap: 7px !important;
}

html body #register-modal.modal-overlay .form-group label {
    margin: 0 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    color: var(--rp-ink-2) !important;
}

html body #register-modal.modal-overlay .form-group input:not([type="checkbox"]),
html[data-meow-theme] body #register-modal.modal-overlay .modal-form .form-group input:not([type="checkbox"]) {
    min-height: 46px !important;
    padding: 11px 16px !important;
    font-size: 16px !important;
    color: var(--rp-ink) !important;
    background: var(--rp-surface) !important;
    border: 1px solid var(--rp-line-2) !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 1px 2px rgba(60, 40, 10, 0.04) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html body #register-modal.modal-overlay .form-group input::placeholder {
    color: color-mix(in srgb, var(--rp-muted) 75%, transparent) !important;
}

html body #register-modal.modal-overlay .form-group input:not([type="checkbox"]):focus,
html[data-meow-theme] body #register-modal.modal-overlay .modal-form .form-group input:not([type="checkbox"]):focus {
    outline: none !important;
    border-color: var(--rp-gold) !important;
    box-shadow: 0 0 0 4px var(--rp-gold-soft) !important;
}

html body #register-modal.modal-overlay .form-hint {
    margin: 0 !important;
    font-size: 12px !important;
    font-style: normal !important;
    color: var(--rp-muted) !important;
}

html body #register-modal.modal-overlay .modal-error {
    margin: 0 !important;
    border-radius: 12px !important;
}

/* ---------- 5. 主按鈕：沉穩的琥珀色，無亮面切半 ---------- */
html body #register-modal.modal-overlay .modal-btn-primary {
    min-height: 52px !important;
    margin-top: 4px !important;
    padding: 14px 24px !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    letter-spacing: 0.16em;
    color: var(--rp-cta-ink) !important;
    text-shadow: none !important;
    background: linear-gradient(180deg, var(--rp-cta-1) 0%, var(--rp-cta-2) 100%) !important;
    border: 0 !important;
    border-radius: 14px !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 10px 22px -8px rgba(180, 95, 20, 0.6),
        0 2px 4px rgba(120, 60, 10, 0.15) !important;
    transform: none !important;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

html body #register-modal.modal-overlay .modal-btn-primary:hover:not(:disabled) {
    filter: brightness(1.05);
}

html body #register-modal.modal-overlay .modal-btn-primary:active:not(:disabled) {
    transform: translateY(1px) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 10px -4px rgba(180, 95, 20, 0.6) !important;
}

html body #register-modal.modal-overlay .modal-btn-primary:disabled {
    filter: grayscale(0.6);
    opacity: 0.7;
}

/* ---------- 6. 底部 ---------- */
html body #register-modal.modal-overlay .modal-footer {
    margin-top: 14px !important;
    padding-top: 12px !important;
    border-top: 1px solid var(--rp-line) !important;
    text-align: center;
}

html body #register-modal.modal-overlay .modal-footer-text {
    margin: 0 !important;
    font-size: 14px !important;
    color: var(--rp-muted) !important;
}

html body #register-modal.modal-overlay .modal-link {
    margin-left: 4px;
    font-weight: 700;
    color: var(--rp-link) !important;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

/* ---------- 7. 註冊成功：金色楓葉 ---------- */
html body #register-modal.modal-overlay #modal-step-complete .modal-header {
    margin-top: calc(-1 * var(--rp-overlap) - 22px) !important;
}

html body #register-modal.modal-overlay .modal-success-icon {
    width: 96px !important;
    height: 72px !important;
    margin: 0 auto 4px !important;
    font-size: 0 !important;
    color: transparent !important;
    background: url("art/maple-leaf.png") center / contain no-repeat !important;
    border: 0 !important;
    box-shadow: none !important;
    filter: drop-shadow(0 6px 14px rgba(214, 160, 40, 0.5));
    animation: rp-leaf-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes rp-leaf-pop {
    from { transform: scale(0.5) translateY(10px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

html body #register-modal.modal-overlay #complete-username {
    color: var(--rp-link) !important;
}

/* 下一步，準備入谷（registration-funnel 模組） */
html body #register-modal.modal-overlay .mf-next {
    margin: 0 0 16px !important;
    padding: 22px !important;
    color: var(--rp-ink) !important;
    background: var(--rp-surface) !important;
    border: 1px solid var(--rp-line) !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 2px rgba(60, 40, 10, 0.05), 0 12px 28px -18px rgba(60, 40, 10, 0.35) !important;
}

html body #register-modal.modal-overlay .mf-kicker {
    font-size: 10.5px !important;
    letter-spacing: 0.2em !important;
    color: var(--rp-gold) !important;
}

html body #register-modal.modal-overlay .mf-next h3 {
    margin-top: 4px !important;
    font-size: 21px !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em !important;
    color: var(--rp-ink) !important;
}

html body #register-modal.modal-overlay .mf-device {
    color: var(--rp-ink-2) !important;
    background: transparent !important;
    border: 1px solid var(--rp-line-2);
}

html body #register-modal.modal-overlay :is(.mf-copy, .mf-fineprint, .mf-safety-note) {
    color: var(--rp-muted) !important;
}

html body #register-modal.modal-overlay .mf-status {
    font-weight: 700;
    color: var(--rp-ok) !important;
}

html body #register-modal.modal-overlay .mf-safety-note {
    border-top: 1px solid var(--rp-line) !important;
}

html body #register-modal.modal-overlay :is(.mf-send-guide, .mf-main-download) {
    color: var(--rp-cta-ink) !important;
    text-shadow: none !important;
    background: linear-gradient(180deg, var(--rp-cta-1) 0%, var(--rp-cta-2) 100%) !important;
    border: 0 !important;
    border-radius: 14px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 22px -10px rgba(180, 95, 20, 0.6) !important;
}

html body #register-modal.modal-overlay .mf-send-guide {
    font-size: 15px !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
}

html body #register-modal.modal-overlay .mf-main-download small {
    color: rgba(255, 250, 241, 0.85) !important;
}

html body #register-modal.modal-overlay .mf-download-icon {
    color: var(--rp-cta-2) !important;
    background: #fff7e6 !important;
}

html body #register-modal.modal-overlay :is(.mf-alternative, .mf-secondary a, .mf-discord) {
    color: var(--rp-ink-2) !important;
    background: transparent !important;
    border: 1px solid var(--rp-line-2) !important;
    border-radius: 12px !important;
}

html body #register-modal.modal-overlay .mf-discord {
    color: #5059c9 !important;
}

html[data-meow-theme="dark"] body #register-modal.modal-overlay .mf-discord {
    color: #aab0ff !important;
}

html body #register-modal.modal-overlay .mf-device-choice button {
    color: var(--rp-link) !important;
}

/* 保存帳號資料 */
html body #register-modal.modal-overlay :is(.account-save-kit, .modal-action-card) {
    padding: 20px !important;
    color: var(--rp-ink) !important;
    background: var(--rp-surface) !important;
    border: 1px solid var(--rp-line) !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}

html body #register-modal.modal-overlay :is(.account-save-kit h3, .action-content h3) {
    margin: 0 0 4px !important;
    font-size: 17px !important;
    color: var(--rp-ink) !important;
}

html body #register-modal.modal-overlay :is(.account-save-intro, .account-save-location, .action-content p) {
    color: var(--rp-muted) !important;
}

html body #register-modal.modal-overlay .account-save-details {
    margin: 12px 0 !important;
}

html body #register-modal.modal-overlay .account-save-details > div {
    padding: 10px 0 !important;
    border-color: var(--rp-line) !important;
}

html body #register-modal.modal-overlay .account-save-details dt {
    margin: 0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    color: var(--rp-muted) !important;
}

html body #register-modal.modal-overlay .account-save-details dd {
    margin: 2px 0 0 !important;
    font-size: 15px !important;
    color: var(--rp-ink) !important;
    overflow-wrap: anywhere;
}

html body #register-modal.modal-overlay :is(.account-save-details a, .account-save-kit a) {
    color: var(--rp-link) !important;
}

html body #register-modal.modal-overlay .account-save-buttons {
    gap: 10px !important;
}

/* 保存帳號的兩顆按鈕：次要層級，避免和主按鈕搶 */
html body #register-modal.modal-overlay .account-save-buttons .modal-btn-primary {
    min-height: 46px !important;
    margin-top: 0 !important;
    font-size: 15px !important;
    letter-spacing: 0.04em;
    color: #4a3410 !important;
    background: #f1dca8 !important;
    box-shadow: inset 0 0 0 1px rgba(184, 134, 47, 0.45) !important;
}

html[data-meow-theme="dark"] body #register-modal.modal-overlay .account-save-buttons .modal-btn-primary {
    color: #2b2118 !important;
    background: #d9b46a !important;
}

html body #register-modal.modal-overlay .modal-btn-secondary {
    min-height: 46px !important;
    color: var(--rp-ink-2) !important;
    background: transparent !important;
    border: 1px solid var(--rp-line-2) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

html body #register-modal.modal-overlay #complete-close-btn {
    width: 100% !important;
    margin-top: 14px !important;
}

/* ---------- 7c. 電腦矮螢幕（筆電 1366×768、1280×720 等）：讓「註冊送出」留在第一屏 ---------- */
@media (min-width: 741px) and (max-height: 880px) and (pointer: fine), (min-width: 741px) and (max-height: 880px) and (hover: hover) {
    html body #register-modal.modal-overlay {
        --rp-hero-h: 126px;
        --rp-overlap: 36px;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
        width: 34px;
        height: 26px;
        margin-bottom: 2px;
    }

    html body #register-modal.modal-overlay #modal-step-register .form-hint {
        display: none !important;
    }
}

@media (min-width: 741px) and (max-height: 780px) and (pointer: fine), (min-width: 741px) and (max-height: 780px) and (hover: hover) {
    html body #register-modal.modal-overlay {
        --rp-hero-h: 92px;
        --rp-overlap: 26px;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
        display: none;
    }

    html body #register-modal.modal-overlay .modal-header {
        margin-bottom: 12px !important;
    }

    html body #register-modal.modal-overlay .modal-title {
        font-size: 22px !important;
        margin-bottom: 2px !important;
    }

    html body #register-modal.modal-overlay .modal-pc-notice {
        margin-top: 10px !important;
        padding: 7px 12px !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
    }

    html body #register-modal.modal-overlay .modal-form {
        gap: 10px !important;
    }

    html body #register-modal.modal-overlay .form-group {
        gap: 5px !important;
    }

    html body #register-modal.modal-overlay .modal-step {
        padding-bottom: 14px !important;
    }

    html body #register-modal.modal-overlay .modal-footer {
        margin-top: 10px !important;
        padding-top: 10px !important;
    }

    html body #register-modal.modal-overlay #modal-step-complete .modal-header {
        margin-top: calc(-1 * var(--rp-overlap) - 10px) !important;
    }

    html body #register-modal.modal-overlay .modal-success-icon {
        width: 72px !important;
        height: 54px !important;
    }
}

/* ---------- 8. 全螢幕版型（手機、手機橫放）：尺寸與捲動交給 registration-mobile-scroll ---------- */
@media (max-width: 740px), (pointer: coarse) and (max-height: 600px) {
    html body #register-modal.modal-overlay {
        --rp-hero-h: 164px;
        --rp-overlap: 42px;
        --rp-pill-y: calc(14px + env(safe-area-inset-top, 0px));
        padding: 0 !important;
        align-items: stretch !important;
    }

    html body #register-modal.modal-overlay .modal-container {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    html body #register-modal.modal-overlay .modal-progress {
        border-radius: 0;
        margin-top: calc(-1 * env(safe-area-inset-top, 0px)) !important;
        height: calc(var(--rp-hero-h) + env(safe-area-inset-top, 0px));
    }

    html body #register-modal.modal-overlay .modal-close {
        top: calc(11px + env(safe-area-inset-top, 0px)) !important;
        margin: 11px 12px -47px auto !important;
    }

    html body #register-modal.modal-overlay .modal-step {
        padding: 0 max(20px, calc((100% - 440px) / 2)) 8px !important;
    }

    html body #register-modal.modal-overlay .modal-title {
        font-size: 24px !important;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
        width: 38px;
        height: 29px;
        margin-bottom: 2px;
    }

    html body #register-modal.modal-overlay .modal-header {
        margin-bottom: 14px !important;
    }

    html body #register-modal.modal-overlay .modal-subtitle {
        font-size: 13px !important;
    }

    html body #register-modal.modal-overlay .modal-pc-notice {
        margin-top: 12px !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    html body #register-modal.modal-overlay .modal-form {
        gap: 11px !important;
    }

    html body #register-modal.modal-overlay .form-group {
        gap: 6px !important;
    }

    html body #register-modal.modal-overlay .form-hint {
        display: none !important;
    }

    html body #register-modal.modal-overlay .mf-next {
        padding: 18px 16px !important;
    }

    html body #register-modal.modal-overlay .mf-next h3 {
        font-size: 19px !important;
        white-space: nowrap;
    }

    html body #register-modal.modal-overlay .mf-kicker {
        letter-spacing: 0.12em !important;
        white-space: nowrap;
        font-size: 10px !important;
    }

    html body #register-modal.modal-overlay :is(.account-save-kit, .modal-action-card) {
        padding: 18px 16px !important;
    }
}

/* 矮螢幕（iPhone SE、Safari 工具列展開時） */
@media (max-width: 740px) and (max-height: 700px) {
    html body #register-modal.modal-overlay {
        --rp-hero-h: 132px;
        --rp-overlap: 36px;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
        width: 30px;
        height: 23px;
        margin-bottom: 0;
    }

    html body #register-modal.modal-overlay .modal-title {
        font-size: 22px !important;
        margin-bottom: 2px !important;
    }

    html body #register-modal.modal-overlay .modal-header {
        margin-bottom: 10px !important;
    }

    html body #register-modal.modal-overlay .modal-pc-notice {
        margin-top: 10px !important;
        padding: 7px 10px !important;
        font-size: 11.5px !important;
        line-height: 1.5 !important;
    }

    html body #register-modal.modal-overlay .modal-form {
        gap: 9px !important;
    }

    html body #register-modal.modal-overlay .form-group {
        gap: 4px !important;
    }

    html body #register-modal.modal-overlay .form-group input:not([type="checkbox"]),
    html[data-meow-theme] body #register-modal.modal-overlay .modal-form .form-group input:not([type="checkbox"]) {
        min-height: 44px !important;
        padding: 9px 14px !important;
    }
}

/* 手機橫放：橫幅縮成細帶，欄位兩兩並排，送出按鈕留在第一屏 */
@media (pointer: coarse) and (max-height: 600px) and (min-width: 561px) {
    html body #register-modal.modal-overlay {
        --rp-hero-h: 48px;
        --rp-overlap: 0px;
        --rp-pill-y: calc(9px + env(safe-area-inset-top, 0px));
    }

    html body #register-modal.modal-overlay .modal-close {
        top: calc(6px + env(safe-area-inset-top, 0px)) !important;
        width: 36px !important;
        height: 36px !important;
        margin: 6px 12px -42px auto !important;
    }

    html body #register-modal.modal-overlay .modal-progress::after {
        background: linear-gradient(180deg, rgba(20, 12, 4, 0.3) 0%, rgba(20, 12, 4, 0.1) 100%);
    }

    html body #register-modal.modal-overlay .modal-step {
        /* 左右各留 76px，避開右下角的 Discord 浮動鈕 */
        padding: 0 max(76px, calc((100% - 640px) / 2)) 8px !important;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-header::before {
        display: none;
    }

    /* 標題與副標同一行 */
    html body #register-modal.modal-overlay #modal-step-register .modal-header {
        display: flex !important;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: center;
        column-gap: 12px;
        margin: 8px 0 8px !important;
    }

    html body #register-modal.modal-overlay #modal-step-register .modal-pc-notice {
        flex-basis: 100%;
    }

    html body #register-modal.modal-overlay .modal-title {
        font-size: 20px !important;
        margin-bottom: 0 !important;
    }

    html body #register-modal.modal-overlay .modal-subtitle {
        font-size: 12.5px !important;
    }

    html body #register-modal.modal-overlay .modal-pc-notice {
        margin-top: 6px !important;
        padding: 6px 12px !important;
        font-size: 11.5px !important;
        line-height: 1.5 !important;
    }

    html body #register-modal.modal-overlay .modal-form {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        grid-auto-flow: row dense;
        gap: 8px 14px !important;
        align-items: end;
    }

    html body #register-modal.modal-overlay .modal-form .modal-error {
        grid-column: 1 / -1;
    }

    html body #register-modal.modal-overlay .form-group {
        gap: 4px !important;
    }

    html body #register-modal.modal-overlay .form-group input:not([type="checkbox"]),
    html[data-meow-theme] body #register-modal.modal-overlay .modal-form .form-group input:not([type="checkbox"]) {
        min-height: 44px !important;
        padding: 9px 14px !important;
    }

    html body #register-modal.modal-overlay .modal-form .modal-btn-primary {
        grid-column: 2;
        grid-row: 2;
        min-height: 44px !important;
        margin-top: 0 !important;
        padding: 10px 16px !important;
    }

    html body #register-modal.modal-overlay .modal-footer {
        margin-top: 12px !important;
        padding-top: 10px !important;
    }

    html body #register-modal.modal-overlay #modal-step-complete .modal-header {
        margin-top: 8px !important;
    }

    html body #register-modal.modal-overlay .modal-success-icon {
        width: 64px !important;
        height: 48px !important;
    }
}

/* 窄螢幕（摺疊機外螢幕等） */
@media (max-width: 380px) {
    html body #register-modal.modal-overlay .modal-progress-step .step-label,
    html body #register-modal.modal-overlay .modal-progress-step.active .step-label {
        display: none !important;
    }

    html body #register-modal.modal-overlay .modal-progress::before {
        width: 112px;
    }

    html body #register-modal.modal-overlay .modal-step {
        padding: 0 16px 8px !important;
    }

    html body #register-modal.modal-overlay .modal-pc-notice {
        font-size: 11.5px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body #register-modal.modal-overlay .modal-success-icon {
        animation: none !important;
    }
}
