/*
 * 登录 / 注册 / 找回密码共用页面（resources/views/layouts/auth.blade.php、auth/portal.blade.php），脚本 public/js/auth.js。
 * 企业级极简：浅灰底（#F5F5F5）+ 白色卡片，单一品牌蓝 + 中性灰阶，2–4px 微圆角，极轻阴影，不使用渐变、毛玻璃与发光效果。
 * 布局：插画固定铺满整个屏幕，悬浮登录卡片居中；<768px（手机）卡片铺满全宽。
 * 触屏设备与 ≤1024px 时控件加高到 44px、输入框字号 16px（避免 iOS 聚焦时页面放大）。
 * 对比度按 WCAG AA：正文、占位符与链接 ≥4.5:1，输入框边框 ≥3:1。
 */

.ap-body {
    --ap-brand: #2563eb;
    --ap-brand-hover: #1d4ed8;
    --ap-brand-active: #1e40af;
    --ap-brand-soft: #eff4ff;
    --ap-text: #1f1f1f;
    --ap-text-2: #4d4d4d;
    --ap-text-3: #666666;
    --ap-placeholder: #767676;
    --ap-line: #949494;
    --ap-line-hover: #666666;
    --ap-line-soft: #e5e5e5;
    --ap-divider: #f0f0f0;
    --ap-bg: #f5f5f5;
    --ap-card: #ffffff;
    --ap-danger: #d92d20;
    --ap-danger-text: #b42318;
    --ap-danger-soft: #fef3f2;
    --ap-success: #15803d;
    --ap-success-soft: #f0fdf4;
    --ap-warning: #b45309;
    --ap-warning-soft: #fffbeb;
    --ap-radius: 4px;
    --ap-control-h: 40px;
    margin: 0;
    min-height: 100dvh;
    background: var(--ap-bg);
    color: var(--ap-text);
}

/* ==================== 页面框架 ==================== */

.ap-page {
    display: flex;
    min-height: 100dvh;
    flex-direction: column;
    background: var(--ap-bg) url("../images/auth/bg-lines.svg") center / cover no-repeat;
}

.ap-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    height: 64px;
    padding: 0 40px;
}

.ap-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    border-radius: 2px;
    color: var(--ap-text);
    text-decoration: none;
}

.ap-brand:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: 4px;
}

.ap-brand-mark {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: var(--ap-radius);
    background: var(--ap-brand);
    color: #ffffff;
}

/* 后台上传了自定义 Logo：显示图片，去掉蓝底（<x-brand-mark> 组件输出 has-logo） */
.ap-brand-mark.has-logo {
    overflow: hidden;
    background: transparent;
}

.ap-brand-mark.has-logo > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ap-brand-name {
    overflow: hidden;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-main {
    display: grid;
    flex: 1 0 auto;
    grid-template-columns: minmax(0, 400px);
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    padding: 16px 64px 32px;
}

/* 右侧内容列：顶栏 + 卡片 + 页脚 */
.ap-side {
    display: flex;
    flex: 1 0 auto;
    min-width: 0;
    flex-direction: column;
}

/* 插画（public/images/auth/hero-1，1952×1216）：按比例裁切铺满容器。
   主体（楼、手机、底座）在下半部分且偏右，水平取 60%；上方为留白，宽屏需裁上下时优先裁顶部，垂直取 88% */
.ap-cover {
    overflow: hidden;
    background: #eaf1fb;
}

.ap-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 60% 88%;
    pointer-events: none;
    user-select: none;
}

/* 有插画时：插画固定铺满整个屏幕作为背景，Logo、登录卡片、页脚浮在其上 */
.ap-page.has-cover {
    position: relative;
    isolation: isolate;
    background: transparent;
}

.ap-page.has-cover .ap-cover {
    position: fixed;
    inset: 0;
    z-index: -1;
}

/* 悬浮登录卡片：参考云厂商控制台登录框，实色白底 + 细描边 + 中性灰柔和投影，不用渐变、光带与毛玻璃 */
.ap-page.has-cover {
    --ap-control-h: 44px;
}

.ap-page.has-cover .ap-card {
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 40px -16px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .04);
}

/* 输入框：浅灰填充底 + 细边框，悬停加深，聚焦变白底 + 品牌蓝边框与浅蓝外圈 */
.ap-page.has-cover .ap-card .ap-control {
    border-color: #d3d9e2;
    border-radius: 4px;
    background: #f6f8fb;
}

