* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-cyan: #22d3ee;
    --primary-violet: #a78bfa;
    --primary-rose: #fb7185;
    --bg-dark: #09090b;
    --bg-card: rgba(24, 24, 27, 0.7);
    --bg-input: rgba(9, 9, 11, 0.6);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(34, 211, 238, 0.3);
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 24px;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

/* 隐藏滚动条但保持滚动功能 */
body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* 动态背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(34, 211, 238, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(167, 139, 250, 0.12), transparent),
        radial-gradient(ellipse 40% 30% at 50% 50%, rgba(251, 113, 133, 0.05), transparent);
    pointer-events: none;
    z-index: 0;
}

/* 网格背景 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-violet) 50%, var(--primary-rose) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    position: relative;
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-cyan), var(--primary-violet), transparent);
    border-radius: 2px;
}

.header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* 主卡片 - 玻璃拟态 */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 28px;
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 20px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 100px -20px rgba(34, 211, 238, 0.1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* 输入区域标签 */
.input-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

/* 快捷键提示 */
.shortcut-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.shortcut-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

/* 粘贴按钮 */
.paste-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(167, 139, 250, 0.1));
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    color: var(--primary-cyan);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.paste-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.paste-btn:hover::before {
    left: 100%;
}

.paste-btn:hover {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(167, 139, 250, 0.2));
    border-color: var(--primary-cyan);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
    transform: translateY(-1px);
}

.paste-btn:active {
    transform: translateY(0) scale(0.98);
}

.paste-btn svg {
    width: 14px;
    height: 14px;
}

/* 输入框 */
.input-wrapper {
    position: relative;
    border-radius: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow:
        0 0 0 3px rgba(34, 211, 238, 0.1),
        0 0 30px rgba(34, 211, 238, 0.1);
}

.input-area {
    width: 100%;
    min-height: 130px;
    padding: 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: "JetBrains Mono", "Fira Code", Consolas, "PingFang SC", "Microsoft YaHei", monospace;
    font-size: 13px;
    resize: none;
    transition: all 0.2s ease;
}

.input-area:focus {
    outline: none;
}

.input-area::placeholder {
    color: var(--text-muted);
}

.input-area::-webkit-scrollbar {
    width: 6px;
}

.input-area::-webkit-scrollbar-track {
    background: transparent;
}

.input-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.input-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.input-area::-webkit-resizer {
    display: none;
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* 生成按钮 */
.generate-btn {
    flex: 1;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-violet) 100%);
    border: none;
    border-radius: 12px;
    color: #09090b;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 30px -10px rgba(34, 211, 238, 0.5),
        0 0 40px rgba(167, 139, 250, 0.3);
}

.generate-btn:active {
    transform: translateY(0) scale(0.98);
}

/* 清空按钮 */
.clear-btn {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    background: rgba(251, 113, 133, 0.08);
    border: 1px solid rgba(251, 113, 133, 0.15);
    border-radius: 12px;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn svg {
    width: 20px;
    height: 20px;
    transition: all 0.25s ease;
}

.clear-btn:hover {
    background: rgba(251, 113, 133, 0.15);
    border-color: rgba(251, 113, 133, 0.3);
    color: var(--primary-rose);
    box-shadow: 0 0 20px rgba(251, 113, 133, 0.15);
}

.clear-btn:hover svg {
    transform: scale(1.1) rotate(-5deg);
}

.clear-btn:active {
    transform: scale(0.95);
}

/* 结果区域 */
.result-area {
    margin-top: 28px;
    display: none;
}

.result-area.active {
    display: block;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 二维码卡片 */
.qr-item {
    background: rgba(9, 9, 11, 0.5);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.2), transparent);
}

.qr-item:hover {
    border-color: rgba(34, 211, 238, 0.2);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
}

/* 二维码下方操作区 */
.qr-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 16px;
}

.qr-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    letter-spacing: 0.02em;
}

.qr-download-btn:hover {
    color: var(--primary-cyan);
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
}

.copy-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-btn:hover {
    border-color: rgba(167, 139, 250, 0.4);
    color: var(--primary-violet);
    background: rgba(167, 139, 250, 0.1);
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0) scale(0.95);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

