/* ============================================================
   ZeroPass · 上下布局版  v13.2 (默认身份+固定高度)
   ============================================================ */

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

:root {
    --bg-app: #f1f4f8;
    --bg-surface: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-subtle: rgba(79, 70, 229, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto,
        "Inter", sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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: 480px;
    min-height: 400px;
    max-height: 96vh;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    height: auto;
}

/* ---------- 顶部导航 ---------- */
.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 5;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.header-left:hover {
    background: var(--brand-subtle);
}
.header-logo {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
}
.header-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.header-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-tertiary);
}
.header-right .version-badge {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-app);
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

/* ---------- 主体 ---------- */
.app-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 16px 12px;
    gap: 12px;
    background: var(--bg-app);
}

.capture-container {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* ---------- 输入区 ---------- */
.input-area {
    flex-shrink: 0;
}

.input-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 14px 16px 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* 标题 + 描述 整合为一行 */
.input-card-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.input-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.input-card-header p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 120px;
}

.input-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 字段 */
.field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.field label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.field input[type="text"],
.field input[type="number"] {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--bg-input);
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
    outline: none;
    font-family: var(--font);
    width: 100%;
    color: var(--text-primary);
    height: 34px;
}
.field input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--brand-subtle);
}

/* 组合框 */
.combo-box {
    position: relative;
    display: flex;
    align-items: center;
}
.combo-box input[type="text"] {
    padding-right: 36px;
}
.combo-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition:
        background var(--transition),
        color var(--transition);
}
.combo-toggle:hover {
    background: var(--brand-subtle);
    color: var(--brand);
}
.combo-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 150px;
    overflow-y: auto;
    z-index: 100;
    padding: 4px 0;
    list-style: none;
}
.combo-menu.open {
    display: block;
}
.combo-menu li {
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-primary);
}
.combo-menu li:hover {
    background: var(--brand-subtle);
    color: var(--brand);
}
.combo-menu li:active {
    background: var(--brand);
    color: #fff;
}

/* 按钮同行 2:1 */
.action-row-buttons {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}
.action-row-buttons .btn {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
}
.action-row-buttons .btn.primary {
    background: var(--brand);
    color: #fff;
    flex: 2;
}
.action-row-buttons .btn.primary:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25);
}
.action-row-buttons .btn.primary:active {
    transform: scale(0.97);
}
.action-row-buttons .btn.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
    flex: 1;
}
.action-row-buttons .btn.secondary:hover {
    background: var(--bg-app);
    border-color: var(--text-tertiary);
}
.action-row-buttons .btn.secondary:active {
    transform: scale(0.97);
}

/* ---------- 输出区 ---------- */
.output-area {
    flex: 0 0 auto;
    min-height: 200px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.output-area::-webkit-scrollbar {
    width: 3px;
}
.output-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    width: 100%;
}
.placeholder i {
    font-size: 2.4rem;
    opacity: 0.3;
}
.placeholder p {
    font-size: 0.8rem;
}

#resultView {
    width: 100%;
}

.result-view {
    width: 100%;
    display: flex;
    flex-direction: column;
}
.result-view .result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 4px;
}
.result-view .result-header .result-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.result-view .result-header .result-actions {
    display: flex;
    gap: 4px;
}
.result-view .result-header .result-actions .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}
.result-view .result-header .result-actions .action-btn:hover {
    background: var(--brand-subtle);
    border-color: var(--brand);
    color: var(--brand);
}
.result-view .result-header .result-actions .action-btn:active {
    transform: scale(0.94);
}
.result-view .result-header .result-actions .action-btn.copied {
    color: var(--text-tertiary);
    border-color: var(--border-color);
    pointer-events: none;
}
.result-view .result-header .result-actions .action-btn i {
    font-size: 0.7rem;
}

