/* ═══════════════════════════════════════════════════════
   七日回响 · 7-Day Echo — 样式表
   ═══════════════════════════════════════════════════════ */


/* ── CSS 变量 ──────────────────────────────────────── */
:root {
    --primary: #FF6B6B;
    --primary-dark: #EE5A24;
    --primary-light: #FFE0E0;
    --bg: #FFF5F5;
    --surface: #FFFFFF;
    --text: #2D3436;
    --text-secondary: #636E72;
    --border: #F0E0E0;
    --border-light: #F8F0F0;
    --shadow: 0 2px 16px rgba(255, 107, 107, 0.12);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --radius: 14px;
    --radius-sm: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
             "Microsoft YaHei", sans-serif;
}

/* ── 全局重置 ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(255,107,107,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(255,160,122,0.06) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────── */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.25);
}

.header-inner {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.78rem;
    opacity: 0.9;
    flex: 1;
}

.btn-reset {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.btn-reset:hover { background: rgba(255,255,255,0.35); }

/* ── Container ──────────────────────────────────────── */
.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

/* ── Card ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.card-center {
    text-align: center;
    padding: 48px 24px;
}

/* ── Form Sections ──────────────────────────────────── */
.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 18px;
}

.form-section legend {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-dark);
    padding: 0 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 420px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}

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 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23636E72'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

textarea { resize: vertical; min-height: 72px; }

/* ── Radio ─────────────────────────────────────────── */
.radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.2s;
    user-select: none;
}
.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}
.radio-label input { display: none; }

/* ── Hobby Tags ────────────────────────────────────── */
.hobby-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hobby-tag {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.hobby-tag:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}
.hobby-tag input { display: none; }

/* ── Photo Upload ──────────────────────────────────── */
.photo-upload-area { position: relative; }
.photo-placeholder {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.photo-placeholder:hover {
    border-color: var(--primary);
    background: rgba(255,107,107,0.03);
}
.photo-icon { display: block; font-size: 2rem; margin-bottom: 6px; }
.photo-hint { display: block; font-size: 0.78rem; opacity: 0.7; margin-top: 4px; }

.photo-previews {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.photo-preview-item {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border);
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-add-more {
    border: 2px dashed var(--border) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.photo-add-more:hover {
    border-color: var(--primary) !important;
    background: rgba(255,107,107,0.05);
    color: var(--primary);
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255, 107, 107, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    max-width: 200px;
    margin: 20px auto 0;
}
.btn-secondary:hover { background: var(--primary-light); }

.btn-sm {
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
}

/* ── Error ─────────────────────────────────────────── */
.error-msg {
    color: var(--primary);
    font-size: 0.88rem;
    margin-top: 10px;
    min-height: 1.2em;
    text-align: center;
}

/* ── Waiting View ──────────────────────────────────── */
.waiting-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.waiting-desc {
    color: var(--text-secondary);
    margin: 8px 0;
    font-size: 0.95rem;
}
.waiting-hint {
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
}

.waiting-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}
.waiting-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Ended View ────────────────────────────────────── */
.ended-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

/* ── Chat View ─────────────────────────────────────── */
.chat-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 480px;
}

.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(255,107,107,0.08), rgba(238,90,36,0.05));
    border-bottom: 1px solid var(--border-light);
}

.match-banner {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.match-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.match-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    background: var(--surface);
    border: 1px solid var(--border);
}

.match-tag.highlight {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ── Ice Breaker Banner ────────────────────────────── */
.ice-breaker-banner {
    padding: 12px 20px;
    background: #FFF9E6;
    border-bottom: 1px solid #F0E6C0;
    font-size: 0.88rem;
}
.ice-answers {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Chat Messages ─────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #FFFAFA;
}

.chat-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: auto;
}

.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    animation: msgIn 0.3s ease-out;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: 6px;
}

.msg-theirs {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}

.msg-system {
    align-self: center;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    max-width: 90%;
    text-align: center;
}

.msg-sender {
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}
.msg-time {
    font-size: 0.68rem;
    margin-top: 4px;
    opacity: 0.6;
    text-align: right;
}

/* ── Chat Input ────────────────────────────────────── */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--surface);
}

