/* ============================================================
   Challenge Feed — Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&display=swap');

:root {
    --pink:        #ff006e;
    --pink-light:  #ff2e8a;
    --pink-faint:  #fff0f6;
    --black:       #0f0f0f;
    --grey-dark:   #2a2a2a;
    --grey-mid:    #6b6b6b;
    --grey-light:  #e4e4e4;
    --grey-faint:  #f5f4f2;
    --cream:       #faf8f5;
    --white:       #ffffff;

    --gold:        #f59e0b;
    --gold-faint:  #fffbeb;
    --silver:      #94a3b8;
    --silver-faint:#f8fafc;
    --bronze:      #c2783a;
    --bronze-faint:#fdf4ec;

    --radius:      18px;
    --radius-sm:   10px;
    --shadow:      0 2px 16px rgba(0,0,0,0.07);
    --shadow-hover:0 6px 28px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--grey-faint);
    color: var(--black);
    min-height: 100vh;
}

.feed-container {
    max-width: 660px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* ── Header ── */
.feed-header {
    background: var(--white);
    border-bottom: 1px solid var(--grey-light);
    padding: 28px 24px 22px;
    margin-bottom: 20px;
}

.feed-header-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.feed-eyebrow {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--pink);
    margin-bottom: 5px;
}

.feed-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.9rem;
    line-height: 1.15;
    color: var(--black);
    max-width: 380px;
}

.feed-subtitle {
    margin-top: 5px;
    font-size: 0.82rem;
    color: var(--grey-mid);
}

.record-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--pink);
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 11px 20px;
    border-radius: 100px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}
.record-cta:hover { background: var(--pink-light); transform: translateY(-1px); }

/* ── Feed body ── */
.feed-body { padding: 0 14px; }

/* ── Loading ── */
.feed-loading { text-align: center; padding: 60px 20px; color: var(--grey-mid); }

.loading-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.loading-dots span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--pink);
    animation: dot-bounce 1.2s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* ── Empty ── */
.feed-empty { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 14px; }
.feed-empty h2 { font-family: 'DM Serif Display', serif; font-size: 1.4rem; margin-bottom: 8px; }
.feed-empty p  { color: var(--grey-mid); font-size: 0.92rem; margin-bottom: 22px; }

/* ── Feed grid ── */
.recordings-feed { display: flex; flex-direction: column; gap: 14px; }

/* ── Recording Card ── */
.recording-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    animation: card-in 0.35s ease both;
    position: relative;
    border: 1.5px solid transparent;
}
.recording-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.recording-card.rank-1 { background: var(--gold-faint);   border-color: #fde68a; }
.recording-card.rank-2 { background: var(--silver-faint); border-color: #e2e8f0; }
.recording-card.rank-3 { background: var(--bronze-faint); border-color: #f5d4b0; }

/* ── Rank badge ── */
.rank-badge {
    position: absolute;
    top: 14px; right: 14px;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
}
.rank-badge.gold   { background: var(--gold);   color: var(--white); }
.rank-badge.silver { background: var(--silver); color: var(--white); }
.rank-badge.bronze { background: var(--bronze); color: var(--white); }

/* ── Card Header ── */
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px 10px;
    padding-right: 50px;
}

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.card-meta { display: flex; flex-direction: column; gap: 1px; }
.card-username { font-weight: 600; font-size: 0.87rem; color: var(--black); }
.card-time     { font-size: 0.73rem; color: var(--grey-mid); }

/* ── Phrase ── */
.card-phrase {
    font-family: 'DM Serif Display', serif;
    font-size: 1.18rem;
    line-height: 1.3;
    padding: 2px 20px 13px;
    color: var(--black);
}

/* ── Custom Audio Player ── */
.card-audio { padding: 0 18px 13px; }

.audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--grey-faint);
    border-radius: 100px;
    padding: 7px 14px 7px 7px;
}

.play-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--pink);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--white);
    font-size: 0.7rem;
    transition: background 0.15s, transform 0.1s;
}
.play-btn:hover  { background: var(--pink-light); }
.play-btn:active { transform: scale(0.93); }

/* SVG icons inside play button */
.play-btn svg { width: 12px; height: 12px; fill: white; }
.play-btn .pause-icon { display: none; }
.play-btn.playing .play-icon  { display: none; }
.play-btn.playing .pause-icon { display: block; }