.ap-page.has-cover .ap-card .ap-control:hover {
    border-color: #a9b3c1;
    background: #f2f5f9;
}

.ap-page.has-cover .ap-card .ap-control:focus-within {
    border-color: var(--ap-brand);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.ap-page.has-cover .ap-card .has-error .ap-control {
    border-color: var(--ap-danger);
    background: #fffafa;
}

.ap-page.has-cover .ap-card .has-error .ap-control:focus-within {
    box-shadow: 0 0 0 3px rgba(217, 45, 32, .12);
}

.ap-page.has-cover .ap-card .ap-input {
    padding: 0 14px;
    color: #1f2329;
}

.ap-page.has-cover .ap-card .ap-input::placeholder {
    color: #6b7280;
}

/* 自动填充时保持与当前底色一致，避免出现黄底/白块 */
.ap-page.has-cover .ap-card .ap-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #f6f8fb inset;
}

.ap-page.has-cover .ap-card .ap-control:focus-within .ap-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #ffffff inset;
}

/* +86 前缀：短竖线分隔，不占满高度 */
.ap-page.has-cover .ap-card .ap-prefix {
    margin: 12px 0;
    padding: 0 12px 0 14px;
    border-right-color: #d3d9e2;
    color: #1f2329;
    font-weight: 500;
}

/* 获取验证码：去掉整条分隔线，改为短竖线 + 文字按钮 */
.ap-page.has-cover .ap-card .ap-code-btn {
    position: relative;
    min-width: 108px;
    border-left: 0;
    border-radius: 0 4px 4px 0;
    font-weight: 500;
}

.ap-page.has-cover .ap-card .ap-code-btn::before {
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 1px;
    background: #d3d9e2;
    content: "";
}

.ap-page.has-cover .ap-card .ap-code-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--ap-brand-hover);
}

/* 登录按钮：实色品牌蓝，4px 圆角，无发光投影 */
.ap-page.has-cover .ap-card .ap-submit {
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: .08em;
}

.ap-page.has-cover .ap-agreement {
    border-top-color: rgba(15, 23, 42, .08);
}

/* 页脚：半透明白条，保证备案文字在插画上可读 */
.ap-page.has-cover .ap-footer {
    background: rgba(255, 255, 255, .78);
}

/* ≥1024px：卡片在屏幕水平、垂直居中悬浮，Logo 在左上角 */
@media (min-width: 1024px) {
    .ap-page.has-cover .ap-header {
        padding: 0 40px;
    }

    .ap-page.has-cover .ap-main {
        grid-template-columns: minmax(0, 420px);
        justify-content: center;
        max-width: none;
        padding: 16px 40px 40px;
    }

    .ap-page.has-cover .ap-card {
        padding: 40px 40px 32px;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .ap-page.has-cover .ap-header {
        padding: 0 32px;
    }

    .ap-page.has-cover .ap-main {
        grid-template-columns: minmax(0, 400px);
    }

    .ap-page.has-cover .ap-card {
        padding: 32px 32px 28px;
    }
}

.ap-footer {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    padding: 16px 24px 24px;
    color: var(--ap-text-3);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.ap-footer a {
    color: var(--ap-text-3);
    text-decoration: none;
}

.ap-footer a:hover {
    color: var(--ap-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ap-footer a:focus-visible {
    border-radius: 2px;
    outline: 2px solid var(--ap-brand);
    outline-offset: 2px;
}

/* ==================== 卡片 ==================== */

.ap-card {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 32px 36px 28px;
    border: 1px solid var(--ap-line-soft);
    border-radius: var(--ap-radius);
    background: var(--ap-card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.ap-panel {
    animation: ap-fade .16s ease-out;
}

.ap-panel[hidden],
.ap-form[hidden] {
    display: none;
}

@keyframes ap-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Tab：当前项加粗 + 品牌蓝下划线 */
.ap-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 32px;
    margin-bottom: 24px;
}

.ap-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0 0 8px;
    border-radius: 2px;
    color: var(--ap-text-3);
    font-size: 18px;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 28px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.ap-tab:hover {
    color: var(--ap-text);
}

.ap-tab[aria-selected="true"],
.ap-tab.is-static {
    color: var(--ap-text);
    font-weight: 600;
}

.ap-tab.is-static {
    cursor: default;
}

.ap-tab[aria-selected="true"]::after,
.ap-tab.is-static::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--ap-brand);
    content: "";
}

.ap-tab:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: 4px;
}

h1.ap-tab:focus,
.ap-panel h1:focus {
    outline: none;
}

/* ==================== 表单 ==================== */

.ap-form {
    display: grid;
    gap: 16px;
}

.ap-field {
    display: grid;
    gap: 6px;
}

.ap-control {
    display: flex;
    min-height: var(--ap-control-h);
    align-items: stretch;
    border: 1px solid var(--ap-line);
    border-radius: var(--ap-radius);
    background: #ffffff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ap-control:hover {
    border-color: var(--ap-line-hover);
}

.ap-control:focus-within {
    border-color: var(--ap-brand);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}

.has-error .ap-control {
    border-color: var(--ap-danger);
}

.has-error .ap-control:focus-within {
    box-shadow: 0 0 0 2px rgba(217, 45, 32, .16);
}

.ap-input {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    height: calc(var(--ap-control-h) - 2px);
    padding: 0 12px;
    border: 0;
    border-radius: var(--ap-radius);
    outline: 0;
    background: transparent;
    color: var(--ap-text);
    font-size: 14px;
    line-height: 1.4;
}

/* 焦点由外框 .ap-control:focus-within 显示 */
.ap-input:focus,
.ap-input:focus-visible {
    outline: none;
}

.ap-input::placeholder {
    color: var(--ap-placeholder);
    opacity: 1;
}

.ap-input-code {
    letter-spacing: .08em;
}

.ap-input-code::placeholder {
    letter-spacing: 0;
}

.ap-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px #ffffff inset;
    -webkit-text-fill-color: var(--ap-text);
}

.ap-prefix {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    margin: 8px 0;
    padding: 0 12px;
    border-right: 1px solid var(--ap-line-soft);
    color: var(--ap-text);
    font-size: 14px;
}

.ap-code-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-left: 1px solid var(--ap-line-soft);
    border-radius: 0 var(--ap-radius) var(--ap-radius) 0;
    background: transparent;
    color: var(--ap-brand);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.ap-code-btn:hover:not(:disabled) {
    background: var(--ap-brand-soft);
    color: var(--ap-brand-hover);
}

.ap-code-btn:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: -2px;
}

