/* ============================================================
 * 无聊推荐 bored · Bored API
 * 完整黑夜模式 · 类型彩色 badge
 * ============================================================ */

/* ---------------- 舞台 ---------------- */
.br-stage {
    --br-main: #8b5cf6;
    --br-main2: #ec4899;
    position: relative;
    border-radius: 24px;
    padding: 30px 30px 26px;
    background:
        radial-gradient(640px 300px at 10% -8%, rgba(139, 92, 246, 0.17) 0%, transparent 55%),
        radial-gradient(560px 280px at 96% 108%, rgba(236, 72, 153, 0.13) 0%, transparent 55%),
        linear-gradient(135deg, #f5f3ff 0%, #fdf2f8 45%, #fef3c7 100%);
    border: 1px solid rgba(139, 92, 246, 0.22);
    box-shadow: 0 18px 44px rgba(139, 92, 246, 0.12);
}
:root[data-theme="dark"] .br-stage {
    background:
        radial-gradient(640px 300px at 10% -8%, rgba(139, 92, 246, 0.22) 0%, transparent 55%),
        radial-gradient(560px 280px at 96% 108%, rgba(236, 72, 153, 0.18) 0%, transparent 55%),
        linear-gradient(135deg, #1a1625 0%, #221825 45%, #2a1f1a 100%);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.br-head {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.br-head-icon {
    font-size: 42px;
    line-height: 1;
    filter: drop-shadow(0 6px 16px rgba(139, 92, 246, 0.4));
}
.br-head h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #1f2937;
}
:root[data-theme="dark"] .br-head h1 { color: #e9d5ff; }
.br-sub {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(31, 41, 55, 0.62);
}
:root[data-theme="dark"] .br-sub { color: rgba(233, 213, 255, 0.65); }
.br-counter {
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(139, 92, 246, 0.28);
    color: rgba(31, 41, 55, 0.75);
}
:root[data-theme="dark"] .br-counter {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.32);
    color: rgba(233, 213, 255, 0.85);
}
.br-counter b { color: var(--br-main); font-size: 15px; }

/* ---------------- 筛选 ---------------- */
.br-filters {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.br-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.br-filter-label {
    font-size: 13px;
    font-weight: 700;
    color: rgba(31, 41, 55, 0.75);
    min-width: 40px;
}
:root[data-theme="dark"] .br-filter-label { color: rgba(233, 213, 255, 0.82); }

.br-select {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 600;
    color: rgba(31, 41, 55, 0.88);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
    outline: none;
}
.br-select:hover { border-color: var(--br-main); color: var(--br-main); }
.br-select:focus { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
:root[data-theme="dark"] .br-select {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.35);
    color: rgba(233, 213, 255, 0.9);
}

.br-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}
.br-seg-btn {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(255, 255, 255, 0.6);
    color: rgba(31, 41, 55, 0.75);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
}
.br-seg-btn:hover { transform: translateY(-2px); border-color: var(--br-main); color: var(--br-main); }
.br-seg-btn.active {
    background: linear-gradient(135deg, var(--br-main), var(--br-main2));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}
:root[data-theme="dark"] .br-seg-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.35);
    color: rgba(233, 213, 255, 0.82);
}

/* ---------------- 结果卡 ---------------- */
.br-card {
    position: relative;
    margin-top: 22px;
    padding: 30px 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.24);
    box-shadow: 0 16px 38px rgba(139, 92, 246, 0.13);
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
:root[data-theme="dark"] .br-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.22);
}

/* loading */
.br-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: rgba(31, 41, 55, 0.65);
}
:root[data-theme="dark"] .br-loading { color: rgba(233, 213, 255, 0.65); }
.br-loading-text { font-weight: 600; }
.br-spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--br-main);
    animation: brSpin 0.8s linear infinite;
}
@keyframes brSpin { to { transform: rotate(360deg); } }

/* empty */
.br-empty { color: rgba(31, 41, 55, 0.55); }
:root[data-theme="dark"] .br-empty { color: rgba(233, 213, 255, 0.5); }
.br-empty-icon { font-size: 48px; margin-bottom: 10px; }
.br-empty-title { font-size: 16px; font-weight: 700; color: rgba(31, 41, 55, 0.75); }
:root[data-theme="dark"] .br-empty-title { color: rgba(233, 213, 255, 0.8); }
.br-empty-sub { font-size: 13px; margin-top: 4px; }

