/* ============================================================
   ZeroPass · 便携版  v2.8 (图标缩小，输入同行)
   ============================================================ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-app: #f6f8fa;
    --bg-surface: #ffffff;
    --bg-card: #f8f9fc;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-subtle: rgba(79, 70, 229, 0.08);
    --radius: 16px;
    --radius-full: 9999px;
    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto,
        "Inter", sans-serif;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 0;
}

/* ---------- 应用容器 ---------- */
.app {
    width: 100%;
    max-width: 560px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding: 24px 28px 20px;
    gap: 20px;
}

/* ============================================================
   板块一：顶部
   ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.header-timestamp {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   板块二：中间卡片
   ============================================================ */
.main-card {
    flex: 0 1 auto;
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 水印背景 */
.card-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
}

.watermark-logo {
    width: 100%;
    height: 100%;
    display: block;
}

.card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

/* 密码 */
.password-display {
    font-size: 2rem;
    font-weight: 700;
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--brand);
    letter-spacing: 0.04em;
    padding: 4px 0 14px;
    min-height: 56px;
    word-break: break-all;
    line-height: 1.3;
    text-align: center;
}

/* 操作按钮 */
.password-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    background: transparent;
    color: var(--text-secondary);
}
.action-btn:hover {
    background: var(--brand-subtle);
    border-color: var(--brand);
    color: var(--brand);
}
.action-btn:active {
    transform: scale(0.95);
}
.action-btn.copied {
    color: var(--text-tertiary);
    border-color: var(--border-color);
    pointer-events: none;
}
.action-btn.copied:hover {
    background: transparent;
}
.action-btn i {
    font-size: 1rem;
}

/* punycode */
.punycode-display {
    font-size: 0.7rem;
    font-weight: 400;
    font-family: "SF Mono", "Fira Code", monospace;
    color: var(--text-tertiary);
    text-align: center;
    padding: 4px 0 14px;
    letter-spacing: 0.02em;
    opacity: 0.7;
    word-break: break-all;
}

/* 输入行：强制同行 */
.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 2px;
    flex-wrap: nowrap;
}

.identity-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-family: var(--font);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    min-height: 48px;
}
.identity-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-subtle);
}
.identity-input::placeholder {
    color: var(--text-tertiary);
}

.generate-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    background: var(--brand);
    color: #fff;
    white-space: nowrap;
    min-height: 48px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.generate-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}
.generate-btn:active {
    transform: scale(0.96);
}
.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================
   板块三：底部（强制一行）
   ============================================================ */
.app-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
    flex-wrap: nowrap;
}

.footer-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
    transition: all 0.2s ease;
    text-decoration: none;
}
.footer-link:hover {
    background: var(--brand-subtle);
    color: var(--brand);
}
.footer-link i {
    font-size: 0.9rem;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 10px 24px;
    background: var(--text-primary);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s ease;
    box-shadow: var(--shadow-md);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   移动端
   ============================================================ */
@media (max-width: 640px) {
    body {
        padding: 0;
        background: var(--bg-app);
    }

    .app {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        padding: 20px 18px 16px;
        gap: 16px;
        min-height: auto;
        height: auto;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
    }
    .brand-name {
        font-size: 1.1rem;
    }
    .header-timestamp {
        font-size: 0.7rem;
    }

    .main-card {
        padding: 20px 16px 18px;
    }
    .card-watermark {
        width: 140px;
        height: 140px;
    }
    .password-display {
        font-size: 1.6rem;
        min-height: 48px;
        padding: 2px 0 10px;
    }

    .password-actions .action-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .punycode-display {
        font-size: 0.65rem;
        padding: 2px 0 10px;
    }

    .input-row {
        gap: 8px;
        flex-wrap: nowrap;
    }
    .identity-input {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 0.95rem;
        min-width: 0;
    }
    .generate-btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    .app-footer {
        gap: 8px;
        padding-top: 2px;
        flex-wrap: nowrap;
    }
    .footer-links {
        gap: 6px;
    }
    .footer-link {
        width: 24px;
        height: 24px;
    }
    .footer-link i {
        font-size: 0.8rem;
    }
    .footer-copyright {
        font-size: 0.65rem;
    }
}

@media (max-width: 400px) {
    .app {
        padding: 14px 14px 12px;
        gap: 12px;
    }
    .brand-name {
        font-size: 1rem;
    }
    .brand-logo {
        width: 24px;
        height: 24px;
    }
    .header-timestamp {
        font-size: 0.65rem;
    }
    .main-card {
        padding: 16px 12px 14px;
    }
    .password-display {
        font-size: 1.3rem;
        min-height: 40px;
    }
    .card-watermark {
        width: 110px;
        height: 110px;
    }
    .punycode-display {
        font-size: 0.6rem;
    }

    .input-row {
        gap: 6px;
    }
    .identity-input {
        min-height: 38px;
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .generate-btn {
        min-height: 38px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .app-footer {
        gap: 6px;
    }
    .footer-link {
        width: 20px;
        height: 20px;
    }
    .footer-link i {
        font-size: 0.7rem;
    }
    .footer-copyright {
        font-size: 0.55rem;
    }
}
