/**
 * /account only — the user's ducks, achievements and duck detail.
 *
 * Layers on styles.css and portal.css (tabs, panels, stat tiles, badges,
 * modal backdrop) and only adds what those don't have.
 */

/* Header */
.account-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.account-avatar {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fef3c7;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    overflow: hidden;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-since {
    font-size: 0.85rem;
}

.account-section-title {
    font-size: 1rem;
    margin: 0 0 0.75rem;
    color: var(--text-dark);
}

/* Tab counts */
.tab .tab-count {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-dark);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.6;
}

.tab[aria-selected="true"] .tab-count {
    background: #dbeafe;
    color: var(--primary-color);
}

/* Duck cards — the app's My Ducks rows */
.duck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 0.75rem;
}

.duck-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    width: 100%;
    padding: 0.85rem;
    text-align: left;
    font: inherit;
    color: inherit;
    background: var(--background-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.duck-card:hover,
.duck-card:focus-visible {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px var(--shadow);
    outline: none;
}

.duck-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.duck-card-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-weight: 600;
    font-size: 1rem;
}

.duck-card-blurb {
    color: var(--text-light);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.duck-card-meta,
.duck-card-seen {
    color: var(--text-light);
    font-size: 0.78rem;
}

.duck-card-meta { color: var(--text-dark); }

/* Photo square, tinted with the duck's colour until a photo loads */
.duck-thumb {
    --duck-color: #facc15;
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--duck-color) 30%, #fff);
    border: 2px solid var(--duck-color);
}

.duck-thumb.is-multi {
    border-color: #a78bfa;
    background: linear-gradient(135deg, #fde68a, #fbcfe8, #bfdbfe, #bbf7d0);
}

.duck-thumb-emoji { font-size: 1.9rem; line-height: 1; }

.duck-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duck-thumb-lg {
    width: 112px;
    height: 112px;
    border-radius: 16px;
}

.duck-thumb-lg .duck-thumb-emoji { font-size: 3.2rem; }

/* Achievements */
.achievement-progress p {
    margin: 0 0 0.4rem;
    font-weight: 600;
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: var(--secondary-color);
    border-radius: inherit;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 0.6rem;
}

.achievement {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
}

.achievement.is-unlocked { background: #f0fdf4; border-color: #bbf7d0; }
.achievement.is-locked { opacity: 0.6; }

.achievement-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1.2;
}

.achievement-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-weight: 600;
    font-size: 0.92rem;
}

.achievement-desc { color: var(--text-light); font-size: 0.83rem; }
.achievement-date { color: #065f46; font-size: 0.75rem; margin-top: 0.15rem; }

.rarity,
.achievement-chip {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #f3f4f6;
    color: #4b5563;
}

.achievement-chip { font-size: 0.8rem; padding: 0.25rem 0.65rem; }

.rarity-uncommon  { background: #d1fae5; color: #065f46; }
.rarity-rare      { background: #dbeafe; color: #1e40af; }
.rarity-epic      { background: #ede9fe; color: #5b21b6; }
.rarity-legendary { background: #ffedd5; color: #9a3412; }

/* Duck detail dialog */
body.account-modal-open { overflow: hidden; }

.modal-card.account-modal {
    position: relative;
    max-width: 680px;
    padding-top: 1rem;
}

.duck-detail-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 1;
}

.duck-detail-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.duck-detail-head h2 {
    margin: 0;
    font-size: 1.4rem;
}

.duck-detail-quote {
    margin: 0.15rem 0 0;
    font-style: italic;
    color: var(--text-dark);
}

.duck-detail-sub {
    margin: 0.25rem 0 0;
    color: var(--text-light);
    font-size: 0.88rem;
}

.duck-detail-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.duck-detail-stats .stat { padding: 0.6rem 0.5rem; text-align: center; }
.duck-detail-stats .stat .value { font-size: 1.3rem; }

.duck-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.duck-facts dt { color: var(--text-light); }
.duck-facts dd { margin: 0; }

.duck-detail-heading {
    font-size: 0.95rem;
    margin: 1.25rem 0 0.5rem;
}

.region-groups p { margin: 0 0 0.3rem; font-size: 0.9rem; }

.duck-trail {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.duck-trail li {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding: 0 0 0.9rem;
}

/* the line joining one stop to the next */
.duck-trail li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 14px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.duck-trail li:last-child::before { display: none; }

.trail-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--background);
    border: 3px solid var(--text-light);
    position: relative;
}

.trail-dot.is-mine { border-color: var(--primary-color); }
.trail-dot.is-birth { border-color: #d97706; background: #fde68a; }

.trail-place { font-weight: 600; font-size: 0.92rem; }
.trail-meta { color: var(--text-light); font-size: 0.8rem; }

.trail-note {
    margin: 0.3rem 0 0;
    font-size: 0.88rem;
    font-style: italic;
}

.trail-photo {
    position: relative;
    display: block;
    width: 120px;
    height: 0;
    margin-top: 0.4rem;
    border-radius: 8px;
    overflow: hidden;
}

.trail-photo.has-photo { height: 90px; }

.trail-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trail-privacy,
.duck-detail-foot {
    color: var(--text-light);
    font-size: 0.78rem;
    margin: 0.5rem 0 0;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--primary-color);
    cursor: pointer;
    text-align: left;
}

.link-button:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .duck-detail-head { flex-direction: column; align-items: flex-start; }
    .duck-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .duck-facts { grid-template-columns: 1fr; }
    .duck-facts dt { margin-top: 0.3rem; }
    .tab { padding: 0.5rem 0.65rem; font-size: 0.88rem; }
}
