/* ============================================================
   zwt  —— 暖色温馨 + 高级感
   ============================================================ */

/* MiSans 字体（与主站一致） */
@font-face {
    font-family: 'MiSans';
    src: url('fonts/MiSans-Medium.latin.woff2') format('woff2');
    font-weight: 500;
    unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
    font-family: 'MiSans';
    src: url('fonts/MiSans-Medium.home.woff2') format('woff2');
    font-weight: 500;
    unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;
}
@font-face {
    font-family: 'MiSans';
    src: url('fonts/MiSans-Bold.latin.woff2') format('woff2');
    font-weight: 700;
    unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
    font-family: 'MiSans';
    src: url('fonts/MiSans-Bold.home.woff2') format('woff2');
    font-weight: 700;
    unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;
}

:root {
    --bg-1: #fff7ee;
    --bg-2: #ffe9d8;
    --bg-3: #ffd9c4;
    --bg-4: #ffc9b8;
    --accent: #ee7d56;
    --accent-2: #f5a65b;
    --accent-3: #f28e6c;
    --accent-deep: #e0693f;
    --ink: #4a2f27;
    --ink-soft: #8a6a5c;
    --ink-faint: #b59a8d;
    --card: rgba(255, 255, 255, 0.52);
    --card-border: rgba(255, 255, 255, 0.7);
    --bubble-mine: linear-gradient(135deg, #f89b6a, #ef7d54);
    --bubble-other: rgba(255, 255, 255, 0.72);
    --shadow-sm: 0 6px 18px rgba(180, 110, 70, 0.12);
    --shadow-md: 0 14px 40px rgba(180, 110, 70, 0.18);
    --shadow-lg: 0 24px 60px rgba(160, 90, 60, 0.25);
    --radius: 22px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: 'MiSans', -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3), var(--bg-4));
    background-size: 300% 300%;
    animation: bgShift 18s ease-in-out infinite;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    position: relative;
}

@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 背景画布（漂浮粒子） */
#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* 柔光光斑 */
.glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    z-index: 0;
    pointer-events: none;
    animation: glowFloat 14s ease-in-out infinite;
}
.glow-1 {
    width: 420px; height: 420px;
    top: -120px; left: -120px;
    background: radial-gradient(circle, rgba(255, 214, 165, 0.85), transparent 70%);
}
.glow-2 {
    width: 460px; height: 460px;
    bottom: -160px; right: -140px;
    background: radial-gradient(circle, rgba(255, 170, 140, 0.7), transparent 70%);
    animation-delay: -7s;
}
@keyframes glowFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.1); }
}

/* 通用 */
.hidden { display: none !important; }

.glass {
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    box-shadow: var(--shadow-md);
}

.view {
    position: relative;
    z-index: 2;
    height: 100dvh;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   登录页
   ============================================================ */
#login-view {
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 30px;
    padding: 40px 32px 32px;
    text-align: center;
    animation: cardIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}
.login-card::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 32px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.15), rgba(255,255,255,0.9));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.7;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(26px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand { margin-bottom: 28px; }
.brand-icon {
    font-size: 52px;
    display: inline-block;
    margin-bottom: 10px;
    animation: bounce 3.2s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(200, 120, 80, 0.35));
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.brand h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(120deg, var(--accent-deep), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand .sub {
    margin-top: 8px;
    font-size: 13px;
    color: var(--ink-soft);
    letter-spacing: 1px;
}

.field { display: block; text-align: left; margin-bottom: 18px; }
.field > span {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 7px;
    letter-spacing: 1px;
}
.field input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(238, 125, 86, 0.16);
}
.field input::placeholder { color: rgba(181, 154, 141, 0.45); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.eye {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.eye:hover { opacity: 1; }

.btn-primary {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent), var(--accent-deep));
    background-size: 200% 200%;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(238, 125, 86, 0.4);
    transition: transform 0.2s, box-shadow 0.2s, background-position 0.4s;
    position: relative;
    overflow: hidden;
}
.btn-primary:hover {
    transform: translateY(-2px);
    background-position: 100% 50%;
    box-shadow: 0 14px 32px rgba(238, 125, 86, 0.5);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.45), transparent);
    transform: skewX(-20deg);
    animation: shine 3.5s ease-in-out infinite;
}
@keyframes shine {
    0%, 60% { left: -80%; }
    100% { left: 130%; }
}

.error {
    min-height: 20px;
    margin-top: 12px;
    font-size: 13px;
    color: #d64545;
    letter-spacing: 1px;
}

/* Tips 按钮（登录页底部） */
.tips-btn {
    position: fixed;
    left: 50%;
    bottom: calc(28px + var(--safe-b));
    transform: translateX(-50%);
    border: none;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 3px;
    padding: 10px 26px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, color 0.2s, background 0.2s;
    z-index: 3;
}
.tips-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    color: var(--accent-deep);
    background: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   聊天页
   ============================================================ */
.chat-view { max-width: 760px; margin: 0 auto; width: 100%; }

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 12px 16px 0;
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
}
.header-title { display: flex; align-items: center; gap: 10px; }
.header-icon { font-size: 26px; filter: drop-shadow(0 4px 8px rgba(200,120,80,0.3)); }
.header-text .title-main { font-size: 16px; font-weight: 700; }
.header-text .title-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.logout {
    border: none;
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.logout:hover { background: rgba(238, 125, 86, 0.15); color: var(--accent-deep); }

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(180, 130, 100, 0.3); border-radius: 3px; }