.ap-code-btn:disabled {
    color: #8c8c8c;
    cursor: not-allowed;
    opacity: 1;
}

.ap-code-btn[aria-busy="true"] {
    cursor: progress;
}

.ap-reveal {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0 var(--ap-radius) var(--ap-radius) 0;
    background: transparent;
    color: var(--ap-text-3);
    cursor: pointer;
}

.ap-reveal:hover {
    color: var(--ap-text);
}

.ap-reveal:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: -2px;
}

.ap-reveal svg {
    display: block;
}

.ap-reveal .ap-eye-closed,
.ap-reveal[aria-pressed="true"] .ap-eye-open {
    display: none;
}

.ap-reveal[aria-pressed="true"] .ap-eye-closed {
    display: block;
}

.ap-error,
.ap-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.ap-error {
    color: var(--ap-danger-text);
}

.ap-error[hidden],
.ap-hint:empty {
    display: none;
}

.ap-hint {
    color: var(--ap-text-3);
}

.ap-hint.is-success {
    color: var(--ap-success);
}

.ap-hint.is-error {
    color: var(--ap-danger-text);
}

.ap-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--ap-text-2);
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.ap-check input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--ap-brand);
    cursor: pointer;
}

.ap-check-agree {
    align-items: flex-start;
    width: auto;
    color: var(--ap-text-3);
    font-size: 12px;
    line-height: 1.6;
}

.ap-check-agree input {
    margin-top: 2px;
}

.ap-check a,
.ap-agreement a {
    color: var(--ap-brand);
    text-decoration: none;
}

.ap-check a:hover,
.ap-agreement a:hover {
    color: var(--ap-brand-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ap-check a:focus-visible,
.ap-agreement a:focus-visible {
    border-radius: 2px;
    outline: 2px solid var(--ap-brand);
    outline-offset: 2px;
}

.has-error .ap-check-agree input {
    outline: 1px solid var(--ap-danger);
    outline-offset: 1px;
}

.ap-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--ap-control-h);
    margin: 4px 0 0;
    padding: 0 16px;
    border: 0;
    border-radius: var(--ap-radius);
    background: var(--ap-brand);
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .12em;
    cursor: pointer;
    transition: background-color .15s ease;
}

.ap-submit:hover {
    background: var(--ap-brand-hover);
}

