/* ==========================================================
   📖 主题三：暖心故事 (Story / Storybook)
   ----------------------------------------------------------
   参考「要跟孩子反复聊钱」儿童卡通版：
   暖色光斑背景 · 漂浮装饰emoji · 描边立体大标题
   主题色边框卡片 · 圆形数字badge · 彩色软阴影 · 弹入动画
   作用域：html[data-theme="story"]
   ========================================================== */

html[data-theme="story"] {
    --primary: #ff9f43;
    --primary-dark: #e8892f;
    --success: #4caf50;
    --success-dark: #3d9140;
    --warning: #ff9f43;
    --danger: #ff6b6b;
    --info: #26c6da;
    --text: #33304a;
    --text-muted: #6a6685;
    --ink: #33304a;
    --theme: #ff6b6b;
    --soft: #fff0ee;
}

/* ========== 全局：暖色光斑背景 ========== */
html[data-theme="story"] body {
    font-family: "PingFang SC", "Microsoft YaHei", "Comic Sans MS", sans-serif;
    color: var(--ink);
    background-color: #fffaf0;
    background-image:
        radial-gradient(circle at 12% 8%, #fff7c2 0 9%, transparent 9.5%),
        radial-gradient(circle at 88% 18%, #ffe0f0 0 8%, transparent 8.5%),
        radial-gradient(circle at 78% 82%, #dff6e6 0 10%, transparent 10.5%),
        radial-gradient(circle at 20% 92%, #e2ecff 0 9%, transparent 9.5%),
        linear-gradient(180deg, #fffaf0 0%, #fff1dc 45%, #ffe9d6 100%);
    background-attachment: fixed;
}

/* 漂浮装饰由 index.php 的 .story-decor 提供 */
html[data-theme="story"] .story-decor { display: block; }
html[data-theme="story"] .story-decor span { animation: storyFloat 6s ease-in-out infinite; }
html[data-theme="story"] .story-decor span:nth-child(2) { animation-delay: 1.2s; font-size: 44px; }
html[data-theme="story"] .story-decor span:nth-child(3) { animation-delay: .6s; font-size: 26px; }
html[data-theme="story"] .story-decor span:nth-child(4) { animation-delay: 1.8s; font-size: 40px; }
html[data-theme="story"] .story-decor span:nth-child(5) { animation-delay: .3s; font-size: 30px; }

/* ========== 顶部导航：暖白 + 橙描边 ========== */
html[data-theme="story"] .app-header {
    height: 64px;
    background: #FFFCF6;
    border: none;
    border-bottom: 4px solid #FF9F43;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 6px 18px rgba(255,159,67,.18);
}
html[data-theme="story"] .menu-toggle { background: #FFF0DC; border: 2px solid #FFDDB0; }
html[data-theme="story"] .menu-bar { background: #FF9F43; }

html[data-theme="story"] .header-stat-item {
    background: #FFF0DC;
    border: 2px solid #FFDDB0;
    box-shadow: 0 3px 0 #F0D3A8;
}
html[data-theme="story"] .header-stat-value { color: #E8892F; }
html[data-theme="story"] .header-stat-label { color: #A9712E; }

html[data-theme="story"] .points-badge,
html[data-theme="story"] .today-badge,
html[data-theme="story"] .network-status {
    background: #FFF0DC;
    color: #E8892F;
    border: 2px solid #FFDDB0;
    box-shadow: none;
}
html[data-theme="story"] .user-avatar-btn { background: #FFF0DC; border: 3px solid #FF9F43; box-shadow: 0 3px 0 #F0D3A8; }
html[data-theme="story"] .user-dropdown { border: 3px solid #FFDDB0; border-radius: 18px; }
html[data-theme="story"] .dropdown-item:hover { background: #FFF0DC; }

/* ========== 侧边栏：暖白 + 彩色胶囊 ========== */
html[data-theme="story"] .sidebar {
    background: rgba(255,252,246,0.92);
    border-right: 3px solid #FFE4C4;
    box-shadow: none;
}
html[data-theme="story"] .nav-item {
    margin: 5px 12px;
    padding: 11px 16px;
    border: none;
    border-left: none;
    border-radius: 14px;
    color: #6a6685;
    font-weight: 700;
}
html[data-theme="story"] .nav-item:hover { background: #FFF0DC; color: #33304a; transform: translateX(3px); }
html[data-theme="story"] .nav-item.active {
    background: linear-gradient(135deg, #ff9f43, #ff7b54);
    color: #fff;
    border: none;
    box-shadow: 0 4px 0 #e8892f;
}
html[data-theme="story"] .nav-icon { font-size: 1.3rem; }

html[data-theme="story"] .main-content { padding: 20px 24px; }

/* ========== 描边立体大标题 ========== */
html[data-theme="story"] .page-header h2 {
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    -webkit-text-stroke: 1.5px #ff8c42;
    paint-order: stroke fill;
    text-shadow: 0 4px 0 #ffb26b, 0 8px 14px rgba(255,140,66,.35);
    letter-spacing: 1px;
}

/* ========== 卡片：主题色边框 + 圆形badge头 + 彩色软阴影 ========== */
html[data-theme="story"] .panel,
html[data-theme="story"] .status-card,
html[data-theme="story"] .task-card,
html[data-theme="story"] .reward-card,
html[data-theme="story"] .claim-card {
    background: #fff;
    border: 3px solid var(--theme);
    border-radius: 26px;
    box-shadow: 0 7px 0 var(--soft), 0 12px 22px rgba(90,70,50,.12);
    transition: transform .18s ease, box-shadow .18s ease;
}
html[data-theme="story"] .panel:hover,
html[data-theme="story"] .task-card:hover,
html[data-theme="story"] .reward-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 0 var(--soft), 0 18px 28px rgba(90,70,50,.16);
}

/* 卡片头：软色圆角条，仿 .card-head */
html[data-theme="story"] .panel h3,
html[data-theme="story"] .task-card-header {
    background: var(--soft);
    border: none;
    border-radius: 18px;
    padding: 10px 16px;
    margin-bottom: 4px;
    color: var(--theme);
    font-size: 1.25rem;
    font-weight: 900;
}
html[data-theme="story"] .panel h3 { border-bottom: none; }

/* 卡片头前面加圆形数字badge */
html[data-theme="story"] .panel h3::before {
    content: "✦";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 12px;
    vertical-align: middle;
    background: var(--theme);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    border-radius: 50%;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}

/* 每张卡片轮换主题色 */
html[data-theme="story"] .status-card:nth-child(1) { --theme:#ff6b6b; --soft:#fff0ee; }
html[data-theme="story"] .status-card:nth-child(2) { --theme:#ff9f43; --soft:#fff2e3; }
html[data-theme="story"] .status-card:nth-child(3) { --theme:#9b6dff; --soft:#f3edff; }

html[data-theme="story"] .task-grid > *:nth-child(4n+1),
html[data-theme="story"] .rewards-grid > *:nth-child(4n+1),
html[data-theme="story"] .panel:nth-child(4n+1) { --theme:#4caf50; --soft:#eaf8e8; }
html[data-theme="story"] .task-grid > *:nth-child(4n+2),
html[data-theme="story"] .rewards-grid > *:nth-child(4n+2),
html[data-theme="story"] .panel:nth-child(4n+2) { --theme:#42a5f5; --soft:#e8f3ff; }
html[data-theme="story"] .task-grid > *:nth-child(4n+3),
html[data-theme="story"] .rewards-grid > *:nth-child(4n+3),
html[data-theme="story"] .panel:nth-child(4n+3) { --theme:#f368a0; --soft:#ffedf5; }
html[data-theme="story"] .task-grid > *:nth-child(4n+4),
html[data-theme="story"] .rewards-grid > *:nth-child(4n+4),
html[data-theme="story"] .panel:nth-child(4n+4) { --theme:#9b6dff; --soft:#f3edff; }

/* 状态卡内容 */
html[data-theme="story"] .card-icon {
    background: var(--soft) !important;
    border: 2px solid var(--theme);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}
html[data-theme="story"] .card-value { color: var(--theme); font-weight: 900; }
html[data-theme="story"] .card-label { color: var(--ink); font-weight: 700; opacity: 1; }
html[data-theme="story"] .card-sub { color: var(--theme); }

/* 任务/奖励卡内容 */
html[data-theme="story"] .task-name,
html[data-theme="story"] .reward-name { color: var(--theme); font-weight: 900; }
html[data-theme="story"] .task-points,
html[data-theme="story"] .cost-value { color: var(--theme); font-weight: 900; }
html[data-theme="story"] .task-badge { border: 2px solid var(--theme); color: var(--theme); background: var(--soft) !important; }
html[data-theme="story"] .task-detail { background: var(--soft); border: 2px solid var(--theme); color: var(--ink); }
html[data-theme="story"] .reward-desc { color: var(--ink); }
html[data-theme="story"] .reward-icon {
    background: var(--soft);
    border: 3px solid var(--theme);
    box-shadow: inset 0 -4px 0 rgba(0,0,0,.08);
    animation: storyFloat 4s ease-in-out infinite;
}

/* 列表条目：软色圆点 + 主题描边 */
html[data-theme="story"] .done-item,
html[data-theme="story"] .pending-item {
    background: #fff;
    border: 2px solid var(--soft);
    border-left: 6px solid var(--theme);
    border-radius: 16px;
    box-shadow: 0 3px 0 var(--soft);
}
html[data-theme="story"] .done-name { color: var(--ink); font-weight: 800; }
html[data-theme="story"] .done-points { color: #4caf50; }
html[data-theme="story"] .pending-points { color: var(--theme); }

/* ========== 按钮：橙红渐变立体 ========== */
html[data-theme="story"] .btn {
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 5px 0 #e8694f;
    font-weight: 900;
}
html[data-theme="story"] .btn-primary,
html[data-theme="story"] .btn-success {
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    color: #fff;
}
html[data-theme="story"] .btn-primary:hover,
html[data-theme="story"] .btn-success:hover { box-shadow: 0 7px 0 #e8694f; }
html[data-theme="story"] .btn:active { box-shadow: 0 1px 0 #e8694f; }
html[data-theme="story"] .btn-warning { background: #ffc542; color: #7a5200; box-shadow: 0 5px 0 #e0a800; }
html[data-theme="story"] .btn-danger { background: #ff6b6b; color: #fff; box-shadow: 0 5px 0 #d94f4f; }
html[data-theme="story"] .btn-sm { box-shadow: 0 3px 0 #e8694f; }
html[data-theme="story"] .claim-reward-btn {
    background: linear-gradient(135deg, #ff9f43, #ff6b6b) !important;
    color: #fff !important;
}
html[data-theme="story"] .btn-outline { background: #fff; color: #ff7b54; border: 3px solid #ffb26b; }

/* ========== 表单 / 表格 ========== */
html[data-theme="story"] .form-input {
    border: 3px solid #FFDDB0;
    border-radius: 14px;
    box-shadow: 0 3px 0 #F0D3A8;
    background: #fff;
    color: var(--ink);
}
html[data-theme="story"] .form-input:focus { border-color: #ff9f43; box-shadow: 0 0 0 4px rgba(255,159,67,.2); }
html[data-theme="story"] .form-group label { color: var(--ink); }
html[data-theme="story"] .settings-tabs { border: 3px solid #FFDDB0; border-radius: 20px; }
html[data-theme="story"] .settings-tab.active { background: linear-gradient(135deg,#ff9f43,#ff7b54); color: #fff; border-color: #fff; box-shadow: 0 3px 0 #e8892f; }

html[data-theme="story"] .data-table th { background: #FFF0DC; color: #E8892F; border-bottom: 3px solid #FFDDB0; }
html[data-theme="story"] .data-table td { border-bottom: 2px solid #FFF4E6; }
html[data-theme="story"] .data-table tr:hover td { background: #FFF8EE; }
html[data-theme="story"] .badge { border: 2px solid #fff; border-radius: 999px; }

/* 进度条 / 图表：橙红暖色 */
html[data-theme="story"] .progress-bar-container { background: #fff; border: 3px solid #FFDDB0; border-radius: 999px; }
html[data-theme="story"] .progress-bar { background: linear-gradient(90deg,#ff9f43,#ff6b6b); border-radius: 999px; }
html[data-theme="story"] .chart-bar-col .chart-bar { background: linear-gradient(180deg,#ffb26b,#ff8c42) !important; border: 2px solid #fff; }
html[data-theme="story"] .chart-bar-col.today .chart-bar { background: linear-gradient(180deg,#ff8fa8,#ff6b6b) !important; }
html[data-theme="story"] .chart-bar-label { color: var(--ink); }
html[data-theme="story"] .chart-bar-value { color: var(--ink); }

/* ========== 提示 / Toast / Modal ========== */
html[data-theme="story"] .toast { border: 3px solid #fff; border-radius: 999px; box-shadow: 0 6px 0 #e8694f; }
html[data-theme="story"] .modal-content { background: #FFFDF8; border: 4px solid #ff9f43; border-radius: 26px; box-shadow: 0 10px 0 #F0D3A8; }
html[data-theme="story"] .modal-content h3 { color: var(--theme); }

html[data-theme="story"] .alert-success { background: #eaf8e8; color: #3d9140; border-color: #4caf50; }
html[data-theme="story"] .alert-error { background: #fff0ee; color: #d94f4f; border-color: #ff6b6b; }

/* 分页 */
html[data-theme="story"] .page-link { border: 2px solid #FFDDB0; border-radius: 12px; box-shadow: 0 3px 0 #F0D3A8; color: #E8892F; }
html[data-theme="story"] .page-link.active { background: linear-gradient(135deg,#ff9f43,#ff7b54); color: #fff; border-color: #fff; }

/* 重点标语条 / 空状态 / 最近兑换 */
html[data-theme="story"] .empty-state { color: var(--text-muted); }
html[data-theme="story"] .redemption-mini-item { background: var(--soft); border: 2px solid var(--theme); }
html[data-theme="story"] .avatar-upload-area { background: #FFF8EE; border: 2px dashed #ffb26b; }

/* 庆祝特效 */
html[data-theme="story"] .celebration-reason { background: linear-gradient(135deg,#ff9f43,#ff6b6b); border-color: #fff; color: #fff; }

/* ========== 登录页：暖心故事风 ========== */
html[data-theme="story"] .login-body { background: inherit; }
html[data-theme="story"] .login-container {
    background: #fff;
    border: 4px solid #ff9f43;
    border-radius: 28px;
    box-shadow: 0 10px 0 #F0D3A8, 0 20px 40px rgba(255,140,66,.2);
}
html[data-theme="story"] .login-container::before {
    content: "💰 星星乐园 💰";
    font-size: 1.5rem;
    color: #fff;
    -webkit-text-stroke: 1.2px #ff8c42;
    paint-order: stroke fill;
    text-shadow: 0 3px 0 #ffb26b;
}
html[data-theme="story"] .login-input-minimal { border: 3px solid #FFDDB0; box-shadow: 0 3px 0 #F0D3A8; border-radius: 14px; }
html[data-theme="story"] .login-btn-minimal {
    background: linear-gradient(135deg,#ff9f43,#ff6b6b);
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 5px 0 #e8694f;
    color: #fff;
}
html[data-theme="story"] .login-btn-minimal:hover { box-shadow: 0 7px 0 #e8694f; }

/* ========== 漂浮动画 ========== */
@keyframes storyFloat {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-16px) rotate(5deg); }
}
