/* ============================================================
   密传 · 双方文件互传网站 - 全局样式
   设计：午夜蓝底 + 青蓝荧光 + 暖琥珀
   移动优先，桌面端双栏
   ============================================================ */

:root {
    --bg: #0B1437;
    --bg-2: #0E1A45;
    --bg-3: #131E4F;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);

    --text: #E8EDFF;
    --text-dim: #9AA5D1;
    --text-faint: #5E6A99;

    --accent: #22D3EE;
    --accent-2: #06B6D4;
    --accent-glow: rgba(34, 211, 238, 0.35);
    --amber: #F59E0B;
    --amber-glow: rgba(245, 158, 11, 0.3);
    --danger: #F43F5E;
    --success: #34D399;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --font-display: 'Orbitron', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', system-ui, -apple-system, sans-serif;

    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 24px var(--accent-glow);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 背景装饰 */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}
.bg-glow-1 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -120px; left: -120px;
}
.bg-glow-2 {
    width: 420px; height: 420px;
    background: radial-gradient(circle, var(--amber) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    opacity: 0.3;
}

/* ============================================================
   通用组件
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 15px;
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #04122B;
    font-weight: 700;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
    box-shadow: 0 6px 28px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-send {
    padding: 12px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-3);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
    max-width: 90vw;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

/* ============================================================
   首页
   ============================================================ */
.page-home { position: relative; }

.site-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-mark {
    color: var(--accent);
    font-size: 20px;
    text-shadow: var(--shadow-glow);
}
.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 1px;
}
.brand-tag {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-faint);
}

.home-main {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.hero {
    text-align: center;
    padding: 40px 0 32px;
    animation: fadeUp 0.6s ease;
}

.hero-eyebrow {
    display: inline-block;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--accent);
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.25);
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    margin-bottom: 24px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 8vw, 64px);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 20px;
}
.title-line { display: block; }
.title-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--amber) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-dim);
    font-size: 16px;
    max-width: 520px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* 创建结果 / 加入表单 */
.room-result, .join-form {
    max-width: 480px;
    margin: 0 auto 32px;
    animation: fadeUp 0.4s ease;
}

.result-card { padding: 28px; }

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.result-badge {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}
.btn-close {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.btn-close:hover { color: var(--text); }

.result-tip {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.result-field { margin-bottom: 16px; }
.result-field label {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.result-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.result-value {
    flex: 1;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
    word-break: break-all;
}
.result-value.result-key {
    color: var(--amber);
    font-size: 16px;
    letter-spacing: 1px;
}
.btn-copy {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); }
.btn-copy.copied { color: var(--success); border-color: var(--success); }

.result-warn {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    color: var(--amber);
    margin-bottom: 20px;
}
.result-warn svg { flex-shrink: 0; margin-top: 2px; }

/* 表单 */
.form-field { margin-bottom: 16px; }
.form-field label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.form-field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}
.form-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
}

/* 特性卡片 */
.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 40px;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
}
.feature-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.feature-icon-cyan {
    background: rgba(34, 211, 238, 0.12);
    color: var(--accent);
}
.feature-icon-amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
}
.feature-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}
.feature-card p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.site-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 24px;
    color: var(--text-faint);
    font-size: 12px;
}

/* ============================================================
   工作台
   ============================================================ */
.page-room { position: relative; }

.room-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(11, 20, 55, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.room-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.back-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.back-link:hover { color: var(--accent); }
.room-id-block { min-width: 0; }
.room-id-label {
    display: block;
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 1px;
}
.room-id-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    letter-spacing: 2px;
}
.room-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.role-badge {
    font-size: 12px;
    color: var(--amber);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.room-main {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-files { min-height: 360px; }
.panel-chat {
    min-height: 420px;
    max-height: 70vh;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}
.panel-title svg { color: var(--accent); }
.panel-count {
    font-size: 12px;
    color: var(--text-faint);
}

/* 上传区 */
.upload-zone {
    margin: 16px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.05);
}
.upload-inner { color: var(--text-dim); }
.upload-inner svg { color: var(--accent); margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text-faint); }

/* 上传进度 */
.upload-progress-list { padding: 0 16px; }
.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
}
.upload-progress-item .name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-progress-bar {
    width: 80px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    width: 0%;
    transition: width 0.2s;
}
.upload-progress-item.done .upload-progress-fill { width: 100%; background: var(--success); }

/* 文件列表 */
.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    max-height: 50vh;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all 0.2s;
    animation: fadeUp 0.3s ease;
}
.file-item:hover { border-color: var(--border-strong); }
.file-item.new { border-color: var(--accent); box-shadow: 0 0 12px rgba(34, 211, 238, 0.15); }

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}
.file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-faint);
    flex-wrap: wrap;
}
.file-sender {
    color: var(--amber);
    font-weight: 500;
}
.file-sender.me { color: var(--accent); }
.file-date { color: var(--text-dim); }
.file-size { color: var(--text-faint); }
.file-download {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}
.file-download:hover {
    background: var(--accent);
    color: #04122B;
    border-color: var(--accent);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-faint);
}
.empty-state svg { color: var(--text-faint); margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* 聊天 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    word-break: break-word;
    animation: fadeUp 0.25s ease;
}
.chat-bubble.me {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #04122B;
    border-bottom-right-radius: 4px;
}
.chat-bubble.other {
    align-self: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-meta {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 4px;
    display: flex;
    gap: 6px;
}
.chat-bubble.me .chat-meta { color: rgba(4, 18, 43, 0.6); }

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.chat-input-bar input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    padding: 12px 18px;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font-body);
}
.chat-input-bar input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ============================================================
   动画
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   响应式 - 桌面端
   ============================================================ */
@media (min-width: 768px) {
    .hero-actions {
        flex-direction: row;
        justify-content: center;
    }
    .features {
        grid-template-columns: repeat(4, 1fr);
    }
    .home-main { padding: 20px 24px 80px; }

    .room-main {
        flex-direction: row;
        padding: 24px;
    }
    .panel-files { flex: 1; }
    .panel-chat {
        flex: 1;
        max-height: calc(100vh - 140px);
    }
    .file-list { max-height: none; }
}

@media (min-width: 1024px) {
    .hero { padding: 60px 0 40px; }
    .hero-desc { font-size: 18px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