/* 二维码容器 */
.qr-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 10px 30px -5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

/* 二维码 hover 效果：浮起 + 青色发光边框 */
.qr-wrapper:hover {
    transform: translateY(-4px);
    box-shadow:
        0 0 0 2px rgba(34, 211, 238, 0.5),
        0 0 20px rgba(34, 211, 238, 0.15),
        0 0 40px rgba(34, 211, 238, 0.08),
        0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

/* 悬停提示：点击放大 - 居中显示 */
.qr-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.qr-wrapper::after {
    content: '点击放大';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 10px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.qr-wrapper:hover::before {
    opacity: 1;
}

.qr-wrapper:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.qr-wrapper canvas {
    width: min(100%, 240px);
    height: auto;
    display: block !important;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-violet));
    color: #09090b;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow:
        0 10px 40px -10px rgba(34, 211, 238, 0.5),
        0 0 60px rgba(167, 139, 250, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 二维码灯罩效果 (Lightbox) */
.qr-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.qr-lightbox.active {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 1;
    visibility: visible;
}

.qr-lightbox-content {
    position: relative;
    transform: scale(0.7);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.qr-lightbox.active .qr-lightbox-content {
    transform: scale(1);
}

.qr-lightbox-canvas {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 24px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 25px 80px -10px rgba(0, 0, 0, 0.6),
        0 0 120px rgba(34, 211, 238, 0.15),
        0 0 120px rgba(167, 139, 250, 0.1);
}

.qr-lightbox-canvas canvas {
    display: block;
    max-width: 80vw;
    max-height: 80vh;
}

.qr-lightbox-hint {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
}

.footer a {
    color: var(--primary-cyan);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.footer a:hover {
    color: var(--primary-violet);
}

/* 安全提示区域 */
.security-notice {
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.security-notice svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--primary-cyan);
    margin-top: 1px;
}

.security-notice-content {
    flex: 1;
}

.security-notice-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-cyan);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.security-notice-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.security-notice-desc strong {
    color: var(--text-primary);
    font-weight: 500;
}

.security-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.security-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.security-tag svg {
    width: 12px;
    height: 12px;
    color: var(--primary-cyan);
}

.github-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    margin-top: -2px;
}

/* 错误状态 */
.error-message {
    color: var(--primary-rose);
    padding: 24px;
    text-align: center;
    font-size: 13px;
}

.error-message small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 模板标签页 */
.template-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.4s ease;
}

.tab-btn:hover::before {
    left: 100%;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(167, 139, 250, 0.12));
    border-color: rgba(34, 211, 238, 0.25);
    color: var(--primary-cyan);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}

/* 模板表单容器 */
.template-forms {
    position: relative;
    overflow: hidden;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.template-form {
    display: none;
}

.template-form.active {
    display: block;
}

/* 表单组 */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.25s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-group select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
    font-family: "JetBrains Mono", "Fira Code", Consolas, "PingFang SC", "Microsoft YaHei", monospace;
    font-size: 13px;
}