.chat-limit {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.chat-limit.exhausted {
    color: var(--primary);
    font-weight: 600;
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row input {
    flex: 1;
}
.chat-input-row button {
    width: auto;
    padding: 10px 22px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-family: var(--font);
}

/* ── Chat Footer ───────────────────────────────────── */
.chat-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    background: #FFFAFA;
}
.chat-footer strong {
    color: var(--primary-dark);
}

/* ── Footer ────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: rgba(255,245,245,0.9);
    backdrop-filter: blur(8px);
}
.phase-indicator { margin-top: 2px; font-size: 0.72rem; opacity: 0.7; }

/* ── View Visibility ────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Loading Spinner (for form submit) ──────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   开场视频 + 使用守则
   ═══════════════════════════════════════════════════════ */
.intro-overlay {
    position: fixed; inset: 0; z-index: 9999; background: #000;
    transition: opacity .8s ease, visibility .8s ease; cursor: pointer;
}
.intro-overlay.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-video {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    max-width: 90vw; max-height: 80vh; width: auto; height: auto;
    border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.intro-video-fade {
    position: absolute; bottom: 0; left: 0; right: 0; height: 120px;
    background: linear-gradient(transparent, rgba(0,0,0,.6)); pointer-events: none;
}
.intro-skip {
    position: fixed; top: 24px; right: 24px; z-index: 200;
    background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.25);
    color: rgba(255,255,255,.8); padding: 8px 22px; border-radius: 20px;
    font-size: .85rem; cursor: pointer; transition: all .3s; letter-spacing: 1px;
    font-family: var(--font); backdrop-filter: blur(10px);
}
.intro-skip:hover { background: rgba(255,255,255,.15); color: #fff; }

.terms-overlay {
    position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all .5s ease;
    backdrop-filter: blur(10px); overflow: hidden;
}
.terms-overlay.show { opacity: 1; visibility: visible; }
.terms-bg-deco { position: absolute; inset: 0; pointer-events: none; }
.deco { position: absolute; font-size: 1.6rem; animation: decoFloat 4s ease-in-out infinite; }
.deco-1 { top: 10%; left: 8%; animation-delay: 0s; }
.deco-2 { top: 18%; right: 10%; animation-delay: .8s; }
.deco-3 { bottom: 20%; left: 12%; animation-delay: 1.6s; }
.deco-4 { bottom: 14%; right: 8%; animation-delay: 2.4s; }
@keyframes decoFloat {
    0%,100% { transform: translateY(0) rotate(0deg); opacity: .5; }
    50% { transform: translateY(-16px) rotate(10deg); opacity: .9; }
}
.terms-card {
    position: relative; z-index: 2; border-radius: 24px;
    background: linear-gradient(180deg, #fff 0%, #fff8f6 100%);
    max-width: 400px; width: 90%; max-height: 85vh; overflow-y: auto;
    padding: 32px 24px 24px;
    box-shadow: 0 20px 60px rgba(255,107,107,.15), 0 2px 12px rgba(0,0,0,.08);
    animation: cardUp .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cardUp {
    from { transform: translateY(40px) scale(.94); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.terms-header { margin-bottom: 20px; }
.terms-hearts { font-size: 1.3rem; letter-spacing: 8px; margin-bottom: 8px; animation: heartBounce 2s ease-in-out infinite; }
@keyframes heartBounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.terms-header h2 {
    font-size: 1.35rem; font-weight: 800; margin-bottom: 4px;
    background: linear-gradient(135deg, #FF6B6B, #FFA07A);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.terms-subtitle { font-size: .82rem; color: #999; letter-spacing: 1px; }
.terms-rules { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.terms-rule {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
    border-radius: 16px; background: rgba(255,107,107,.03); transition: background .2s;
}
.terms-rule:hover { background: rgba(255,107,107,.08); }
.terms-rule-last {
    background: linear-gradient(135deg, rgba(255,107,107,.08), rgba(255,160,122,.06));
    border: 1.5px dashed rgba(255,107,107,.2);
}
.terms-icon { font-size: 1.4rem; min-width: 32px; text-align: center; padding-top: 2px; }
.terms-text { display: flex; flex-direction: column; gap: 2px; }
.terms-text strong { font-size: .88rem; color: #2D3436; }
.terms-text span { font-size: .78rem; color: #888; line-height: 1.5; }
.terms-footer { text-align: center; }
.terms-float-hearts { font-size: .9rem; letter-spacing: 4px; margin-bottom: 8px; animation: heartBounce 2s ease-in-out infinite; animation-delay: .5s; }
.timer-dot {
    display: inline-block; width: 6px; height: 6px; background: #FF6B6B;
    border-radius: 50%; margin-right: 4px; vertical-align: middle;
    animation: dotPulse 1s ease-in-out infinite;
}
@keyframes dotPulse { 0%,100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.5); opacity: 1; } }
.terms-timer {
    font-size: .78rem; color: #bbb; margin-bottom: 16px; transition: color .3s;
    display: flex; align-items: center; justify-content: center; gap: 2px;
}
.terms-timer.ready { color: #FF6B6B; font-weight: 600; }
.terms-timer.ready .timer-dot { background: #FF6B6B; animation: none; }
.terms-agree-btn {
    display: block; width: 100%; padding: 14px; border: none; border-radius: 30px;
    background: linear-gradient(135deg, #FF6B6B, #FFA07A);
    color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer;
    transition: all .3s; box-shadow: 0 4px 16px rgba(255,107,107,.3);
    position: relative; overflow: hidden; font-family: var(--font);
}
.terms-agree-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(255,107,107,.45); }
.terms-agree-btn:disabled { background: #e0e0e0; color: #aaa; cursor: not-allowed; box-shadow: none; }
.terms-agree-btn:not(:disabled)::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.agree-icon { font-size: 1.1rem; }
.terms-disagree-btn {
    background: none; border: none; color: #ccc; font-size: .8rem;
    cursor: pointer; padding: 10px; margin-top: 6px; transition: color .2s; font-family: var(--font);
}
.terms-disagree-btn:hover { color: #999; }
