/* ===== Tamagochi Minigame (Epic 8) + Custom Character Modal (Epic 5) ===== */

/* --- Pet List --- */
.tama-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
}
.tama-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}
.tama-new-btn { flex-shrink: 0; }

.tama-pets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 0 16px 16px;
}
.tama-pet-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-header);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.tama-pet-card:hover {
    background: var(--bg-active);
    transform: translateY(-2px);
}
.tama-pet-card-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.tama-card-img {
    width: 64px; height: 64px;
    object-fit: cover;
    border-radius: 50%;
}
.tama-card-initials {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: white;
}
.tama-pet-card-name {
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.tama-pet-card-mood {
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- Character Picker --- */
.tama-picker { padding: 24px 16px; text-align: center; }
.tama-picker-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.tama-picker-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}
.tama-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding: 4px;
}
.tama-picker-grid::-webkit-scrollbar { width: 5px; }
.tama-picker-grid::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.tama-picker-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.tama-picker-card:hover { background: var(--bg-active); transform: scale(1.05); }
.tama-picker-img {
    width: 52px; height: 52px;
    border-radius: 50%;
    object-fit: cover;
}
.tama-picker-initials {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
}
.tama-picker-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}
.tama-cancel-btn { margin-top: 16px; }

/* --- Pet View --- */
.tama-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    gap: 12px;
}
.tama-view-top { display: flex; justify-content: space-between; width: 100%; }
.tama-back-btn { font-size: 13px; }
.tama-delete-btn { font-size: 13px; color: var(--danger); border-color: var(--danger); }
.tama-delete-btn:hover { background: rgba(234, 67, 53, 0.1); }

/* --- Avatar --- */
.tama-avatar-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.tama-avatar-large {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 16px rgba(0, 168, 132, 0.25);
}
.tama-avatar-large.tama-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 600;
    color: white;
}
.tama-pet-name { font-size: 18px; font-weight: 500; color: var(--text-primary); }

/* --- Animations --- */
@keyframes tamaBounce {
    0%, 100% { transform: translateY(0); }
    15% { transform: translateY(-8px); }
    30% { transform: translateY(0); }
    45% { transform: translateY(-4px); }
    60% { transform: translateY(0); }
}
@keyframes tamaIdle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.tama-bounce { animation: tamaBounce 1.2s ease-in-out; }
.tama-avatar-area .tama-avatar-large { animation: tamaIdle 3s ease-in-out infinite; }
.tama-avatar-area .tama-avatar-large.tama-bounce { animation: tamaBounce 1.2s ease-in-out; }

/* --- Reaction Popup --- */
.tama-reaction {
    font-size: 15px;
    color: var(--text-primary);
    min-height: 24px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s, transform 0.3s;
    text-align: center;
}
.tama-reaction.tama-reaction-visible { opacity: 1; transform: translateY(0); }

/* --- Stat Bars --- */
.tama-stats { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.tama-stat-row { display: flex; align-items: center; gap: 10px; }
.tama-stat-label { font-size: 13px; color: var(--text-secondary); width: 60px; flex-shrink: 0; }
.tama-stat-bar {
    flex: 1; height: 10px;
    background: var(--bg-input);
    border-radius: 5px;
    overflow: hidden;
}
.tama-stat-fill {
    height: 100%; border-radius: 5px;
    transition: width 0.4s ease, background 0.4s ease;
}
.tama-stat-value {
    font-size: 12px;
    color: var(--text-secondary);
    width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --- Action Buttons --- */
.tama-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.tama-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    min-width: 70px;
    color: var(--text-primary);
    font-family: var(--font);
}
.tama-action-btn:hover { background: var(--bg-active); transform: translateY(-2px); }
.tama-action-btn:active { transform: scale(0.95); }
.tama-action-emoji { font-size: 24px; line-height: 1; }
.tama-action-label { font-size: 11px; color: var(--text-secondary); }

/* ===== Custom Character Modal (Epic 5) ===== */
.custom-char-modal-content {
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.custom-char-body {
    overflow-y: auto;
    max-height: calc(90vh - 60px);
    padding-bottom: 24px;
}
.custom-char-body::-webkit-scrollbar { width: 5px; }
.custom-char-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* Avatar Section */
.cc-avatar-section { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cc-avatar-preview {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px dashed var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.15s;
}
.cc-avatar-preview:hover { border-color: var(--accent); }
.cc-avatar-placeholder { font-size: 32px; color: var(--text-secondary); }
.cc-avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* Textarea & Color Picker */
.cc-textarea { resize: vertical; min-height: 60px; max-height: 160px; line-height: 1.4; }
.cc-color-picker {
    width: 48px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

/* Optional Section (details/summary) */
.cc-optional-section { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cc-optional-section summary {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--bg-header);
    transition: background 0.15s;
    user-select: none;
}
.cc-optional-section summary:hover { background: var(--bg-active); }
.cc-optional-fields,
.cc-import-section { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

/* Divider */
.cc-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
}
.cc-divider::before, .cc-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}
.cc-divider span {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.cc-import-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Import Search */
.cc-import-row { display: flex; gap: 8px; }
.cc-import-row .text-input { flex: 1; }
.cc-import-results { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.cc-import-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.cc-import-card:hover { background: var(--bg-active); }
.cc-import-card-img {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-import-card-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cc-import-initials { font-size: 14px; font-weight: 600; color: white; }
.cc-import-card-img span { font-size: 18px; color: var(--text-secondary); }
.cc-import-card-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-import-card-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cc-import-card-title {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cc-import-card-sub { font-size: 12px; color: var(--text-secondary); }
.cc-error { color: var(--danger); }

/* Actions */
.cc-actions { display: flex; justify-content: center; padding-top: 4px; }
.cc-actions .btn-primary { width: 100%; }

/* --- Tamagochi Area in Sidebar --- */
.tamagochi-area { flex: 1; overflow-y: auto; }
.tamagochi-area::-webkit-scrollbar { width: 5px; }
.tamagochi-area::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