.msg { display: flex; flex-direction: column; animation: msgIn 0.4s ease; }
.msg.mine { align-items: flex-end; }
.msg.other { align-items: flex-start; }
@keyframes msgIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-meta {
    font-size: 11px;
    color: var(--ink-faint);
    margin: 0 6px 5px;
    letter-spacing: 0.5px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.msg-meta .nickname { font-weight: 700; color: var(--ink-soft); }

.bubble {
    max-width: min(78%, 460px);
    padding: 12px 16px;
    border-radius: 20px;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.msg.other .bubble {
    background: var(--bubble-other);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-top-left-radius: 6px;
}
.msg.mine .bubble {
    background: var(--bubble-mine);
    color: #fff;
    border-top-right-radius: 6px;
}
.bubble .text {
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-wrap;
}
.bubble .text:empty { display: none; }

.bubble img.message-image {
    display: block;
    max-width: 260px;
    max-height: 320px;
    border-radius: 14px;
    margin-top: 8px;
    cursor: zoom-in;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.bubble .time {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.7;
    text-align: right;
}
.msg.mine .bubble .time { color: rgba(255, 255, 255, 0.85); }
.msg.other .bubble .time { color: var(--ink-faint); }

.empty-tip {
    text-align: center;
    color: var(--ink-faint);
    font-size: 13px;
    letter-spacing: 1px;
    margin-top: 20vh;
}

/* ============================================================
   输入区
   ============================================================ */
.composer {
    margin: 0 16px calc(14px + var(--safe-b));
    border-radius: 24px;
    padding: 10px 12px 8px;
    box-shadow: var(--shadow-md);
}
.image-preview-wrap {
    position: relative;
    display: inline-block;
    margin: 0 0 8px 4px;
}
.image-preview-wrap img {
    width: 92px;
    height: 92px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}
.remove-image {
    position: absolute;
    top: -8px; right: -8px;
    width: 24px; height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--accent-deep);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}
.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.icon-btn {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.9); transform: translateY(-2px); }

#composer-input {
    flex: 1;
    border: none;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 13px 14px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    resize: none;
    outline: none;
    max-height: 130px;
    transition: background 0.2s, box-shadow 0.2s;
}
#composer-input:focus {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(238, 125, 86, 0.14);
}
#composer-input::placeholder { color: var(--ink-faint); }

.btn-primary.send {
    flex: 0 0 auto;
    width: 72px;
    height: 44px;
    font-size: 14px;
    letter-spacing: 1px;
}
.composer-meta {
    text-align: right;
    padding: 4px 6px 0;
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: 0.5px;
}
.composer-meta .warn { color: #e0693f; font-weight: 700; }

/* ============================================================
   生日惊喜
   ============================================================ */
.surprise {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #fff3e4, #ffdcc8, #ffc3b0, #f8a98f);
    background-size: 250% 250%;
    animation: bgShift 8s ease-in-out infinite;
    cursor: pointer;
    text-align: center;
    padding: 24px;
}
.surprise-inner { position: relative; z-index: 2; animation: surpriseIn 1s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes surpriseIn {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}
.surprise-cake {
    font-size: 90px;
    animation: cake 2.2s ease-in-out infinite;
    filter: drop-shadow(0 12px 24px rgba(200, 100, 70, 0.4));
}
@keyframes cake {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-14px) rotate(4deg); }
}
.surprise-title {
    font-size: clamp(30px, 7vw, 48px);
    font-weight: 700;
    margin-top: 18px;
    letter-spacing: 2px;
    background: linear-gradient(120deg, #e0693f, #f5a65b, #e0693f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: titleGlow 2.4s ease-in-out infinite;
}
@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(245,166,91,0.5)); }
    50% { filter: drop-shadow(0 0 18px rgba(245,166,91,0.9)); }
}
.surprise-sub {
    font-size: clamp(20px, 4.5vw, 30px);
    font-weight: 700;
    color: #fff;
    margin-top: 8px;
    letter-spacing: 6px;
    text-shadow: 0 3px 14px rgba(200, 100, 70, 0.5);
}
.surprise-hint {
    margin-top: 26px;
    font-size: 12px;
    color: rgba(90, 50, 40, 0.6);
    letter-spacing: 2px;
}

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.confetti span {
    position: absolute;
    top: -40px;
    font-size: 20px;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    to { transform: translateY(110vh) rotate(720deg); opacity: 0.3; }
}

/* ============================================================
   Tips 弹窗 / 图片查看器
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(90, 50, 35, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 24px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    width: 100%;
    max-width: 360px;
    border-radius: 26px;
    padding: 32px 26px 26px;
    text-align: center;
    animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-icon { font-size: 40px; margin-bottom: 12px; }
.modal-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--ink);
    letter-spacing: 1px;
    margin-bottom: 22px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 22, 16, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: zoom-out;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 560px) {
    .login-card { padding: 32px 22px 26px; border-radius: 26px; }
    .chat-header { margin: 10px 10px 0; padding: 10px 12px; }
    .messages { padding: 16px 10px; gap: 14px; }
    .composer { margin: 0 10px calc(10px + var(--safe-b)); }
    .bubble { max-width: 84%; }
    .bubble img.message-image { max-width: 200px; max-height: 260px; }
    .brand-icon { font-size: 44px; }
    .brand h1 { font-size: 23px; }
    #composer-input { font-size: 16px; } /* 避免 iOS 聚焦自动缩放 */
}