.audio-progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.audio-progress-bar {
    width: 100%; height: 4px;
    background: var(--grey-light);
    border-radius: 100px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: var(--pink);
    border-radius: 100px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

.audio-time { font-size: 0.7rem; color: var(--grey-mid); font-variant-numeric: tabular-nums; }

/* ── Actions ── */
.card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 10px 2px;
    border-top: 1px solid var(--grey-light);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--grey-mid);
    padding: 10px 9px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.action-btn:hover { color: var(--black); background: var(--grey-faint); }

.upvote-btn.upvoted { color: var(--pink); }
.upvote-icon { font-size: 1.05rem; display: inline-block; }
.upvote-btn.upvoted .upvote-icon {
    animation: upvote-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes upvote-pop {
    0%  { transform: scale(1); }
    50% { transform: scale(1.45); }
    100%{ transform: scale(1); }
}

.share-btn { margin-left: auto; }

/* ── Comments ── */
.card-comments {
    border-top: 1px solid var(--grey-light);
    padding: 12px 18px 14px;
}

.comments-preview { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }

.comment-item { font-size: 0.82rem; line-height: 1.45; color: var(--grey-dark); }
.comment-author { font-weight: 600; color: var(--black); margin-right: 4px; }

.view-all-comments {
    background: none; border: none; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.77rem; font-weight: 600;
    color: var(--grey-mid); padding: 0 0 10px;
    display: block; transition: color 0.15s;
}
.view-all-comments:hover { color: var(--pink); }

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

.comment-input {
    flex: 1;
    border: 1.5px solid var(--grey-light);
    border-radius: 100px;
    padding: 7px 15px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    outline: none;
    background: var(--grey-faint);
    transition: border-color 0.15s, background 0.15s;
}
.comment-input:focus { border-color: var(--pink); background: var(--white); }

.comment-submit-btn {
    background: var(--pink); color: var(--white);
    border: none; border-radius: 100px;
    padding: 7px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}
.comment-submit-btn:hover   { background: var(--pink-light); }
.comment-submit-btn:active  { transform: scale(0.96); }
.comment-submit-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

/* ── Load More ── */
.load-more-container { text-align: center; padding: 30px 0; }
.load-more-btn {
    background: var(--white);
    border: 1.5px solid var(--grey-light);
    border-radius: 100px;
    padding: 11px 32px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem; font-weight: 600;
    color: var(--grey-dark); cursor: pointer;
    transition: border-color 0.15s, color 0.15s, transform 0.1s;
}
.load-more-btn:hover { border-color: var(--pink); color: var(--pink); transform: translateY(-1px); }

/* ── Login Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.42);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 28px 28px;
    max-width: 360px; width: 100%;
    text-align: center; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.modal-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none;
    font-size: 1rem; color: var(--grey-mid);
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: color 0.15s;
}
.modal-close:hover { color: var(--black); }

.modal-icon    { font-size: 2.4rem; margin-bottom: 10px; }
.modal-card h2 { font-family: 'DM Serif Display', serif; font-size: 1.45rem; margin-bottom: 7px; }
.modal-card p  { color: var(--grey-mid); font-size: 0.88rem; line-height: 1.5; margin-bottom: 22px; }
.modal-actions { display: flex; flex-direction: column; gap: 9px; }

.modal-btn {
    display: block; padding: 12px; border-radius: 100px;
    font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.93rem;
    text-decoration: none; transition: background 0.15s, transform 0.1s;
}
.modal-btn.primary         { background: var(--pink); color: var(--white); }
.modal-btn.primary:hover   { background: var(--pink-light); transform: translateY(-1px); }
.modal-btn.secondary       { background: var(--grey-faint); color: var(--grey-dark); border: 1.5px solid var(--grey-light); }
.modal-btn.secondary:hover { border-color: var(--pink); color: var(--pink); }

/* ── Responsive ── */
@media (max-width: 600px) {
    .feed-header-inner { flex-direction: column; align-items: flex-start; }
    .feed-title        { font-size: 1.5rem; }
    .record-cta        { width: 100%; justify-content: center; }
    .card-phrase       { font-size: 1.05rem; }
}