/* result */
.br-result { width: 100%; text-align: center; }
.br-activity {
    font-size: 24px;
    line-height: 1.5;
    font-weight: 800;
    color: #1f2937;
    word-break: break-word;
    overflow-wrap: anywhere;
}
:root[data-theme="dark"] .br-activity { color: #f5f3ff; }

.br-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* 类型彩色 badge */
.br-type-badge {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.br-type-badge[data-type="education"]    { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.br-type-badge[data-type="recreational"] { background: linear-gradient(135deg, #f97316, #ef4444); }
.br-type-badge[data-type="social"]       { background: linear-gradient(135deg, #10b981, #22c55e); }
.br-type-badge[data-type="diy"]          { background: linear-gradient(135deg, #a855f7, #ec4899); }
.br-type-badge[data-type="charity"]      { background: linear-gradient(135deg, #ef4444, #f97316); }
.br-type-badge[data-type="cooking"]      { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.br-type-badge[data-type="relaxation"]   { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.br-type-badge[data-type="music"]        { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.br-type-badge[data-type="busywork"]     { background: linear-gradient(135deg, #64748b, #334155); }

.br-meta {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(31, 41, 55, 0.75);
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.22);
}
:root[data-theme="dark"] .br-meta {
    color: rgba(233, 213, 255, 0.85);
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(139, 92, 246, 0.3);
}
.br-meta b { font-weight: 800; }

/* accessibility bar */
.br-acc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    font-size: 12px;
    color: rgba(31, 41, 55, 0.6);
}
:root[data-theme="dark"] .br-acc-row { color: rgba(233, 213, 255, 0.6); }
.br-acc-label { flex-shrink: 0; font-weight: 600; }
.br-acc-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.08);
    overflow: hidden;
    max-width: 260px;
}
:root[data-theme="dark"] .br-acc-bar { background: rgba(255, 255, 255, 0.1); }
.br-acc-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    width: 0%;
    transition: width 0.5s ease;
}
.br-acc-val { flex-shrink: 0; font-weight: 700; min-width: 56px; text-align: right; }

.br-link {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--br-main), var(--br-main2));
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.br-link:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(139, 92, 246, 0.4); }

/* error */
.br-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(31, 41, 55, 0.7);
}
:root[data-theme="dark"] .br-error { color: rgba(233, 213, 255, 0.7); }
.br-error-icon { font-size: 42px; }
.br-error-text { font-size: 14px; }

/* ===== 兜底：br-card 里只允许一个子面板可见 ===== */
.br-card > *[hidden] { display: none !important; }
.br-card > *:not([hidden]) { display: flex !important; }
.br-card > .br-result:not([hidden]) { display: block !important; }

/* result 入场动画 */
.br-card.has-result { animation: brPop 0.45s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes brPop {
    0% { transform: scale(0.96); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------------- 大按钮 ---------------- */
.br-action-wrap {
    margin-top: 24px;
    text-align: center;
}
.br-big-btn {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 18px 48px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--br-main), var(--br-main2));
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    font-family: inherit;
    cursor: pointer;
    box-shadow:
        0 10px 30px rgba(139, 92, 246, 0.4),
        0 4px 12px rgba(236, 72, 153, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.br-big-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 16px 40px rgba(139, 92, 246, 0.5),
        0 6px 16px rgba(236, 72, 153, 0.3);
}
.br-big-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.br-big-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.br-big-btn-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
    animation: brBob 2s ease-in-out infinite;
}
@keyframes brBob {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-12deg) scale(1.1); }
}

.br-big-btn--sm {
    padding: 10px 26px;
    font-size: 16px;
    font-weight: 700;
    gap: 8px;
}
.br-big-btn--sm .br-big-btn-icon { font-size: 18px; }

/* ---------------- 历史 ---------------- */
.br-history {
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px dashed rgba(139, 92, 246, 0.35);
}
:root[data-theme="dark"] .br-history {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.35);
}
.br-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: rgba(31, 41, 55, 0.75);
    margin-bottom: 10px;
}
:root[data-theme="dark"] .br-history-head { color: rgba(233, 213, 255, 0.8); }
.br-clear {
    border: none;
    background: none;
    font-size: 12px;
    color: #7c3aed;
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
}
:root[data-theme="dark"] .br-clear { color: #c4b5fd; }

.br-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.br-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.18);
    font-size: 13px;
    color: rgba(31, 41, 55, 0.8);
    transition: transform 0.12s ease;
}
.br-history-item:hover { transform: translateX(2px); }
:root[data-theme="dark"] .br-history-item {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.22);
    color: rgba(245, 243, 255, 0.85);
}
.br-history-item .i-title { flex: 1; font-weight: 600; }
.br-history-item .i-type {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    flex-shrink: 0;
}
.br-history-item .i-time {
    font-size: 11px;
    color: rgba(31, 41, 55, 0.4);
    flex-shrink: 0;
}
:root[data-theme="dark"] .br-history-item .i-time { color: rgba(233, 213, 255, 0.45); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 620px) {
    .br-stage { padding: 22px 16px 20px; border-radius: 18px; }
    .br-head h1 { font-size: 21px; }
    .br-counter { margin-left: 0; }
    .br-big-btn { padding: 14px 32px; font-size: 18px; gap: 10px; }
    .br-big-btn-icon { font-size: 22px; }
    .br-activity { font-size: 20px; }
    .br-filter-row { align-items: flex-start; }
    .br-action-wrap .br-big-btn { width: 100%; }
}