.result-view .result-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 6px;
    overflow-y: auto;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 8px;
}
.result-row:last-child {
    border-bottom: none;
}
.result-row .label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 40px;
}
.result-row .value {
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    font-family: "SF Mono", "Fira Code", monospace;
}
.result-row .value.password {
    color: var(--brand);
    font-weight: 700;
    font-size: 0.8rem;
}
.result-row .value.small {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* ---------- 底部 ---------- */
.app-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 36px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
}
.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: all var(--transition);
    text-decoration: none;
}
.footer-link:hover {
    background: var(--brand-subtle);
    color: var(--brand);
}
.footer-link i {
    font-size: 0.9rem;
}
.footer-right {
    font-size: 0.55rem;
    color: var(--text-tertiary);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 8px 20px;
    background: var(--text-primary);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    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);
}

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

    .app {
        max-width: 100%;
        min-height: 100vh;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
    }

    .app-header {
        padding: 0 16px;
        height: 52px;
    }
    .header-logo {
        width: 28px;
        height: 28px;
    }
    .header-brand {
        font-size: 1rem;
    }
    .header-title {
        font-size: 0.85rem;
    }
    .header-right .version-badge {
        font-size: 0.65rem;
        padding: 2px 10px;
    }

    .app-main {
        flex: 1 1 auto;
        padding: 14px 16px 12px;
        gap: 12px;
        min-height: 0;
        overflow: hidden;
    }

    .capture-container {
        flex: 1 1 auto;
        gap: 12px;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* 输出区在上，输入区在下 */
    .output-area {
        order: -1;
        flex: 1 1 auto;
        min-height: 100px;
        padding: 14px 16px;
        margin-bottom: 0;
    }
    .input-area {
        order: 0;
        flex-shrink: 0;
    }

    .input-card {
        padding: 12px 14px 14px;
    }
    .input-card-header {
        gap: 8px;
        margin-bottom: 10px;
    }
    .input-card-header h2 {
        font-size: 0.95rem;
        white-space: nowrap;
    }
    .input-card-header p {
        font-size: 0.7rem;
        min-width: 100px;
    }

    .input-card-body {
        gap: 8px;
    }

    .field {
        gap: 3px;
    }
    .field label {
        font-size: 0.7rem;
    }
    .field input[type="text"],
    .field input[type="number"] {
        padding: 6px 10px;
        font-size: 0.85rem;
        height: 34px;
        border-width: 1.5px;
    }
    .combo-box input[type="text"] {
        padding-right: 36px;
    }
    .combo-toggle {
        font-size: 1.1rem;
        padding: 4px 6px;
    }
    .combo-menu {
        max-height: 150px;
    }
    .combo-menu li {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .action-row-buttons {
        gap: 8px;
        margin-top: 2px;
    }
    .action-row-buttons .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        height: 36px;
        border-radius: var(--radius-full);
    }
    .action-row-buttons .btn i {
        font-size: 0.85rem;
    }

    .output-area {
        min-height: 120px;
        padding: 14px 16px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .placeholder i {
        font-size: 2.4rem;
    }
    .placeholder p {
        font-size: 0.8rem;
    }

    .result-view .result-header {
        padding-bottom: 8px;
    }
    .result-view .result-header .result-title {
        font-size: 0.85rem;
    }
    .result-view .result-header .result-actions .action-btn {
        font-size: 0.6rem;
        padding: 3px 8px;
    }
    .result-view .result-header .result-actions .action-btn i {
        font-size: 0.7rem;
    }
    .result-view .result-body {
        padding-top: 6px;
        gap: 1px;
    }
    .result-row {
        padding: 3px 0;
        gap: 8px;
    }
    .result-row .label {
        font-size: 0.65rem;
        min-width: 40px;
    }
    .result-row .value {
        font-size: 0.75rem;
    }
    .result-row .value.password {
        font-size: 0.8rem;
    }
    .result-row .value.small {
        font-size: 0.65rem;
    }

    .app-footer {
        padding: 0 16px;
        height: 36px;
    }
    .footer-left {
        gap: 12px;
    }
    .footer-link {
        width: 24px;
        height: 24px;
    }
    .footer-link i {
        font-size: 0.9rem;
    }
    .footer-right {
        font-size: 0.55rem;
    }

    .toast {
        bottom: 20px;
        padding: 8px 20px;
        font-size: 0.8rem;
    }
}

/* 极小屏适配 (≤400px) */
@media (max-width: 400px) {
    .app-header {
        padding: 0 12px;
        height: 46px;
    }
    .header-logo {
        width: 24px;
        height: 24px;
    }
    .header-brand {
        font-size: 0.9rem;
    }
    .header-title {
        font-size: 0.75rem;
    }

    .app-main {
        padding: 10px 12px 8px;
        gap: 10px;
    }
    .capture-container {
        gap: 10px;
    }

    .input-card {
        padding: 10px 12px 12px;
    }
    .input-card-header h2 {
        font-size: 0.85rem;
    }
    .input-card-header p {
        font-size: 0.65rem;
    }
    .field input[type="text"],
    .field input[type="number"] {
        font-size: 0.75rem;
        height: 30px;
        padding: 4px 8px;
    }
    .action-row-buttons .btn {
        font-size: 0.7rem;
        height: 32px;
        padding: 4px 10px;
    }

    .output-area {
        min-height: 100px;
        padding: 10px 12px;
    }
    .placeholder i {
        font-size: 2rem;
    }
    .placeholder p {
        font-size: 0.7rem;
    }

    .result-row .label {
        font-size: 0.6rem;
        min-width: 34px;
    }
    .result-row .value {
        font-size: 0.7rem;
    }
    .result-row .value.password {
        font-size: 0.75rem;
    }

    .app-footer {
        height: 32px;
        padding: 0 12px;
    }
    .footer-right {
        font-size: 0.5rem;
    }
}