/* 密码输入框容器 */
.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* 响应式 */
@media (max-width: 480px) {
    body {
        padding: 32px 16px;
    }

    .card {
        padding: 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .security-notice {
        flex-direction: column;
        padding: 14px 16px;
    }

    .security-notice svg {
        margin-bottom: 4px;
    }

    .security-features {
        justify-content: flex-start;
    }

    /* 移动端隐藏快捷键提示 */
    .shortcut-hint {
        display: none;
    }
}

/* Apple-style layout refresh */
:root {
    color-scheme: dark;
    --accent: #0a84ff;
    --accent-pressed: #0071e3;
    --surface: rgba(30, 30, 32, 0.74);
    --surface-raised: rgba(44, 44, 46, 0.78);
    --field: rgba(118, 118, 128, 0.16);
    --separator: rgba(235, 235, 245, 0.15);
    --label: rgba(235, 235, 245, 0.6);
    --tertiary-label: rgba(235, 235, 245, 0.38);
    --system-red: #ff453a;
}

* { -webkit-tap-highlight-color: transparent; }
html, body, button, input, select, textarea, a, img, canvas, [role='button'] { touch-action: manipulation; }

body {
    display: block;
    min-height: 100dvh;
    padding: calc(clamp(16px, 3vw, 40px) + env(safe-area-inset-top))
             calc(24px + env(safe-area-inset-right))
             calc(40px + env(safe-area-inset-bottom))
             calc(24px + env(safe-area-inset-left));
    color: #f5f5f7;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
    font-size: 16px;
    background: #050505;
    -webkit-text-size-adjust: 100%;
}

body::before {
    inset: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0.7px, transparent 0.9px);
    background-size: 18px 18px;
    opacity: 0.5;
    mask-image: radial-gradient(ellipse 78% 54% at 50% 0%, #000 0%, rgba(0, 0, 0, 0.72) 42%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 78% 54% at 50% 0%, #000 0%, rgba(0, 0, 0, 0.72) 42%, transparent 78%);
}

body::after {
    display: block;
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(900px 600px at 8% -12%, rgba(99, 102, 241, 0.12), transparent 60%),
        radial-gradient(800px 600px at 105% 12%, rgba(10, 132, 255, 0.1), transparent 58%),
        radial-gradient(1000px 800px at 50% 115%, rgba(139, 92, 246, 0.08), transparent 60%);
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-position: 0 0, 100% 0, 50% 100%;
    background-size: 100% 100%, 100% 100%, 100% 100%;
}

.container {
    width: min(100%, 760px);
    max-width: none;
    margin: 0 auto;
}

.header {
    max-width: 580px;
    margin: 0 auto clamp(28px, 5vw, 48px);
    text-align: left;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    height: 26px;
    margin: 0 0 14px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--label);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.header h1 {
    margin: 0;
    color: #f5f5f7;
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: clamp(34px, 7vw, 52px);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -0.045em;
}

.header h1::after { display: none; }

.header .subtitle {
    max-width: 410px;
    margin: 18px 0 0;
    color: var(--label);
    font-size: 17px;
    line-height: 1.45;
}

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

.brand-text {
    min-width: 0;
}

.brand .eyebrow {
    margin-bottom: 6px;
}

.header .logo {
    --logo-size: calc(clamp(34px, 7vw, 52px) * 1.6 * 1.04);
    display: block;
    width: var(--logo-size);
    height: var(--logo-size);
    margin: 0;
    align-self: flex-end;
    border-radius: calc(var(--logo-size) * 0.2);
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.theme-toggle {
    position: absolute;
    top: 48px;
    right: 18px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: #f5f5f7;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 100ms ease-out;
    z-index: 10;
}
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 17px; height: 17px; display: none; }
.theme-toggle[data-theme='light'] .icon-sun { display: block; }
.theme-toggle[data-theme='dark'] .icon-moon { display: block; }
.theme-toggle[data-theme='system'] .icon-auto { display: block; }

.card {
    padding: clamp(20px, 4.5vw, 34px);
    overflow: visible;
    border: 1px solid var(--separator);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
}

.card::before { display: none; }

.template-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    margin: 0 0 28px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 13px;
    background: rgba(118, 118, 128, 0.18);
}

.tab-btn {
    min-height: 36px;
    justify-content: center;
    gap: 0;
    padding: 7px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--label);
    font-size: 13px;
    font-weight: 600;
    transition: background 180ms ease, color 180ms ease, transform 100ms ease-out, box-shadow 180ms ease;
}

.tab-btn span { display: none; }
.tab-btn::before { display: none; }
.tab-btn:hover { border: 0; background: rgba(255, 255, 255, 0.08); color: #fff; }
.tab-btn.active {
    border: 0;
    background: var(--surface-raised);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.07);
}
.tab-btn:active { transform: scale(0.97); }

