/* =========================================================
   1. 全局变量与基础响应式排版
   ========================================================= */
:root {
    --primary-color: #2c3e50;
    --accent-purple: #6c5ce7;
    --accent-yellow: #fdcb6e;
    
    /* 游戏按键色彩体系（主色 + 底部厚阴影色） */
    --btn-green: #00b894;
    --btn-green-shadow: #008f72;
    
    --btn-purple: #6c5ce7;
    --btn-purple-shadow: #4834d4;
    
    --btn-urgent: #d63031;
    --btn-urgent-shadow: #b71540;

    --btn-gray: #b2bec3;
    --btn-gray-shadow: #636e72;

    --bg-gradient: linear-gradient(to top, #96fbc4 0%, #f9f586 100%);
    --card-bg: rgba(255, 255, 255, 0.94);
}

body {
    margin: 0;
    padding: 20px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #e4efe9;
    background-image: var(--bg-gradient);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

/* 双卡片 Flexbox 容器：手机自适应居中，彻底告别 float 塌陷 */
.card-deck {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 420px;
}

/* =========================================================
   2. 3D 翻转卡片核心（手机端点击翻转 180°）
   ========================================================= */
.flip-container {
    width: 180px;
    height: 250px;
    position: relative;
    perspective: 1000px;
    cursor: pointer;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-container.is-flipped .flip-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backface-visibility: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    padding: 15px;
}

/* 正面 */
.front-bottle { background: linear-gradient(135deg, #74b9ff, #0984e3); color: white; }
.front-misaki { background: linear-gradient(135deg, #a29bfe, #6c5ce7); color: white; }

.card-face h2 { margin: 10px 0 5px 0; font-size: 18px; }
.card-face p { margin: 0; font-size: 12px; opacity: 0.9; }

/* 背面（解密暗号） */
.back-face {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    color: #2d3436;
    transform: rotateY(180deg);
}

.back-face input {
    width: 85%;
    padding: 8px;
    font-size: 12px;
    margin: 10px 0;
    border: 2px solid #ccc;
    border-radius: 12px;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    transition: all 0.3s;
}

.back-face input:focus {
    border-color: #0984e3;
    box-shadow: 0 0 6px rgba(9, 132, 227, 0.4);
}

/* =========================================================
   3. 💡 融入你专属的“3D游戏按键”与“发光拉伸输入框”
   ========================================================= */

/* 通用输入框（吸收你的 .search-box 优雅圆角与发光拉伸） */
input[type="password"], textarea, input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0;
    border: 2px solid #ccc;
    border-radius: 16px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
    font-family: inherit;
}

input:focus, textarea:focus {
    border-color: #0984e3;
    box-shadow: 0 0 8px rgba(9, 132, 227, 0.4);
}

/* 核心：3D游戏立体按压按钮基类（吸收你的 .game-btn） */
.game-btn {
    width: 100%;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.1s; /* 极快过渡，手感清脆 */
    margin-top: 10px;
    box-sizing: border-box;
}

/* 手指按住不放（:active）：阴影缩小，按钮下沉 4px，产生真实按键触感！ */
.game-btn:active {
    transform: translateY(4px);
}

/* 绿色按键（投递回音） */
.btn-green {
    background-color: var(--btn-green);
    color: white;
    box-shadow: 0 5px 0 var(--btn-green-shadow);
}
.btn-green:hover { background-color: #55efc4; color: #2d3436; }
.btn-green:active { box-shadow: 0 1px 0 var(--btn-green-shadow); }

/* 紫色按键（投递照片 / 聊天发送） */
.btn-purple {
    background-color: var(--btn-purple);
    color: white;
    box-shadow: 0 5px 0 var(--btn-purple-shadow);
}
.btn-purple:hover { background-color: #a29bfe; }
.btn-purple:active { box-shadow: 0 1px 0 var(--btn-purple-shadow); }

/* 灰色按键（翻看历史） */
.btn-gray {
    background-color: var(--btn-gray);
    color: white;
    font-size: 13px;
    padding: 10px;
    box-shadow: 0 4px 0 var(--btn-gray-shadow);
}
.btn-gray:hover { background-color: #dfe6e9; color: #2d3436; }
.btn-gray:active { box-shadow: 0 1px 0 var(--btn-gray-shadow); }

/* 红色紧急呼救按键（请求回复喵） */
.btn-urgent {
    background-color: var(--btn-urgent);
    color: white;
    font-size: 14px;
    padding: 12px;
    box-shadow: 0 5px 0 var(--btn-urgent-shadow);
    margin-top: 15px;
}
.btn-urgent:hover { background-color: #ff7675; }
.btn-urgent:active { box-shadow: 0 1px 0 var(--btn-urgent-shadow); }

/* =========================================================
   4. 心情晴雨表（4 状态单选与门禁）
   ========================================================= */
.mood-grid {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 15px 0;
}

.mood-btn {
    flex: 1;
    padding: 8px 4px;
    background: #ffffff;
    border: 2px solid #dcdde1;
    border-radius: 12px;
    font-size: 12px;
    color: #57606f;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.mood-btn.selected {
    background: #6c5ce7;
    color: white;
    border-color: #4834d4;
    font-weight: bold;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

/* 门禁未解锁状态 */
.gated-section {
    opacity: 0.4;
    pointer-events: none;
    transition: all 0.4s ease;
    filter: grayscale(0.7);
}

.gated-section.unlocked {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* =========================================================
   5. 解锁后容器 & 小岬 82vh 竖版大聊天室
   ========================================================= */
.main-card {
    background: var(--card-bg);
    padding: 25px 20px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    max-width: 95%;
    width: 360px;
    box-sizing: border-box;
    text-align: center;
    display: none;
}

.misaki-container {
    width: 360px;
    max-width: 95%;
    height: 82vh; /* 占满手机大部分屏幕 */
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.chat-header {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info { display: flex; align-items: center; gap: 8px; font-weight: bold; font-size: 15px; }
.status-dot { width: 8px; height: 8px; background-color: #2ecc71; border-radius: 50%; box-shadow: 0 0 6px #2ecc71; }

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-all;
}

.bubble-misaki {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #2d3436;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.bubble-user {
    align-self: flex-end;
    background: #6c5ce7;
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-input-bar {
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #f1f2f6;
    display: flex;
    gap: 8px;
    box-sizing: border-box;
}

.chat-input-bar input { margin: 0; padding: 10px 12px; }
.chat-input-bar button { width: 75px; margin: 0; padding: 10px; }

/* 模态框与独立壁纸 */
.photo-uploader-box {
    display: none;
    margin-top: 15px;
    padding: 15px;
    border-radius: 12px;
    border: 1px dashed #fdcb6e;
    background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
    box-sizing: border-box;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 22px;
    border-radius: 16px;
    max-width: 90%;
    width: 340px;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.history-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #2ecc71;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-all;
}
/* 专属小岬动作描写的轻小说排版质感 */
.bubble-misaki small i {
    display: block;
    color: #8395a7; /* 温和的灰蓝色 */
    font-size: 11px;
    font-style: italic;
    margin: 4px 0;
    line-height: 1.4;
    border-left: 2px solid #a29bfe; /* 左侧带一条小岬代表色的淡紫细线 */
    padding-left: 6px;
}