.ap-submit:active {
    background: var(--ap-brand-active);
}

.ap-submit:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: 2px;
}

.ap-submit:disabled {
    background: var(--ap-brand);
    cursor: progress;
    opacity: .72;
}

/* ==================== 提示与链接 ==================== */

.ap-alert {
    margin: 0 0 16px;
    padding: 9px 12px;
    border: 1px solid var(--ap-line-soft);
    border-radius: 2px;
    font-size: 13px;
    line-height: 1.6;
}

.ap-form > .ap-alert {
    margin: 0;
}

.ap-alert.is-success {
    border-color: #bbf7d0;
    background: var(--ap-success-soft);
    color: var(--ap-success);
}

.ap-alert.is-error {
    border-color: #fecdca;
    background: var(--ap-danger-soft);
    color: var(--ap-danger-text);
}

.ap-alert.is-warning {
    border-color: #fde68a;
    background: var(--ap-warning-soft);
    color: var(--ap-warning);
}

.ap-notice {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--ap-line-soft);
    border-left: 3px solid var(--ap-warning);
    border-radius: 2px;
    background: #ffffff;
    color: var(--ap-text-2);
    font-size: 13px;
    line-height: 1.7;
}

.ap-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-top: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.ap-links-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ap-links-sep {
    width: 1px;
    height: 12px;
    background: var(--ap-line-soft);
}

.ap-link {
    border-radius: 2px;
    color: var(--ap-brand);
    text-decoration: none;
}

.ap-link:hover {
    color: var(--ap-brand-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ap-link:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: 2px;
}

.ap-agreement {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--ap-divider);
    color: var(--ap-text-3);
    font-size: 12px;
    line-height: 1.6;
}

/* ==================== 第三方快捷登录（登录卡片底部，auth/partials/login-links.blade.php） ==================== */

/* 分隔线 + 居中标题「第三方快捷登录」 + 一排方形图标按钮；协议说明紧随其后（不再重复分隔线） */
.ap-social {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ap-divider);
    text-align: center;
}

.ap-social-title {
    margin: 0 0 12px;
    color: var(--ap-text-3);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
}

.ap-social-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 方形图标按钮：白底细描边，悬停描边变为品牌蓝 */
.ap-social-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ap-line-soft);
    border-radius: var(--ap-radius);
    background: #ffffff;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}

.ap-social-btn:hover {
    border-color: var(--ap-brand);
    background: var(--ap-brand-soft);
}

.ap-social-btn:active {
    background: #e3ecff;
}

.ap-social-btn:focus-visible {
    outline: 2px solid var(--ap-brand);
    outline-offset: 2px;
}

.ap-social-icon {
    display: block;
    flex: 0 0 auto;
}

/* QQ 品牌蓝；抖音为黑色圆底 + 白色音符（图形内自带颜色） */
.ap-social-icon.is-qq {
    color: #12b7f5;
}

.ap-social + .ap-agreement {
    margin-top: 16px;
    padding-top: 0;
    border-top: 0;
    text-align: center;
}

/* 卡片内说明文字（如微信扫码后「绑定手机号」的说明） */
.ap-note {
    margin: 0 0 16px;
    color: var(--ap-text-2);
    font-size: 13px;
    line-height: 1.7;
}

/* ==================== 微信扫码登录栏（auth/partials/wechat-qr.blade.php，二维码框样式见 public/css/wechat-qr.css） ==================== */

/* 默认隐藏：只在登录类卡片（验证码登录 / 账号密码登录）且宽度 ≥768px 时显示，手机端不显示也不生成二维码 */
.ap-qr {
    display: none;
    min-width: 0;
    flex-direction: column;
    align-items: center;
}

.ap-card-main {
    min-width: 0;
}