.template-forms { overflow: visible; transition: height 220ms ease; }
.form-group { margin-bottom: 18px; }
.form-group label, .input-label {
    margin-bottom: 9px;
    color: #f5f5f7;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.input-wrapper, .form-group input, .form-group select, .form-group textarea {
    border: 0;
    border-radius: 14px;
    background: var(--field);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: background 180ms ease, box-shadow 180ms ease;
}
.input-wrapper:focus-within {
    background: rgba(118, 118, 128, 0.25);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    background: rgba(118, 118, 128, 0.25);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.input-area { min-height: 132px; padding: 16px; color: #f5f5f7; font-size: 16px; line-height: 1.55; }
.form-group input, .form-group select, .form-group textarea { padding: 13px 15px; color: #f5f5f7; font-size: 16px; }
.form-group textarea { min-height: 98px; }
.input-area::placeholder, .form-group input::placeholder, .form-group textarea::placeholder { color: var(--tertiary-label); }
.form-group select option { background: #1c1c1e; }

.paste-btn {
    min-height: 32px;
    padding: 6px 10px;
    border: 0;
    border-radius: 9px;
    background: rgba(10, 132, 255, 0.16);
    color: #64b5ff;
    font-size: 13px;
    transition: background 180ms ease, transform 100ms ease-out;
}
.paste-btn::before { display: none; }
.paste-btn:hover { border: 0; background: rgba(10, 132, 255, 0.25); box-shadow: none; transform: none; }
.paste-btn:active { transform: scale(0.96); }
.shortcut-hint { margin-top: 10px; color: var(--tertiary-label); }
.shortcut-hint kbd { border-color: rgba(255, 255, 255, 0.11); background: rgba(255, 255, 255, 0.07); color: var(--label); font-family: inherit; }

.btn-group { gap: 10px; margin-top: 28px; }
.generate-btn, .clear-btn { height: 50px; border-radius: 14px; transition: background 180ms ease, transform 100ms ease-out, box-shadow 180ms ease; }
.generate-btn {
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(10, 132, 255, 0.22);
}
.generate-btn::before { display: none; }
.generate-btn:hover { background: #2997ff; transform: none; box-shadow: 0 10px 24px rgba(10, 132, 255, 0.28); }
.generate-btn:active { background: var(--accent-pressed); transform: scale(0.985); }
.clear-btn { width: 50px; border: 0; background: rgba(255, 69, 58, 0.13); color: #ff6961; }
.clear-btn:hover { border: 0; background: rgba(255, 69, 58, 0.22); color: #ff8b85; box-shadow: none; }
.clear-btn:hover svg { transform: none; }
.clear-btn:active { transform: scale(0.94); }

.result-area { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--separator); }
.result-area.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: resultAppear 260ms ease-out;
}
.result-area.active::before {
    content: "已生成二维码";
    margin-bottom: 12px;
    color: var(--label);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.qr-style-picker[hidden] { display: none; }
.qr-style-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 360px);
    margin-bottom: 14px;
}
.qr-style-label {
    color: var(--label);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.qr-style-select {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 30px 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    color: #f5f5f7;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease;
}
.qr-style-select:hover { border-color: rgba(255, 255, 255, 0.22); background-color: rgba(255, 255, 255, 0.12); }
.qr-style-select option { background: #1c1c1e; color: #f5f5f7; }
.qr-style-select:focus-visible { outline: 3px solid rgba(10, 132, 255, 0.5); outline-offset: 2px; }
.qr-style-select:disabled { opacity: 0.5; cursor: default; }
@keyframes resultAppear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.qr-item { width: min(100%, 360px); min-width: 0; margin: 0; padding: 18px; border-color: rgba(255, 255, 255, 0.08); border-radius: 20px; background: rgba(0, 0, 0, 0.2); }
.qr-item::before { display: none; }
.qr-item:hover { border-color: rgba(255, 255, 255, 0.14); box-shadow: none; }
.qr-actions { width: 100%; gap: 8px; margin-top: 14px; }
.qr-download-btn { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-color: transparent; border-radius: 9px; background: rgba(255, 255, 255, 0.07); color: var(--label); font-size: 13px; }
.qr-download-btn:hover { border-color: transparent; background: rgba(10, 132, 255, 0.19); color: #90cbff; }
.qr-download-btn:active { transform: scale(0.97); }
.qr-download-btn svg { width: 16px; height: 16px; }
.copy-btn { width: 38px; height: 38px; border-color: transparent; border-radius: 9px; background: rgba(255, 255, 255, 0.07); color: var(--label); }
.copy-btn:hover { border-color: transparent; background: rgba(10, 132, 255, 0.19); color: #90cbff; transform: none; }
.copy-btn:active { transform: scale(0.92); }
.copy-btn svg { width: 17px; height: 17px; }
.qr-wrapper { width: 100%; min-height: 0; padding: 0; border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.qr-wrapper:hover { transform: none; box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.34), 0 8px 22px rgba(0, 0, 0, 0.12); }
.qr-wrapper::before { border-radius: 14px; background: rgba(0, 0, 0, 0.34); }
.qr-wrapper::after { border-radius: 999px; background: rgba(28, 28, 30, 0.78); padding: 8px 14px; }
.qr-wrapper canvas { width: min(100%, 288px); }

.security-notice { margin-top: 22px; padding: 18px 20px; border-color: rgba(255, 255, 255, 0.08); border-radius: 20px; background: rgba(255, 255, 255, 0.055); }
.security-notice svg, .security-notice-title, .security-tag svg { color: #64b5ff; }
.security-notice-desc { color: var(--label); }
.security-notice-desc strong { color: #f5f5f7; }
.security-tag { border-color: transparent; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--label); }
.footer { margin-top: 20px; padding-top: 0; border-top: 0; }
.footer p { margin-top: 18px; color: var(--tertiary-label); }
.footer a { color: var(--label); }
.footer a:hover { color: #fff; }

.toast { top: max(18px, env(safe-area-inset-top)); padding: 11px 16px; border-radius: 999px; background: rgba(48, 48, 50, 0.92); color: #fff; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.qr-lightbox.active { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.qr-lightbox-content { transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.qr-lightbox-canvas { border-radius: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); }
.qr-lightbox-img {
    display: none;
    max-width: min(82vw, 520px);
    max-height: 78vh;
    padding: 16px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
.qr-lightbox.img-mode .qr-lightbox-canvas { display: none; }
.qr-lightbox.img-mode .qr-lightbox-img { display: block; }

button:focus-visible, [role="button"]:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 3px solid rgba(10, 132, 255, 0.72);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    body { padding: calc(26px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
    .header { margin-bottom: 26px; }
    .header .subtitle { font-size: 16px; }
    .card { padding: 18px; border-radius: 24px; }
    .template-tabs { margin-bottom: 22px; }
    .tab-btn { padding-inline: 4px; font-size: 13px; }
    .input-area { min-height: 142px; }
    .result-area.active { gap: 0; }
    .qr-item { padding: 14px; }
    .qr-actions { gap: 6px; margin-top: 12px; }
    .copy-btn { width: 40px; height: 40px; }
    .theme-toggle { width: 40px; height: 40px; }
    .qr-wrapper { padding: 0; }
    .qr-wrapper canvas { width: min(100%, 264px); }
    .security-notice { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    .card, .toast { background: #1c1c1e; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .card, .security-notice { border-color: rgba(255, 255, 255, 0.28); }
}

/* Light material palette */
html.light{
    color-scheme: light;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-raised: #ffffff;
    --field: rgba(118, 118, 128, 0.1);
    --separator: rgba(60, 60, 67, 0.16);
    --label: #6e6e73;
    --tertiary-label: #8e8e93;
}

html.light body{
    color: #1d1d1f;
    background: #f3f5fa;
}

html.light body::before{
    background-image: radial-gradient(circle, rgba(76, 92, 148, 0.3) 0.7px, transparent 0.9px);
    opacity: 0.5;
}

html.light body::after{
    display: block;
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='140'%20height='140'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.8'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3C/filter%3E%3Crect%20width='140'%20height='140'%20filter='url(%23n)'%20opacity='0.16'/%3E%3C/svg%3E"),
        radial-gradient(900px 600px at 8% -12%, rgba(99, 102, 241, 0.14), transparent 60%),
        radial-gradient(800px 600px at 105% 12%, rgba(10, 132, 255, 0.12), transparent 58%),
        radial-gradient(1000px 800px at 50% 115%, rgba(139, 92, 246, 0.1), transparent 60%);
    background-repeat: repeat, no-repeat, no-repeat, no-repeat;
    background-position: 0 0, 0 0, 100% 0, 50% 100%;
    background-size: 140px 140px, 100% 100%, 100% 100%, 100% 100%;
}

html.light .eyebrow{
    border-color: rgba(60, 60, 67, 0.12);
    background: rgba(255, 255, 255, 0.75);
    color: #6e6e73;
}
html.light .theme-toggle{
    border-color: rgba(60, 60, 67, 0.14);
    background: rgba(255, 255, 255, 0.85);
    color: #6e6e73;
}
html.light .theme-toggle:hover{
    background: rgba(255, 255, 255, 1);
    color: #1d1d1f;
}
html.light .header h1{ color: #1d1d1f; }
html.light .header .subtitle{ color: #6e6e73; }

html.light .card{
    border-color: rgba(60, 60, 67, 0.1);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 24px 70px rgba(72, 88, 150, 0.13), 0 2px 10px rgba(72, 88, 150, 0.06), inset 0 1px rgba(255, 255, 255, 0.85);
}

html.light .template-tabs{
    border-color: rgba(60, 60, 67, 0.08);
    background: rgba(118, 118, 128, 0.09);
}
html.light .tab-btn{ color: #6e6e73; }
html.light .tab-btn:hover{ background: rgba(255, 255, 255, 0.72); color: #1d1d1f; }
html.light .tab-btn.active{ color: #1d1d1f; background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 4px rgba(60, 60, 67, 0.12); }

html.light .form-group label, html.light .input-label{ color: #1d1d1f; }
html.light .input-wrapper, html.light .form-group input, html.light .form-group select, html.light .form-group textarea{
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.1);
}
html.light .input-wrapper:focus-within{
    background: #fff;
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.22), inset 0 0 0 1px rgba(10, 132, 255, 0.3);
}
html.light .form-group input:focus, html.light .form-group select:focus, html.light .form-group textarea:focus{
    background: #fff;
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.22), inset 0 0 0 1px rgba(10, 132, 255, 0.3);
}
html.light .input-area, html.light .form-group input, html.light .form-group select, html.light .form-group textarea{ color: #1d1d1f; }
html.light .input-area::placeholder, html.light .form-group input::placeholder, html.light .form-group textarea::placeholder{ color: #8e8e93; }
html.light .form-group select option{ background: #fff; color: #1d1d1f; }
html.light .shortcut-hint{ color: #8e8e93; }
html.light .shortcut-hint kbd{ border-color: rgba(60, 60, 67, 0.18); background: rgba(118, 118, 128, 0.11); color: #515154; }

html.light .qr-item{ border-color: rgba(60, 60, 67, 0.1); background: rgba(255, 255, 255, 0.66); }
html.light .qr-item:hover{ border-color: rgba(60, 60, 67, 0.2); }
html.light .qr-download-btn, html.light .copy-btn{ background: rgba(118, 118, 128, 0.1); color: #6e6e73; }
html.light .qr-download-btn:hover, html.light .copy-btn:hover{ background: rgba(10, 132, 255, 0.12); color: #0071e3; }
html.light .qr-wrapper{ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
html.light .qr-style-select{ border-color: rgba(60, 60, 67, 0.14); background-color: rgba(255, 255, 255, 0.85); color: #1d1d1f; }
html.light .qr-style-select:hover{ border-color: rgba(60, 60, 67, 0.28); background-color: #fff; }
html.light .qr-style-select option{ background: #fff; color: #1d1d1f; }

html.light .security-notice{ border-color: rgba(60, 60, 67, 0.1); background: rgba(255, 255, 255, 0.58); }
html.light .security-notice svg, html.light .security-notice-title, html.light .security-tag svg{ color: #0071e3; }
html.light .security-notice-desc{ color: #6e6e73; }
html.light .security-notice-desc strong{ color: #1d1d1f; }
html.light .security-tag{ background: rgba(118, 118, 128, 0.1); color: #6e6e73; }
html.light .footer p{ color: #8e8e93; }
html.light .footer a{ color: #515154; }
html.light .footer a:hover{ color: #1d1d1f; }

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
html.light .card, html.light .security-notice{ background: #fff; border-color: rgba(60, 60, 67, 0.3); }
}
