/* WordPet — Mobile First 全局样式 */

:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-progress-track: #cbd5e1;
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-streak: #f97316;

    --header-h: 48px;
    --tabbar-h: 56px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --touch-min: 44px;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    --max-width: 480px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    overflow-x: hidden;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
}

input, select, textarea {
    font-size: 16px; /* 防止 iOS 聚焦放大 */
}

/* ========== App Shell ========== */

.app-body {
    min-height: 100dvh;
}

.app-shell {
    min-height: 100dvh;
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    position: relative;
}

@media (min-width: 768px) {
    .app-shell {
        box-shadow: var(--shadow);
        min-height: calc(100dvh - 32px);
        margin-top: 16px;
        margin-bottom: 16px;
        border-radius: 16px;
        overflow: hidden;
    }
}

/* ========== Header ========== */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding-top: var(--safe-top);
}

.app-header__inner {
    display: flex;
    align-items: center;
    height: var(--header-h);
    padding: 0 12px;
    gap: 8px;
}

.app-header__logo {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.app-header__back {
    flex-shrink: 0;
    font-size: 20px;
    padding: 0 8px;
    color: var(--color-primary);
}

.app-header__title {
    flex: 1;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__actions {
    flex-shrink: 0;
    min-width: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ========== Main ========== */

.app-main {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-body--no-nav .app-main {
    padding-bottom: calc(var(--safe-bottom) + 16px);
}

.app-footer {
    text-align: center;
    padding: 20px 16px 8px;
    font-size: 12px;
    color: var(--color-text-muted);
    opacity: 0.75;
}

.app-footer__feedback {
    display: inline-block;
    margin-bottom: 8px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
}

.app-footer__feedback:active {
    opacity: 0.85;
}

.app-footer__copy {
    margin: 0;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.form-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ========== 个人头像 ========== */

.profile-avatar-form {
    display: inline-block;
}

.profile-avatar {
    position: relative;
    display: inline-block;
    width: 96px;
    height: 96px;
    cursor: pointer;
}

.profile-avatar__img,
.profile-avatar__placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-border);
    font-size: 48px;
    line-height: 1;
}

.profile-avatar__edit {
    position: absolute;
    right: 0;
    bottom: 0;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 2px solid var(--color-surface);
}

.profile-avatar__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.profile-avatar__tip {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ========== Bottom Tab Bar ========== */

.app-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    display: flex;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

.app-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabbar-h);
    color: var(--color-text-muted);
    transition: color 0.15s;
    position: relative;
}

.app-tabbar__badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 22px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.app-tabbar__item.is-active {
    color: var(--color-primary);
}

.app-tabbar__icon {
    font-size: 20px;
    line-height: 1;
}

.app-tabbar__label {
    font-size: 11px;
    font-weight: 500;
}

/* ========== 通用组件 ========== */

.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-min);
    padding: 0 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 16px;
    transition: background 0.15s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.btn--primary:active {
    background: var(--color-primary-dark);
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn--outline {
    background: transparent;
    border: 2px solid var(--color-border);
    color: var(--color-text);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
}

.form-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 16px;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* ========== 宠物展示 ========== */

.pet-display {
    position: relative;
    text-align: center;
    padding: 8px 0 16px;
}

.pet-display__wrap {
    position: relative;
}

.pet-display__rarity-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    min-width: 32px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.pet-display__rarity-badge.pet-rarity--common {
    color: #6b7280;
    background: rgba(243, 244, 246, 0.95);
}

.pet-display__rarity-badge.pet-rarity--rare {
    color: #2563eb;
    background: rgba(219, 234, 254, 0.95);
}

.pet-display__rarity-badge.pet-rarity--epic {
    color: #9333ea;
    background: rgba(243, 232, 255, 0.95);
}

.pet-display__rarity-badge.pet-rarity--legendary {
    color: #ca8a04;
    background: rgba(254, 243, 199, 0.95);
    font-size: 11px;
    padding: 0 6px;
    
}

.pet-display__image {
    width: 100%;
    max-width: none;
    margin: 0;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
}

.pet-display__image-btn {
    display: block;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.pet-display__image-btn:active .pet-display__image {
    transform: scale(0.98);
}

.pet-display__zoom-fab {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pet-display__zoom-fab:active {
    transform: scale(0.94);
}

.stage-gallery__btn {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.stage-gallery__btn:active .stage-gallery__thumb {
    opacity: 0.85;
}

/* ========== 宠物大图预览 ========== */

.pet-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.92);
}

.pet-lightbox[hidden] {
    display: none;
}

.pet-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: 12px;
}

.pet-lightbox__caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    max-width: 90%;
}

.pet-lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.pet-display__placeholder {
    width: 80%;
    max-width: 280px;
    margin: 0 auto 12px;
    aspect-ratio: 1;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}

.pet-display__name {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
}

.pet-display__stage {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 12px;
}

.exp-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    width: 90%;
    margin: auto;
}

.exp-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #818cf8);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.exp-bar__text {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ========== 单词卡片 ========== */

.word-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    text-align: center;
    touch-action: pan-y;
}

.word-card__head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 100%;
}

.word-card__word {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
}

/* ========== 发音按钮 ========== */

.word-speaker {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.word-speaker:active,
.word-speaker.is-playing {
    background: rgba(99, 102, 241, 0.22);
    transform: scale(0.95);
}

.word-speaker__icon {
    font-size: 20px;
    line-height: 1;
}

.word-speaker--sm {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
}

.word-speaker--sm .word-speaker__icon {
    font-size: 18px;
}

.quiz-card__head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}


.word-card__phonetic {
    font-size: 16px;
    color: var(--color-text-muted);
    margin: 8px 0 20px;
}