.ap-qr-title {
    margin: 0 0 16px;
    color: var(--ap-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.ap-qr-hint {
    max-width: 208px;
    margin: 6px 0 0;
    color: var(--ap-text-3);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

@media (min-width: 768px) {
    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-qr {
        display: flex;
    }
}

/* ≥1024px：一张卡片左右两栏，左侧扫码、竖分隔线、右侧原表单 */
@media (min-width: 1024px) {
    .ap-main:has(> .ap-card.has-qr:is([data-panel="login"], [data-panel="password"])) {
        grid-template-columns: minmax(0, 760px);
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        align-items: center;
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-qr {
        align-self: stretch;
        justify-content: center;
        padding-right: 32px;
        border-right: 1px solid var(--ap-divider);
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-card-main {
        padding-left: 32px;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .ap-main:has(> .ap-card.has-qr:is([data-panel="login"], [data-panel="password"])) {
        grid-template-columns: minmax(0, 720px);
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-qr {
        padding-right: 28px;
    }

    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-card-main {
        padding-left: 28px;
    }
}

/* iPad 竖屏（768–1023px）：扫码栏放在表单上方，下方分隔线 */
@media (min-width: 768px) and (max-width: 1023px) {
    .ap-card.has-qr:is([data-panel="login"], [data-panel="password"]) .ap-qr {
        margin-bottom: 24px;
        padding-bottom: 24px;
        border-bottom: 1px solid var(--ap-divider);
    }

    .ap-qr-title {
        margin-bottom: 12px;
    }
}

.ap-switch {
    margin: 20px 0 0;
    color: var(--ap-text-3);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

/* ==================== 小屏笔记本 / iPad 横屏 ==================== */

@media (max-width: 1279px) {
    .ap-main {
        grid-template-columns: minmax(0, 380px);
        padding: 16px 40px 28px;
    }

    .ap-card {
        padding: 28px 32px 24px;
    }
}

/* ==================== iPad 竖屏 ==================== */

@media (max-width: 1023px) {
    .ap-header {
        padding: 0 32px;
    }

    .ap-main {
        grid-template-columns: minmax(0, 440px);
        justify-content: center;
        align-content: center;
        padding: 24px 32px 40px;
    }

    .ap-card {
        padding: 32px 36px 28px;
    }

    /* iPad 竖屏：悬浮卡片居中 */
    .ap-page.has-cover .ap-card {
        padding: 36px 36px 28px;
    }
}

/* ==================== 手机 ==================== */

@media (max-width: 767px) {
    .ap-page {
        background: #ffffff;
    }

    .ap-header {
        height: 56px;
        padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
        border-bottom: 1px solid var(--ap-divider);
    }

    .ap-brand-mark {
        width: 28px;
        height: 28px;
    }

    .ap-brand-name {
        font-size: 16px;
    }

    .ap-main {
        display: block;
        padding: 20px max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left));
    }

    .ap-card {
        padding: 4px 0 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .ap-tabs {
        gap: 8px 28px;
    }

    .ap-tab {
        font-size: 17px;
    }

    .ap-links {
        margin-top: 18px;
    }

    .ap-footer {
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--ap-divider);
    }

    /* 手机：顶栏半透明白底；悬浮卡片保留圆角与投影，内边距收紧 */
    .ap-page.has-cover {
        background: transparent;
    }

    .ap-page.has-cover .ap-header {
        border-bottom-color: rgba(255, 255, 255, .6);
        background: rgba(255, 255, 255, .85);
    }

    .ap-page.has-cover .ap-card {
        padding: 28px 20px 20px;
    }

    .ap-page.has-cover .ap-footer {
        border-top-color: rgba(255, 255, 255, .6);
    }
}

@media (max-width: 359px) {
    .ap-tabs {
        gap: 8px 20px;
    }

    .ap-tab {
        font-size: 16px;
    }

    .ap-code-btn {
        min-width: 92px;
        padding: 0 8px;
    }
}

/* ==================== 触屏设备：控件加高、16px 字号 ==================== */

@media (max-width: 1024px), (pointer: coarse) {
    .ap-body {
        --ap-control-h: 44px;
    }

    .ap-input,
    .ap-prefix,
    .ap-code-btn {
        font-size: 16px;
    }

    .ap-submit {
        font-size: 16px;
    }

    /* 触屏：图标按钮放大到 44px 触控尺寸 */
    .ap-social-btn {
        width: 44px;
        height: 44px;
    }

    .ap-check {
        min-height: 32px;
    }

    .ap-check input {
        width: 18px;
        height: 18px;
    }

    .ap-reveal {
        width: 44px;
    }

    .ap-links .ap-link,
    .ap-switch .ap-link {
        display: inline-flex;
        min-height: 32px;
        align-items: center;
    }
}

/* 系统开启“降低透明度”时，顶栏与页脚改用不透明白底 */
@media (prefers-reduced-transparency: reduce) {
    .ap-page.has-cover .ap-header,
    .ap-page.has-cover .ap-footer {
        background: #ffffff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ap-panel {
        animation: none;
    }

    .ap-control,
    .ap-code-btn,
    .ap-submit,
    .ap-social-btn {
        transition: none;
    }
}
