/* ==========================================================
   Talkie · Design System（Lovable 风格）
   ----------------------------------------------------------
   只做视觉层：配色 / 圆角 / 阴影 / 排版 / 移动端适配。
   ⚠️ 约定：不改名、不删除任何 JS 依赖的 id 与 class
      （option / wrong-item / bubble / score-item / report-item /
        speak-btn / review-btn / word-line / meanings-line …）
      JS 会通过 style.display 直接切换以下容器，因此这些容器
      本身不能依赖 flex/grid 布局，弹性布局一律放在子元素上：
      quiz-area / recall-area / detail-area / sentence-area /
      done-actions / recall-buttons / recall-hint / wrong-list-area /
      review-area / modal / call-area / report-area / text-input-area /
      sentence-area / dub-area / score-area / media-tip
   ========================================================== */

:root {
    /* 表面与描边（薄荷软糖） */
    --bg: #F3FAF5;
    --bg-2: #EAF6EF;
    --surface: #ffffff;
    --surface-2: #F2F9F4;
    --surface-3: #E7F1EA;
    --border: #DFEDE3;
    --border-strong: #CFE3D6;

    /* 首页浅绿主题（2026-11-28 用户定稿：可爱圆润风格） */
    --bg-mint-1: #e7f8ec;
    --bg-mint-2: #d9f2e2;
    --bg-app-green: linear-gradient(180deg, #AEE4C4 0%, #8FD6A9 100%);   /* App 内容卡片层：薄荷渐变（设计稿 v1.1） */
    --green-mid: #96D9AD;
    --green-tint: #E7F6EC;
    --sun: #FFC94D;            /* 软糖黄 · 唯一强调色 */
    --sun-deep: #C98A00;
    --sun-bar: #FFD97A;
    --sun-tint: #FFF3D6;
    --sun-ink: #7A4E00;
    --ink-navy: #0F241A;       /* 深色导航 / 登录胶囊 */
    --r-card: 24px;
    --sh-card: 0 6px 0 rgba(47, 158, 99, .16), 0 10px 24px rgba(30, 58, 42, .10);
    --sh-pop: 0 10px 0 rgba(47, 158, 99, .18), 0 18px 40px rgba(30, 58, 42, .16);
    --font-round: "Yuanti SC", "YouYuan", "Varela Round", "PingFang SC",
                  "Microsoft YaHei", sans-serif;

    /* 文字（墨绿替代纯黑，设计稿定稿） */
    --text: #1E3A2A;
    --text-2: #5B7A68;
    --text-3: #7F9A8B;

    /* 主色：薄荷软糖 · 深绿行动色 */
    --brand: #2F9E63;
    --brand-2: #4CBF7E;
    --brand-soft: #E7F6EC;
    --brand-soft-2: #F0FAF3;
    --grad: linear-gradient(135deg, #4CBF7E 0%, #2F9E63 100%);
    --grad-soft: linear-gradient(135deg, #E7F6EC 0%, #F0FAF3 100%);

    /* 语义色 */
    --success: #10b981;
    --success-soft: #e7f8f1;
    --success-text: #0a7f5d;
    --success-strong: #0ea472;
    --danger: #ef4444;
    --danger-soft: #feecec;
    --danger-text: #b91c1c;
    --danger-text-2: #b42318;
    --danger-strong: #dc2626;
    --danger-border: #f6c9c9;
    --danger-border-2: #f6d5d5;
    --danger-bg-soft: #fffafa;
    --warn: #f59e0b;
    --warn-soft: #fef4e4;
    --warn-border: #f7e2bd;
    --warn-text: #92590b;

    /* 主色衍生的描边 / 悬浮底色 */
    --brand-border: #C4E8D2;
    --brand-border-strong: #A9DCBD;
    --brand-border-soft: #D6EDDF;
    --brand-chip-border: #C9E6D6;
    --brand-hover: #DCF2E5;

    /* 热力图 5 档色阶（P0-b）：由浅到深，0 档 = 无记录（薄荷绿阶） */
    --hm-0: #E7F1EA;
    --hm-1: #C9E9D6;
    --hm-2: #96D9AD;
    --hm-3: #4CBF7E;
    --hm-4: #2F9E63;

    /* 中性深色（播放器 / 渐变文字） */
    --ink-900: #1E3A2A;
    --ink-950: #0F241A;
    --player-top: #14301F;
    --player-bottom: #0F241A;

    /* 圆角 */
    --r-xl: 28px;
    --r-lg: 20px;
    --r: 16px;
    --r-sm: 12px;
    --r-pill: 999px;

    /* 阴影 */
    --sh-sm: 0 1px 2px rgba(20, 20, 43, .05), 0 1px 3px rgba(20, 20, 43, .04);
    --sh-md: 0 2px 4px rgba(20, 20, 43, .04), 0 12px 28px -12px rgba(20, 20, 43, .18);
    --sh-lg: 0 4px 8px rgba(20, 20, 43, .04), 0 28px 56px -24px rgba(20, 20, 43, .3);
    --sh-brand: 0 10px 22px -12px rgba(47, 158, 99, .65);

    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body { height: auto; }

body {
    margin: 0;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
    /* margin:auto 居中：空间不足时不会把顶部裁掉（justify-content:center 会） */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 12% -8%, #DCF2E5 0%, rgba(220, 242, 229, 0) 62%),
        radial-gradient(900px 560px at 100% 0%, rgba(255, 201, 77, .10) 0%, rgba(255, 201, 77, 0) 58%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- 应用外壳 ---------- */
.container {
    width: 100%;
    max-width: 560px;
    margin: auto;               /* 垂直居中且溢出不裁切 */
    padding: 22px 20px 26px;
    background: var(--bg-app-green);   /* App 内容卡片层：明显绿（用户定稿） */
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    text-align: center;
    animation: talkie-rise .45s var(--ease) both;
}

@keyframes talkie-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 页头 ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--grad);
    box-shadow: 0 0 0 4px rgba(47, 158, 99, .16);
}

.top-bar { margin-bottom: 0; }

/* 设置入口：圆形图标按钮 */
.top-link,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 15px;
    text-decoration: none;
    transition: all .2s var(--ease);
}

.top-link:hover,
.icon-btn:hover {
    background: var(--brand-soft);
    border-color: var(--brand-border-strong);
    color: var(--brand);
    transform: translateY(-1px);
}

/* ---------- 标题 ---------- */
h1 {
    margin: 0 0 18px;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}

h2 {
    margin: 0 0 14px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

/* ---------- 卡片 ---------- */
.card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    text-align: center;
}

.card + .card { margin-top: 14px; }

.stack { display: block; }

/* ---------- 按钮 ---------- */
button {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    min-height: 44px;                 /* 触控友好 */
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: var(--grad);
    color: #fff;
    cursor: pointer;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease),
                background-color .18s var(--ease), border-color .18s var(--ease), opacity .18s var(--ease);
    box-shadow: var(--sh-brand);
}

button:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(47, 158, 99, .7); }
button:active { transform: translateY(0) scale(.98); box-shadow: var(--sh-sm); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 次级 / 幽灵按钮 */
button.ghost,
button.secondary {
    background: var(--surface-2);
    color: var(--text-2);
    border-color: var(--border);
    box-shadow: none;
}

button.ghost:hover,
button.secondary:hover {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: none;
}

/* 危险按钮 */
button.danger,
button.danger-btn,
.danger-btn {
    background: var(--surface);
    color: var(--danger);
    border-color: #f6c9c9;
    box-shadow: none;
}

button.danger:hover,
button.danger-btn:hover,
.danger-btn:hover { background: var(--danger-soft); box-shadow: none; }

/* 成功按钮 */
button.success { background: var(--success); box-shadow: 0 10px 22px -12px rgba(16, 185, 129, .6); }
button.success:hover { background: #0ea472; }

/* ---------- 表单控件 ---------- */
select,
input[type="text"],
input[type="number"],
textarea {
    font-family: inherit;
    font-size: 16px;                  /* iOS 聚焦时不缩放 */
    color: var(--text);
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    background: var(--surface);
    transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

select {
    width: 100%;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c78' stroke-width='2.5' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(47, 158, 99, .14);
}

/* 开关（发音设置） */
input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--brand);
    cursor: pointer;
}

/* ---------- 进度条（首页 / 学习页共用） ---------- */
.progress-bar {
    position: relative;
    height: 10px;
    margin-top: 14px;
    background: var(--surface-3);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--grad);
    border-radius: var(--r-pill);
    transition: width .45s var(--ease);
}

.progress-text {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
}

/* ---------- 底部返回入口 ---------- */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s var(--ease);
}

.back-link:hover {
    background: var(--brand-soft);
    border-color: var(--brand-border-strong);
    color: var(--brand);
    transform: translateY(-1px);
}

/* ---------- 提示条 ---------- */
.toast {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    border: 1px solid #f6c9c9;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.5;
}

.hint {
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.5;
}

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
    body { padding: 14px 12px calc(18px + env(safe-area-inset-bottom)); }

    .container {
        padding: 18px 16px 22px;
        border-radius: 22px;
        background: var(--bg-app-green);   /* App 内容卡片层：明显绿 */
    }

    h1 { font-size: 23px; margin-bottom: 14px; }
    h2 { font-size: 17px; }

    button { padding: 12px 16px; }

    .footer-links { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