.word-card__meaning {
    font-size: 18px;
    margin: 0 0 12px;
}

.word-card__example {
    font-size: 14px;
    color: var(--color-text-muted);
    max-width: 90%;
    line-height: 1.6;
}

.word-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.word-actions .btn {
    min-height: 52px;
}

.word-actions--solo {
    grid-template-columns: 1fr;
}

.word-actions__next {
    display: flex;
}

.word-actions__next .btn {
    width: 100%;
}

/* ========== 测验选项 ========== */

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.quiz-option:active {
    background: #f1f5f9;
}

.quiz-option.is-selected {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.06);
}

.quiz-option.is-correct {
    border-color: var(--color-success);
    background: rgba(34, 197, 94, 0.08);
}

.quiz-option.is-wrong {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.08);
}

.quiz-card__status {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
}

.quiz-card__status--ok {
    color: var(--color-success);
}

.quiz-card__status--bad {
    color: var(--color-danger);
}

.quiz-card__hint {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.1);
    font-size: 14px;
    color: var(--color-text-muted);
}

.quiz-card--missing {
    box-shadow: 0 0 0 2px var(--color-danger);
}

.quiz-card--missing .quiz-card__head p::after {
    content: '（未作答）';
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
}

.quiz-option__tag {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
    font-size: 11px;
    font-weight: 600;
}

