@import url('https://fonts.googleapis.com/css2?family=ZCOOL+QingKe+HuangYou&display=swap');

:root {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --card: #222230;
    --primary: #f0c040;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #4caf50;
    --danger: #ff5252;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.brand-font {
    font-family: 'ZCOOL QingKe HuangYou', 'STKaiti', 'KaiTi', serif;
    font-weight: 400;
    letter-spacing: 2px;
}

#app { max-width: 500px; margin: 0 auto; padding-bottom: 40px; }

/* Views */
.view { display: none; padding: 20px; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Header */
.app-header { text-align: center; margin-bottom: 24px; }
.app-header h1 { font-size: 28px; color: var(--primary); margin-bottom: 8px; }
.app-header p { color: var(--text-muted); font-size: 15px; }

/* Scene Grid */
.scene-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 32px; }
.scene-card {
    background: var(--surface);
    border: 1px solid #333;
    border-radius: var(--radius);
    aspect-ratio: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.scene-card:active { transform: scale(0.95); background: var(--card); border-color: var(--primary); }
.scene-card .scene-icon { font-size: 42px; margin-bottom: 8px; }
.scene-card .scene-label { font-size: 14px; font-weight: 600; color: var(--text); }

/* Hot Section */
.hot-section { margin-top: 32px; padding-top: 20px; border-top: 1px solid #2a2a3a; }
.hot-section h3 { font-size: 16px; color: var(--primary); margin-bottom: 12px; }
.hot-grid { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: #444 transparent; }
.hot-grid::-webkit-scrollbar { height: 4px; }
.hot-grid::-webkit-scrollbar-thumb { background: #444; border-radius: 8px; }
.hot-item {
    flex: 0 0 110px;
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.hot-item:active { transform: scale(0.95); background: var(--card); }
.hot-item .hot-icon { font-size: 36px; margin-bottom: 8px; }
.hot-item .hot-name { font-size: 12px; font-weight: 600; color: var(--primary); line-height: 1.3; }
.hot-item .hot-brand { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Chat View */
.chat-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #333; }
.chat-header span { font-weight: 600; color: var(--primary); }
.btn-back { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 8px; }

.chat-messages { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.5; animation: popIn 0.3s ease; }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.msg.coach { background: var(--card); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: #2a4b7c; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* Options */
.chat-options { display: flex; flex-direction: column; gap: 10px; }
.opt-btn {
    background: var(--surface);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 16px;
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.opt-btn:active { background: var(--primary); color: #000; border-color: var(--primary); }

/* Result View */
.wine-card-supply {
    border-color: #2a4a2a !important;
    background: #0f1f0f;
}

.coach-bubble {
    background: var(--card);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}

.result-wines { display: flex; flex-direction: column; gap: 16px; }
.wine-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid #333;
}
.wine-card .wine-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wine-card .wine-name { font-size: 20px; font-weight: 700; color: var(--primary); }
.wine-card .wine-price { font-size: 18px; font-weight: 600; color: var(--accent); }
.wine-card .wine-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.wine-card .wine-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.wine-card .wine-meta span { background: #2a2a3a; padding: 4px 8px; border-radius: 6px; }

.wine-actions { display: flex; gap: 10px; }
.btn-primary { flex: 1; background: var(--primary); color: #000; border: none; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-primary:active { opacity: 0.8; }
.btn-secondary { flex: 1; background: transparent; color: var(--primary); border: 1px solid var(--primary); border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }

/* ===== Result slide-up in chat ===== */
.result-slideup {
    animation: slideUp 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 评语醒目气泡 ===== */
.result-coach-bubble {
    background: #1a2a1a;
    border-left: 3px solid var(--primary);
    align-self: flex-start;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    animation: slideInReply 0.4s ease;
    font-size: 14px;
    line-height: 1.6;
    padding: 14px 16px;
    margin: 12px 0 8px 0;
}
.coach-bubble-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
}
.card-container { text-align: center; }
#share-canvas { max-width: 100%; height: auto; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.card-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* ===== 购买弹窗 ===== */
.order-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.order-modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%; max-width: 400px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.3s ease;
}
.order-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    font-size: 16px; font-weight: 600; color: var(--primary);
}
.order-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.order-body { padding: 20px; }
.order-wine {
    font-size: 18px; font-weight: 600; color: var(--text);
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 1px solid #333;
}
.order-field { margin-bottom: 16px; }
.order-field label {
    display: block; font-size: 13px; color: var(--text-muted);
    margin-bottom: 6px; font-weight: 500;
}
.order-field input, .order-field textarea {
    width: 100%; padding: 10px 12px;
    background: var(--bg); border: 1px solid #444;
    border-radius: 8px; color: var(--text); font-size: 15px;
    outline: none; transition: border-color 0.2s;
}
.order-field input:focus, .order-field textarea:focus {
    border-color: var(--primary);
}
.order-error {
    color: var(--danger); font-size: 13px;
    margin-bottom: 12px; min-height: 20px;
}

/* ===== Quiz option images ===== */
.opt-btn {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
}
.opt-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.opt-img {
    width: 33%;
    max-width: 130px;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: #2a2a3a;
}
.opt-text-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.opt-label {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
}
.opt-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
    line-height: 1.4;
}

/* ===== Coach reply bubble (reaction after user picks) ===== */
.msg.coach-reply {
    background: #1a2a1a;
    border-left: 3px solid var(--primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    animation: slideInReply 0.4s ease;
    font-size: 14px;
    line-height: 1.6;
    padding: 14px 16px;
}
@keyframes slideInReply {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Coach message name ===== */
.msg-name {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}
.msg-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #333;
    font-style: italic;
}