.quiz-option__tag--wrong {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

.quiz-review-line {
    display: grid;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.quiz-review-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.quiz-review-line__answer {
    color: var(--color-success);
}

.word-progress-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding: 14px 16px;
}

.word-progress-item__main {
    flex: 1;
    min-width: 0;
}

.word-progress-item__head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-progress-item__word {
    font-size: 17px;
}

.word-progress-item__phonetic {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.word-progress-item__meaning {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--color-text-muted);
}

.word-progress-item__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.word-progress-item__count {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.word-progress-item__count--ok {
    color: var(--color-success);
}

.word-progress-item__count--bad {
    color: var(--color-danger);
}

.word-progress-item__tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

.word-progress-item__tag--ok {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-success);
}

.word-progress-item__tag--learning {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.word-progress-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.word-progress-tabs__item {
    flex: 1;
    min-width: 64px;
    text-align: center;
    padding: 10px 8px;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.word-progress-tabs__item.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.word-progress-toolbar {
    margin-bottom: 12px;
    padding: 14px 16px;
}

.word-progress-toolbar__row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.word-progress-toolbar__row + .word-progress-toolbar__row {
    margin-top: 10px;
}

.word-progress-toolbar__row--filters {
    flex-wrap: wrap;
}

.word-progress-toolbar__input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
}

.word-progress-toolbar__field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.word-progress-toolbar__select {
    min-width: 120px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
}

.word-progress-meta {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ========== 宠物库网格（3 列） ========== */

.pet-library__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pet-library__cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pet-library__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px 10px;
    margin: 0;
    min-width: 0;
}

.pet-library__card.is-locked {
    opacity: 0.88;
}

.pet-library__cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 8px;
}

.pet-library__cover {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    background: var(--color-border);
    display: block;
}

.pet-library__placeholder {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pet-library__placeholder-emoji {
    font-size: 36px;
    line-height: 1;
    opacity: 0.85;
}

.pet-library__card.is-locked .pet-library__placeholder {
    opacity: 0.75;
}

.pet-library__card.is-locked .pet-library__cover {
    filter: grayscale(0.2) brightness(0.92);
}

.pet-library__lock {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: var(--shadow);
}

.pet-library__name {
    font-weight: 700;
    font-size: 13px;
    margin: 0 0 6px;
    line-height: 1.3;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pet-library__meta {
    font-size: 11px;
    color: var(--color-text-muted);
    margin: 4px 0 0;
}

.pet-library__badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.4;
}

.pet-library__badge--available {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-success);
}

.pet-library__badge--soon {
    background: rgba(100, 116, 139, 0.12);
    color: var(--color-text-muted);
}

.pet-library__badge--owned {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
}

.pet-library__badge--active {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.pet-library__adopt {
    margin: 0;
}

.pet-library__adopt .btn--sm {
    min-height: 36px;
    font-size: 13px;
    padding: 0 8px;
}

.pet-library__footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.pet-library__footer a {
    color: var(--color-primary);
    font-weight: 600;
}

/* ========== 宠物图鉴 ========== */

.pet-dex-summary {
    margin-bottom: 14px;
    padding: 14px 16px;
}

.pet-dex-summary__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.pet-dex-summary__title {
    margin: 0;
    font-size: 16px;
}

.pet-dex-summary__link {
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
}

.pet-dex-summary__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pet-dex-summary__stat strong {
    display: block;
    font-size: 15px;
    margin: 4px 0 6px;
}

.pet-dex-summary__label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.pet-dex-summary__rarity {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.pet-dex-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin-bottom: 12px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.pet-dex-tabs__item {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    text-decoration: none;
}

.pet-dex-tabs__item.is-active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.pet-dex-card-link {
    text-decoration: none;
    color: inherit;
}

.pet-dex-card.is-silhouette .pet-library__cover,
.pet-dex-card.is-silhouette .pet-library__placeholder {
    filter: grayscale(1);
    opacity: 0.45;
}

.pet-dex-card__progress {
    margin: 0;
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.3;
}

.pet-dex-card__complete {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-success, #22c55e);
    color: #fff;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.pet-dex-detail__hero {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.pet-dex-detail__cover-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.pet-dex-detail__cover-wrap.is-silhouette .pet-dex-detail__cover,
.pet-dex-detail__cover-wrap.is-silhouette .pet-library__placeholder {
    filter: grayscale(1);
    opacity: 0.5;
}

.pet-dex-detail__cover {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: cover;
}

.pet-dex-detail__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.pet-dex-detail__name {
    margin: 0;
    font-size: 18px;
    width: 100%;
}

.pet-dex-detail__desc {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.pet-dex-detail__progress {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.pet-dex-detail__section-title {
    font-size: 15px;
    margin: 20px 0 10px;
}

.stage-gallery__thumb.is-silhouette {
    filter: grayscale(1);
    opacity: 0.4;
}

.task-achievement-group {
    margin-bottom: 16px;
}

.task-achievement-group__title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.btn--sm {
    min-height: 40px;
    font-size: 14px;
    padding: 0 12px;
}


/* ========== 阶段图鉴（横向滚动） ========== */

.stage-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stage-gallery::-webkit-scrollbar {
    display: none;
}

.stage-gallery__item {
    position: relative;
    flex: 0 0 80px;
    scroll-snap-align: start;
    text-align: center;
}

.stage-gallery__thumb {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: contain;
    background: var(--color-border);
    border: 2px solid transparent;
}

.stage-gallery__placeholder {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stage-gallery__placeholder.is-locked {
    filter: grayscale(1);
    opacity: 0.6;
    font-size: 22px;
    color: var(--color-text-muted);
}

.stage-gallery__item.is-current .stage-gallery__thumb {
    border-color: var(--color-primary);
}

.stage-gallery__item.is-locked .stage-gallery__thumb {
    filter: grayscale(1) brightness(0.7);
}

.stage-gallery__video-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    font-size: 12px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
    pointer-events: none;
}

.stage-gallery__label {
    font-size: 11px;
    margin-top: 4px;
    color: var(--color-text-muted);
}

/* ========== 宠物装备叠加 ========== */

.pet-display__scene {
    position: relative;
    width: 80%;
    max-width: 280px;
    margin: 0 auto 12px;
    aspect-ratio: 1;
}

.pet-display__scene .pet-display__image,
.pet-display__scene .pet-display__video,
.pet-display__scene .pet-display__placeholder {
    width: 100%;
    max-width: none;
    margin: 0;
}

.pet-display__video {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
    background: transparent;
}

.pet-equip {
    position: absolute;
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
    z-index: 2;
}

.pet-equip--cape { top: 8%; left: -8%; font-size: 32px; z-index: 0; }
.pet-equip--head { top: -4%; right: 4%; font-size: 26px; }
.pet-equip--weapon { bottom: 8%; right: -6%; font-size: 30px; }

.pet-equip__overlay {
    width: auto;
    height: auto;
    max-width: 45%;
    max-height: 45%;
    object-fit: contain;
    pointer-events: none;
}

/* ========== 物品库 ========== */

.item-library__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 6px;
    min-width: 0;
}

.item-card.is-locked:not(.is-owned) {
    opacity: 0.88;
}

.item-card.is-system-locked {
    opacity: 0.72;
}

.items-locked-banner {
    margin-bottom: 12px;
    text-align: center;
    background: rgba(99, 102, 241, 0.06);
}

.items-locked-banner__title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 15px;
}

.items-locked-banner__text {
    margin: 0 0 4px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.items-locked-banner__hint {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.item-card__icon-wrap {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    position: relative;
    background: #f1f5f9;
}

.item-card__icon-wrap.item-rarity--common,
.item-card__icon-wrap.item-rarity--rare,
.item-card__icon-wrap.item-rarity--epic,
.item-card__icon-wrap.item-rarity--legendary {
    background: #f1f5f9;
}

.item-card__emoji { font-size: 32px; }
.item-card__icon { width: 70%; height: 70%; object-fit: contain; }

.item-card__equipped {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    background: var(--color-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.item-card__name {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 2px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-card__rarity {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.item-card__status {
    font-size: 10px;
    color: var(--color-text-muted);
}

.item-card__status--owned { color: var(--color-success); }

.item-card__actions {
    width: 100%;
    margin-top: 6px;
}

.item-progress { width: 100%; margin-top: 4px; }
.item-progress__bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}
.item-progress__fill {
    height: 100%;
    background: var(--color-primary);
}
.item-progress__text {
    font-size: 9px;
    color: var(--color-text-muted);
    margin: 4px 0 0;
    line-height: 1.3;
}

.equip-slots { padding: 12px 16px; }
.equip-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}
.equip-slot:last-child { border-bottom: none; }
.equip-slot__label { color: var(--color-text-muted); }
.equip-slot__empty { color: var(--color-text-muted); font-size: 13px; }
.equip-slot__item { font-weight: 600; font-size: 13px; }

/* ========== 装备缩略图横滑 ========== */

.equip-gallery-wrap {
    margin: 0 -4px;
}

.equip-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 4px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.equip-gallery::-webkit-scrollbar {
    display: none;
}

.equip-gallery__item {
    flex: 0 0 88px;
    scroll-snap-align: start;
}

.equip-gallery__item.is-equipped .equip-gallery__card {
    box-shadow: 0 0 0 2px var(--color-primary);
}

.equip-gallery__card {
    padding: 8px 6px 10px;
    text-align: center;
    min-height: 100%;
}

.equip-gallery__card--empty {
    opacity: 0.75;
}

.equip-gallery__icon-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 6px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}

.equip-gallery__icon-wrap.item-rarity--common,
.equip-gallery__icon-wrap.item-rarity--rare,
.equip-gallery__icon-wrap.item-rarity--epic,
.equip-gallery__icon-wrap.item-rarity--legendary {
    background: #f1f5f9;
}

.equip-gallery__icon {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.equip-gallery__emoji {
    font-size: 32px;
    line-height: 1;
}

.equip-gallery__badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    background: var(--color-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.equip-gallery__name {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equip-gallery__slot {
    margin: 2px 0 0;
    font-size: 10px;
    color: var(--color-text-muted);
}


.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.stats-row__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.stats-row__label {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ========== 全屏进化视频 ========== */

.evolve-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--safe-top) 16px var(--safe-bottom);
}

.evolve-overlay video {
    width: 100%;
    max-height: 70dvh;
    object-fit: contain;
}

.evolve-overlay__skip {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    min-height: var(--touch-min);
}

/* ========== Streak 徽章 ========== */

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-streak);
}

/* ========== 桌面增强（可选双栏） ========== */

@media (min-width: 1024px) {
    :root {
        --max-width: 960px;
    }

    .app-shell--wide .app-main {
        display: grid;
        grid-template-columns: 320px 1fr;
        gap: 20px;
        align-items: start;
    }

    .app-shell--wide .pet-display {
        position: sticky;
        top: calc(var(--header-h) + var(--safe-top) + 16px);
    }
}

/* ========== 认证页 ========== */

.auth-page {
    max-width: 400px;
    margin: 0 auto;
}

.auth-page__hero {
    text-align: center;
    padding: 32px 0 24px;
}

.auth-page__emoji {
    margin-bottom: 8px;
}

.auth-page__emoji img {
    display: block;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.auth-page__title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
}

.auth-page__subtitle {
    margin: 8px 0 0;
    color: var(--color-text-muted);
}

.auth-page__heading {
    margin: 24px 0 16px;
    font-size: 22px;
    text-align: center;
}

.auth-page__footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.auth-page__footer a {
    color: var(--color-primary);
    font-weight: 600;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 14px;
}

.alert--error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.alert--success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
}

.checkin-result__icon {
    font-size: 56px;
    text-align: center;
    margin: 16px 0;
}

.quiz-option input {
    accent-color: var(--color-primary);
}

/* ========== 打卡日历 ========== */

.checkin-calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.checkin-calendar__title {
    text-align: center;
    flex: 1;
}

.checkin-calendar__title strong {
    display: block;
    font-size: 16px;
}

.checkin-calendar__meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.checkin-calendar__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    height: var(--touch-min);
    border-radius: 50%;
    color: var(--color-primary);
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
}

.checkin-calendar__weekdays,
.checkin-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.checkin-calendar__weekdays {
    margin-bottom: 6px;
    text-align: center;
    font-size: 11px;
    color: var(--color-text-muted);
}

.checkin-calendar__day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.checkin-calendar__day--empty {
    visibility: hidden;
}

.checkin-calendar__day--today {
    box-shadow: inset 0 0 0 2px var(--color-primary);
    color: var(--color-primary);
}

.checkin-calendar__day--checked {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
}

.checkin-calendar__day--makeup {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.checkin-calendar__day--makeup .checkin-calendar__dot {
    background: #f59e0b;
}

.checkin-calendar__dot {
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
}

.checkin-calendar__legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.checkin-calendar__legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

.checkin-calendar__legend-dot--checked {
    background: rgba(99, 102, 241, 0.25);
}

.checkin-calendar__legend-dot--makeup {
    background: rgba(245, 158, 11, 0.35);
}

.checkin-calendar__legend-dot--today {
    box-shadow: inset 0 0 0 2px var(--color-primary);
    background: transparent;
}

.history-item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item__meta {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.history-item__exp {
    color: var(--color-primary);
    font-weight: 700;
}

/* ========== 排行榜 ========== */

.leaderboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.leaderboard-tabs__item {
    text-align: center;
    padding: 10px 6px;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
}

.leaderboard-tabs--5 {
    grid-template-columns: repeat(5, 1fr);
}

.leaderboard-tabs--5 .leaderboard-tabs__item {
    font-size: 12px;
    padding: 8px 4px;
}

.leaderboard-tabs--7 {
    grid-template-columns: repeat(4, 1fr);
}

.leaderboard-tabs--7 .leaderboard-tabs__item {
    font-size: 11px;
    padding: 8px 3px;
}

.leaderboard-tabs--8 {
    grid-template-columns: repeat(4, 1fr);
}

.leaderboard-tabs--8 .leaderboard-tabs__item {
    font-size: 11px;
    padding: 8px 3px;
}

.leaderboard-tabs__item.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.leaderboard-my {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.leaderboard-my strong {
    font-size: 20px;
    color: var(--color-primary);
}

.leaderboard-my__score {
    color: var(--color-text-muted);
    font-size: 13px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item--me {
    background: rgba(99, 102, 241, 0.06);
}

.leaderboard-item__rank {
    width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.leaderboard-item__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.leaderboard-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-item__info {
    flex: 1;
    min-width: 0;
}

.leaderboard-item__info strong {
    display: block;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-item__info span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.leaderboard-item__score {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 15px;
    flex-shrink: 0;
}

.leaderboard-item__score small {
    font-size: 11px;
    font-weight: 600;
}

.leaderboard-item--clickable {
    width: 100%;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.leaderboard-item--clickable:active {
    background: rgba(99, 102, 241, 0.06);
}

body.lb-modal-open {
    overflow: hidden;
}

.lb-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.lb-modal[hidden] {
    display: none !important;
}

.lb-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.lb-modal__panel {
    position: relative;
    width: 100%;
    max-width: 360px;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface);
    border-radius: 16px;
    padding: 16px 16px 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
    animation: lb-pop-in 0.22s ease;
    z-index: 100;
}

.lb-modal__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    padding-bottom: 4px;
}

@keyframes lb-pop-in {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lb-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 99;
}

.lb-modal__loading,
.lb-modal__error {
    margin: 24px 0;
    text-align: center;
    color: var(--color-text-muted);
}

.lb-modal__head {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    padding-right: 36px;
    flex-shrink: 0;
}

.lb-modal__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lb-modal__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lb-modal__title h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.lb-modal__title span {
    font-size: 13px;
    color: var(--color-text-muted);
}

.lb-modal__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.lb-modal__stats div {
    text-align: center;
    padding: 8px 2px;
    border-radius: var(--radius);
    background: var(--color-bg);
}

.lb-modal__stats strong {
    display: block;
    font-size: 16px;
    margin-bottom: 2px;
}

.lb-modal__stats span {
    font-size: 11px;
    color: var(--color-text-muted);
}

.lb-modal__pet {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: var(--color-bg);
    flex-shrink: 0;
}

.lb-modal__pet-visual {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.lb-modal__pet-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lb-modal__pet-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.lb-modal__pet-meta strong {
    display: block;
    margin-bottom: 4px;
}

.lb-modal__pet-meta span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.lb-modal__hint {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-muted);
    text-align: center;
}

.lb-modal__hint a {
    color: var(--color-primary);
}

.lb-modal__actions {
    margin-top: 4px;
    flex-shrink: 0;
}

.lb-modal__msg {
    margin: 12px 0 0;
    text-align: center;
    font-size: 14px;
}

.lb-modal__msg--ok {
    color: #16a34a;
}

.lb-modal__msg--err {
    color: #dc2626;
}

/* ========== 好友 ========== */

.section-title {
    margin: 16px 0 8px;
    font-size: 15px;
}

.friend-search__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.friend-search__row {
    display: flex;
    gap: 8px;
}

.friend-search__input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
}

.friend-card {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.friend-card__main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.friend-card__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.friend-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-card__meta {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.friend-card__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.friend-card__badge {
    font-size: 12px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ========== 多宠物切换 ========== */

.pet-switcher {
    margin-bottom: 12px;
    padding: 12px;
}

.pet-switcher__label {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.pet-switcher__list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.pet-switcher__item {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 72px;
    padding: 8px 6px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    background: var(--color-bg);
}

.pet-switcher__item.is-selected {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
}

.pet-switcher__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: transparent;
}

.pet-switcher__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pet-switcher__name {
    font-size: 11px;
    font-weight: 600;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.pet-switcher__level {
    font-size: 10px;
    color: var(--color-text-muted);
}

.pet-switcher__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    color: #d97706;
    background: rgba(255, 255, 255, 0.95);
    padding: 2px 5px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
    pointer-events: none;
}

.pet-display__inactive {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.pet-display__power {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: #d97706;
    text-align: center;
}

/* ========== 宠物 PK ========== */

.battle-info__meta {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.battle-pet-list-wrap {
    margin: 0 0 16px;
}

.battle-pet-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 16px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.battle-pet-list::-webkit-scrollbar {
    display: none;
}

.battle-pet {
    position: relative;
    flex: 0 0 108px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    cursor: pointer;
    border: 2px solid transparent;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.battle-pet:has(input:checked) {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.06);
}

.battle-pet input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.battle-pet__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.battle-pet__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.battle-pet__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    width: 100%;
    align-items: center;
}

.battle-pet__info strong {
    font-size: 13px;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-pet__info span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.battle-form__hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.battle-quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    text-align: center;
}

.battle-quiz-header__side {
    flex: 1;
    min-width: 0;
}

.battle-quiz-header__side strong {
    display: block;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-quiz-header__side span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.battle-quiz-header__vs {
    font-weight: 800;
    color: var(--color-primary);
    font-size: 16px;
    flex-shrink: 0;
}

.battle-result--win {
    border: 2px solid rgba(34, 197, 94, 0.3);
    margin-bottom: 10px;
}

.battle-scoreboard {margin-bottom: 10px;}

.battle-result--lose {
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.battle-result__icon {
    font-size: 48px;
    text-align: center;
}

.battle-scoreboard__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.battle-scoreboard__pet {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.battle-scoreboard__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.battle-scoreboard__pet strong {
    display: block;
    font-size: 14px;
}

.battle-scoreboard__pet span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.battle-scoreboard__score {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
    flex-shrink: 0;
}

.battle-scoreboard__vs {
    text-align: center;
    font-weight: 700;
    color: var(--color-text-muted);
    margin: 8px 0;
    font-size: 13px;
}

.battle-scoreboard__note {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

.battle-result--pending {
    border: 2px solid rgba(59, 130, 246, 0.25);
}

.battle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.battle-badge--win {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.battle-badge--lose {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.battle-badge--pending {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.battle-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.battle-history-item__meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.dashboard-notice__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    font-size: 14px;
}

.dashboard-notice__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.dashboard-notice__item:first-child {
    padding-top: 0;
}

.makeup-card {
    border: 1px dashed rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.06);
}

/* ========== 我的 · 菜单角标 ========== */

.profile-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
}

.profile-menu__item--last {
    border-bottom: none;
}

.profile-menu__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.profile-menu__arrow {
    color: var(--color-text-muted);
}

.profile-menu__badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.profile-menu__hint {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-primary);
}

/* ========== v2.0 学习 Hub ========== */

.learn-hub {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.learn-card {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s;
}

.learn-card:active {
    transform: scale(0.98);
}

.learn-card__icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.learn-card__body {
    flex: 1;
    min-width: 0;
}

.learn-card__body h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.learn-card__body p {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.learn-card__arrow {
    color: var(--color-text-muted);
    font-size: 18px;
}

.wordbook-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.wordbook-tabs__item {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
}

.wordbook-tabs__item.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.wordbook-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.wordbook-subtabs__item {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
}

.wordbook-subtabs__item.is-active {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
}

.wordbook-subtabs__note {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.wordbook-intro {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.wordbook-editions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 10px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.wordbook-editions__chip {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 108px;
    max-width: 140px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    text-decoration: none;
    color: inherit;
}

.wordbook-editions__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.wordbook-editions__chip.is-active {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
}

.wordbook-editions__chip.is-soon {
    opacity: 0.55;
    pointer-events: none;
}

.wordbook-editions__label {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.wordbook-editions__badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
}

.wordbook-editions__chip.is-active .wordbook-editions__badge {
    background: #fff;
    color: var(--color-primary);
}

.wordbook-editions__meta {
    font-size: 11px;
    color: var(--color-text-muted);
}

.wordbook-deprecated-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    vertical-align: middle;
}

.wordbook-content-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    vertical-align: middle;
}

.wordbook-content-badge.is-verified {
    background: #d1fae5;
    color: #065f46;
}

.wordbook-content-badge.is-pending {
    background: #fee2e2;
    color: #991b1b;
}

.wordbook-content-notice {
    margin: -4px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.wordbook-content-notice a {
    color: var(--color-primary);
    font-weight: 600;
}

.wordbook-item.is-deprecated {
    opacity: 0.92;
}

.wordbook-detail__subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.wordbook-detail__hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.wordbook-list,
.wordbook-units {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wordbook-item {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wordbook-item__info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.wordbook-item__info span {
    font-size: 13px;
    color: var(--color-text-muted);
}

.wordbook-item__progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wordbook-item__progress .progress-bar {
    flex: 1;
    min-width: 0;
}

.wordbook-item__progress span {
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 36px;
    text-align: right;
}

.wordbook-detail__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.wordbook-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
}

.wordbook-active {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.wordbook-unit {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wordbook-unit__title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.wordbook-unit__done {
    color: var(--color-success);
    font-weight: 700;
}

.wordbook-unit__meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.progress-bar {
    height: 8px;
    width: 100%;
    background: var(--color-progress-track);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar--sm {
    height: 6px;
}

.progress-bar__fill {
    display: block;
    height: 100%;
    min-width: 0;
    background: linear-gradient(90deg, var(--color-primary), #818cf8);
    border-radius: 999px;
    transition: width 0.2s;
}

.challenge-summary__row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.challenge-map {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.challenge-node {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.challenge-node--locked {
    opacity: 0.65;
}

.challenge-node--cleared {
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.challenge-node__no {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.challenge-node__stars {
    margin-bottom: 6px;
}

.challenge-star {
    color: var(--color-border);
    font-size: 14px;
}

.challenge-star.is-lit {
    color: #f59e0b;
}

.challenge-star--lg {
    font-size: 28px;
}

.challenge-node__title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    min-height: 36px;
}

.challenge-node__btn {
    min-height: 36px;
    font-size: 14px;
    padding: 0 12px;
}

.challenge-node__lock {
    font-size: 11px;
    color: var(--color-text-muted);
}

.challenge-mode-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    margin-left: 6px;
}

.challenge-mask {
    font-size: 20px;
    letter-spacing: 4px;
    font-weight: 700;
    text-align: center;
    margin: 12px 0;
    font-family: monospace;
}

.challenge-input {
    margin-top: 12px;
    text-align: center;
    font-size: 18px;
}

.challenge-result__icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.challenge-result__stars {
    margin-top: 8px;
}

.task-section-title {
    font-size: 15px;
    margin: 16px 0 8px;
    color: var(--color-text-muted);
}

.task-section-title:first-of-type {
    margin-top: 0;
}

.task-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.task-tabs__item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 10px 8px;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
}

.task-tabs__item.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.task-tabs__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.task-tabs__item.is-active .task-tabs__badge {
    background: #fff;
    color: var(--color-primary);
}

.task-empty {
    text-align: center;
    padding: 28px 16px;
}

.task-empty p {
    margin: 0;
    color: var(--color-text-muted);
}

.task-empty__hint {
    margin-top: 8px !important;
    font-size: 13px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.task-item__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.task-item__desc {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.task-item__progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.task-item__progress .progress-bar {
    flex: 1;
    min-width: 0;
}

.task-item__progress span {
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 48px;
    text-align: right;
}

.task-item__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-exp {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
}

.task-diff {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.task-diff--1 { background: #dcfce7; color: #166534; }
.task-diff--2 { background: #fef3c7; color: #92400e; }
.task-diff--3 { background: #fee2e2; color: #991b1b; }

.task-claimed,
.task-pending {
    font-size: 13px;
    color: var(--color-text-muted);
}

.chat-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100vh - var(--header-h) - var(--tabbar-h) - 24px);
    min-height: 400px;
}

.chat-pet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.chat-pet .pet-display__wrap {
    flex-shrink: 0;
    width: 32px;
    max-width: 32px;
    margin: 0;
}

.chat-pet .pet-display__scene {
    width: 32px;
    max-width: 32px;
    margin: 0;
    aspect-ratio: 1;
}

.chat-pet .pet-display__zoom-fab {
    display: none;
}

.chat-pet__info {
    flex: 1;
    min-width: 0;
}

.chat-pet__name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.chat-pet__hint {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--color-text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    min-height: 0;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-bubble--user {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble--assistant {
    align-self: flex-start;
    background: var(--color-border);
    color: var(--color-text);
    border-bottom-left-radius: 4px;
}

.chat-bubble--warn {
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
}

.chat-quick {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.chat-quick__btn {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 12px;
    font-weight: 600;
    min-height: auto;
    color: var(--color-text);
}

.chat-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input .form-input {
    flex: 1;
}

.chat-input .btn {
    min-height: 44px;
    padding: 0 16px;
    flex-shrink: 0;
}

.streak-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
}

/* ========== 每日打卡词源 ========== */

.word-source {
    padding: 12px 16px;
}

.word-source__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}

.word-source__label {
    color: var(--color-text-muted);
}

.word-source__name {
    color: var(--color-text);
}

.word-source__hint {
    font-size: 12px;
    color: var(--color-text-muted);
}

.word-source__switch {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.wordbook-item__active {
    font-style: normal;
    color: var(--color-primary);
    font-weight: 600;
}

.wordbook-activate-form {
    margin-top: -4px;
    margin-bottom: 10px;
}

.wordbook-activate-btn {
    min-height: 36px;
    font-size: 13px;
}

.dashboard-word-source {
    margin: 0;
    font-size: 13px;
    color: var(--color-text);
}

.dashboard-word-source__hint {
    color: var(--color-text-muted);
    font-size: 12px;
}

.dashboard-word-source a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}

/* ========== 宠物召唤 Gacha ========== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.gacha-header-tickets {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
}

.gacha-header-shards {
    font-size: 14px;
    font-weight: 600;
    color: #7c3aed;
}

.pet-rarity--common { color: #6b7280; }
.pet-rarity--rare { color: #3b82f6; }
.pet-rarity--epic { color: #a855f7; }
.pet-rarity--legendary { color: #eab308; }

.pet-library__rarity-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.pet-library__rarity-badge.pet-rarity--common {
    color: #6b7280;
    background: rgba(243, 244, 246, 0.95);
}

.pet-library__rarity-badge.pet-rarity--rare {
    color: #2563eb;
    background: rgba(219, 234, 254, 0.95);
}

.pet-library__rarity-badge.pet-rarity--epic {
    color: #9333ea;
    background: rgba(243, 232, 255, 0.95);
}

.pet-library__rarity-badge.pet-rarity--legendary {
    color: #ca8a04;
    background: rgba(254, 243, 199, 0.95);
    font-size: 9px;
    padding: 0 4px;
}

.pet-library__badge--gacha {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}

/* --- 召唤页 --- */
.gacha-page {
    padding-bottom: 200px;
}

.gacha-page__top {
    margin-bottom: 8px;
}

.gacha-page__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.gacha-page__pool {
    margin: 0;
    font-size: 18px;
}

.gacha-page__rates {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}

.gacha-page__stats {
    display: flex;
    gap: 14px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.gacha-page__history-link {
    margin-left: auto;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 13px;
}

.gacha-page__shards-link {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
}

.gacha-page__shards-link:hover {
    text-decoration: underline;
}

/* --- 碎片商店 --- */
.gacha-shop__balance {
    margin: 0 0 4px;
    font-size: 15px;
    text-align: center;
}

.gacha-shop__hint {
    margin: 0 0 12px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
}

.gacha-shop__tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    background: var(--color-surface, #fff);
    border-radius: 12px;
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.08));
}

.gacha-shop__tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 6px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
}

.gacha-shop__tab.is-active {
    background: var(--color-primary);
    color: #fff;
}

.gacha-shop__panel {
    display: none;
}

.gacha-shop__panel.is-active {
    display: block;
}

.gacha-shop__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gacha-shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin: 0;
}

.gacha-shop-item.is-disabled {
    opacity: 0.72;
}

.gacha-shop-item__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.gacha-shop-item__thumb {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-border, #eee);
}

.gacha-shop-item__thumb img,
.gacha-shop-item__thumb span {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: contain;
    font-size: 24px;
}

.gacha-shop-item__thumb span {width: auto;height: auto;font-size: 12px;}

.gacha-shop-item__rarity {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    line-height: 1.2;
}

.gacha-shop-item__body {
    flex: 1;
    min-width: 0;
}

.gacha-shop-item__name {
    margin: 0 0 2px;
    font-weight: 600;
    font-size: 14px;
}

.gacha-shop-item__desc {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.gacha-shop-item__warn {
    margin: 4px 0 0;
    font-size: 11px;
    color: #dc2626;
}

.gacha-shop-item__action {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.gacha-shop-item__cost {
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
}

.gacha-shop__empty {
    padding: 20px;
    text-align: center;
}

/* 祭坛动画区 */
.gacha-altar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    margin: 8px 0 16px;
}

.gacha-altar__orb {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #c4b5fd, #6366f1 55%, #4338ca);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.5);
    z-index: 2;
}

.gacha-altar.is-idle .gacha-altar__orb {
    animation: gachaOrbFloat 3s ease-in-out infinite;
}

.gacha-altar.is-summoning .gacha-altar__orb {
    animation: gachaOrbSummon 0.6s ease-in-out infinite;
}

.gacha-altar__emoji {
    font-size: 36px;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.gacha-altar__ring {
    position: absolute;
    border: 2px solid rgba(99, 102, 241, 0.35);
    border-radius: 50%;
    pointer-events: none;
}

.gacha-altar__ring--1 {
    width: 140px;
    height: 140px;
    animation: gachaRingSpin 8s linear infinite;
}

.gacha-altar__ring--2 {
    width: 170px;
    height: 170px;
    border-style: dashed;
    animation: gachaRingSpin 12s linear infinite reverse;
}

.gacha-altar__hint {
    margin: 16px 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
}

.gacha-pity {
    margin-bottom: 12px;
    font-size: 13px;
}

.gacha-pity summary {
    cursor: pointer;
    font-weight: 600;
    padding: 4px 0;
}

.gacha-pity__list {
    margin: 8px 0 0;
    padding: 0 0 0 18px;
    color: var(--color-text-muted);
}

.gacha-pity__list li {
    margin: 4px 0;
}

/* 底部操作坞 */
.gacha-dock {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
    width: min(100% - 24px, 456px);
    background: var(--color-surface);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    z-index: 20;
}

.gacha-dock__free {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.gacha-dock__free-hint {
    margin: 0 0 8px;
    font-size: 12px;
    text-align: center;
    color: var(--color-text-muted);
}

.gacha-dock__tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    background: var(--color-bg, #f3f4f6);
    border-radius: 10px;
    padding: 4px;
}

.gacha-dock__tab {
    flex: 1;
    min-height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
}

.gacha-dock__tab.is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.gacha-dock__actions {
    display: flex;
    gap: 10px;
}

.gacha-dock__btn {
    flex: 1;
    min-height: 56px;
    border: none;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.gacha-dock__btn:active:not(:disabled) {
    transform: scale(0.97);
}

.gacha-dock__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gacha-dock__btn--single {
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.gacha-dock__btn--multi {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    flex: 1.2;
}

.gacha-dock__btn-label {
    font-size: 17px;
    font-weight: 700;
}

.gacha-dock__btn-cost {
    font-size: 11px;
    opacity: 0.85;
}

/* 召唤全屏动画 */
.gacha-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.gacha-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.gacha-overlay__scene {
    position: relative;
    width: 200px;
    height: 200px;
}

.gacha-overlay__orb {
    position: absolute;
    inset: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, #fde68a, #6366f1 50%, transparent 70%);
    animation: gachaOverlayOrb 1.2s ease-in-out infinite;
}

.gacha-overlay__burst {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: gachaRingSpin 1s linear infinite;
}

.gacha-overlay__particles {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 2px, transparent 2px);
    background-size: 16px 16px;
    animation: gachaParticles 0.8s linear infinite;
}

.gacha-overlay__text {
    margin-top: 24px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.1em;
    animation: gachaTextPulse 1s ease-in-out infinite;
}

/* --- 结果页 --- */
.gacha-result {
    position: relative;
    padding-bottom: 24px;
}

.gacha-result__flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
}

.gacha-result__flash.is-play {
    animation: gachaResultFlash 0.6s ease-out;
}

.gacha-result--rare .gacha-result__flash.is-play {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 70%);
}

.gacha-result--epic .gacha-result__flash.is-play {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4), transparent 70%);
}

.gacha-result--legendary .gacha-result__flash.is-play {
    background: radial-gradient(circle, rgba(234, 179, 8, 0.5), transparent 70%);
}

.gacha-result__title {
    text-align: center;
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}

.gacha-result__meta {
    text-align: center;
    color: var(--color-text-muted);
    margin: 0 0 12px;
}

.gacha-result__reveal-all {
    display: block;
    margin: 0 auto 12px;
}

.gacha-result__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.gacha-result__grid--multi {
    grid-template-columns: repeat(2, 1fr);
}

.gacha-result__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.gacha-result__actions.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 翻牌 */
.gacha-flip {
    perspective: 800px;
    min-height: 140px;
    cursor: pointer;
    outline: none;
}

.gacha-flip__inner {
    position: relative;
    width: 100%;
    min-height: 140px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.gacha-flip.is-flipped .gacha-flip__inner {
    transform: rotateY(180deg);
}

.gacha-flip__back,
.gacha-flip__front {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 2px solid #e5e7eb;
    background: var(--color-surface);
}

.gacha-flip__back {
    background: linear-gradient(145deg, #6366f1, #4f46e5);
    color: #fff;
    border-color: #4f46e5;
}

.gacha-flip__front {
    transform: rotateY(180deg);
}

.gacha-flip.pet-rarity--rare .gacha-flip__front { border-color: #3b82f6; }
.gacha-flip.pet-rarity--epic .gacha-flip__front {
    border-color: #a855f7;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
}
.gacha-flip.pet-rarity--legendary .gacha-flip__front {
    border-color: #eab308;
    box-shadow: 0 0 18px rgba(234, 179, 8, 0.45);
}

.gacha-flip.is-flipped.pet-rarity--legendary .gacha-flip__inner {
    animation: gachaLegendaryPop 0.5s ease;
}

.gacha-flip__mystery {
    font-size: 42px;
    font-weight: 700;
    opacity: 0.9;
}

.gacha-flip__tap {
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.8;
}

.gacha-flip__img img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.gacha-flip__img span {
    font-size: 40px;
}

.gacha-flip__name {
    margin: 6px 0 0;
    font-weight: 600;
    font-size: 14px;
}

.gacha-flip__rarity {
    font-size: 11px;
    font-weight: 600;
}

.gacha-flip__dup {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.gacha-flip__new {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
    margin-top: 4px;
}

/* 历史 / 概率 */
.gacha-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gacha-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.gacha-history-item__thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gacha-history-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gacha-history-item__thumb span {
    font-size: 26px;
    line-height: 1;
}

.gacha-history-item__body {
    flex: 1;
    min-width: 0;
}

.gacha-history-item__main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.gacha-history-item__meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.gacha-rates__tier {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gacha-rates__tier li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border, #eee);
}

.gacha-rates__table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.gacha-rates__table th,
.gacha-rates__table td {
    padding: 8px 4px;
    text-align: left;
    border-bottom: 1px solid var(--color-border, #eee);
}

@keyframes gachaOrbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes gachaOrbSummon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); box-shadow: 0 0 40px rgba(167, 139, 250, 0.8); }
}

@keyframes gachaRingSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes gachaOverlayOrb {
    0%, 100% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes gachaParticles {
    from { transform: rotate(0deg); }
    to { transform: rotate(20deg); }
}

@keyframes gachaTextPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes gachaResultFlash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes gachaLegendaryPop {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.06); }
    100% { transform: rotateY(180deg) scale(1); }
}
