@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');

/* ═══════════════════════════════════════
   TRN Articles — New Editorial Theme
   Warm paper bg · White cards · Serif titles
═══════════════════════════════════════ */

:root {
    --trn-bg:       #F5F4F0;
    --trn-white:    #ffffff;
    --trn-ink:      #1a1a1a;
    --trn-muted:    #6b6b6b;
    --trn-subtle:   #999;
    --trn-border:   #E8E4DC;
    --trn-border2:  #D5D0C8;
    --trn-accent:   #C0392B;
    --trn-accent-h: #a93226;
    --trn-radius:   14px;
}

/* ── WRAPPER ── */
.trn-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 36px 20px 80px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--trn-bg);
    min-height: 100vh;
}

/* ── CONTROLS ── */
.trn-controls {
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Search */
.trn-search-wrap { position: relative; }

.trn-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #bbb;
    pointer-events: none;
}

.trn-search {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--trn-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: var(--trn-white);
    color: var(--trn-ink);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.trn-search:focus {
    border-color: var(--trn-border2);
    box-shadow: 0 0 0 3px rgba(26,26,26,0.05);
}

.trn-search::placeholder { color: #bbb; }

/* Category filter */
.trn-categories-filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trn-cat-row1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.trn-cat-btn {
    padding: 5px 14px;
    border: 1px solid var(--trn-border2);
    border-radius: 20px;
    background: var(--trn-white);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.trn-cat-btn:hover {
    border-color: var(--trn-ink);
    color: var(--trn-ink);
}

.trn-cat-btn.active {
    background: var(--trn-ink);
    border-color: var(--trn-ink);
    color: #fff;
}

.trn-cat-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 5px 14px;
    border: 1px dashed var(--trn-border2);
    border-radius: 20px;
    background: transparent;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.trn-cat-more-btn:hover {
    border-color: var(--trn-ink);
    color: var(--trn-ink);
    border-style: solid;
}

.trn-more-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

.trn-cat-filter-expanded .trn-more-arrow { transform: rotate(180deg); }
.trn-cat-filter-expanded .trn-cat-more-btn {
    border-style: solid;
    color: var(--trn-ink);
    border-color: var(--trn-ink);
}

.trn-cat-row2 {
    display: flex;
    flex-direction: column;
    background: var(--trn-white);
    border: 1px solid var(--trn-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    padding: 6px;
    min-width: 180px;
    gap: 2px;
}

.trn-cat-row2 .trn-cat-btn {
    border-radius: 8px;
    border: none;
    text-align: left;
    justify-content: flex-start;
    font-size: 13px;
    padding: 8px 14px;
    color: var(--trn-ink);
    background: transparent;
}

.trn-cat-row2 .trn-cat-btn:hover { background: var(--trn-bg); border: none; color: var(--trn-ink); }
.trn-cat-row2 .trn-cat-btn.active { background: var(--trn-ink); color: #fff; border: none; }

/* ── ARTICLE LIST ── */
.trn-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    min-height: 200px;
}

.trn-list.trn-loading { opacity: 0.4; pointer-events: none; }

/* ── ARTICLE CARD ── */
.trn-article {
    background: var(--trn-white);
    border: 1px solid var(--trn-border);
    border-radius: var(--trn-radius);
    padding: 22px 24px;
    animation: trnFadeIn 0.4s ease both;
    width: 100%;
}

@keyframes trnFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.trn-article.trn-visible { opacity: 1; }

.trn-article-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* ── AUTHOR ROW — above pills, right-aligned ── */
.trn-source-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 7px;
}

.trn-source-meta-name {
    font-size: 12px;
    color: var(--trn-subtle);
    font-family: 'Inter', sans-serif;
}

.trn-source-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--trn-bg);
    border: 1px solid var(--trn-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--trn-muted);
    flex-shrink: 0;
    overflow: hidden;
}

/* ── META TOP ROW: pills only, full width ── */
.trn-meta-top {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 0;
}

.trn-meta-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

/* category pills — vivid solid style */
.trn-badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border: none;
    color: var(--badge-color, #fff);
    background: var(--badge-bg, #1a1a1a);
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.trn-date { display: none; }

/* ── TITLE — large serif bold ── */
.trn-title {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(19px, 3vw, 23px);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 7px;
    color: var(--trn-ink);
    letter-spacing: -0.02em;
}

.trn-title a {
    color: inherit;
    text-decoration: none;
}

.trn-title a:hover { color: var(--trn-accent); }

/* ── BYLINE under title ── */
.trn-byline-sub {
    font-size: 13px;
    color: var(--trn-muted);
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
}

.trn-byline-sub span { color: #444; font-weight: 500; }

/* ── RESUME ── */
.trn-resume {
    font-size: 14px;
    color: #555;
    line-height: 1.65;
    margin: 0 0 16px;
    font-family: 'Inter', sans-serif;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── FOOTER: divider + actions left + Continue Reading right ── */
.trn-footer {
    border-top: 1px solid var(--trn-border);
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

/* byline row hidden — we use trn-byline-sub above title */
.trn-byline { display: none; }

/* Continue Reading link */
.trn-read-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--trn-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--trn-accent-h);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s;
    flex-shrink: 0;
}

.trn-read-btn svg { display: none; }
.trn-read-btn::after { content: ' ›'; font-size: 15px; font-weight: 400; }
.trn-read-btn:hover { color: var(--trn-accent-h); text-decoration-color: var(--trn-accent-h); }

/* ── ACTION BUTTONS — evenly spaced ── */
.trn-actions-row {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

.trn-actions-row .trn-save { margin-left: 0; }

.trn-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    padding: 6px 0;
    border: none;
    border-right: 1px solid var(--trn-border2);
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #666;
    transition: color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.trn-action-btn:last-child { border-right: none; }
.trn-action-btn > * { flex-shrink: 0; }
.trn-action-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.trn-action-btn:hover { color: var(--trn-ink); }

/* Save active */
.trn-save.active { color: #b45309; font-weight: 500; }
.trn-save:hover  { color: #d97706; }

/* Like active */
.trn-like.active { color: #991b1b; font-weight: 500; }
.trn-like:hover  { color: var(--trn-accent); }

/* Share */
.trn-share:hover  { color: #16a34a; }
.trn-share.copied { color: #166534; font-weight: 500; }

/* Feedback */
.trn-feedback:hover { color: #2563eb; }
.trn-feedback.sent  { color: #1d4ed8; font-weight: 500; }

/* Like count badge */
.trn-like-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.trn-like-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--trn-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 16px;
    line-height: 1.5;
    flex-shrink: 0;
}
.trn-like-count:empty { display: none; }
.trn-like.active .trn-like-count { background: #C0392B; color: #fff; }

/* Read badge */
.trn-read-badge {
    display: none !important;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    border-radius: 100px;
    padding: 2px 8px;
    white-space: nowrap;
}
.trn-article.trn-read .trn-read-badge { display: inline-flex !important; }

/* Read article muted */
.trn-article.trn-read { opacity: 0.72; }
.trn-article.trn-read .trn-title a { color: var(--trn-muted); }
.trn-article.trn-read .trn-title a::after {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    background: #22c55e;
    border-radius: 50%;
    margin-left: 7px;
    vertical-align: middle;
}

/* ── EMPTY STATE ── */
.trn-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--trn-muted);
    font-size: 15px;
    font-family: 'Lora', serif;
    font-style: italic;
}

/* ── SPINNER ── */
.trn-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 60px 0;
}

.trn-spinner span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--trn-ink);
    animation: trn-bounce 1s infinite ease-in-out;
}
.trn-spinner span:nth-child(2) { animation-delay: 0.15s; }
.trn-spinner span:nth-child(3) { animation-delay: 0.3s; }

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

/* ── LOAD MORE ── */
.trn-loadmore-wrap { text-align: center; margin-top: 32px; }

.trn-loadmore {
    padding: 11px 36px;
    border: 1px solid var(--trn-border2);
    border-radius: 8px;
    background: var(--trn-white);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
}

.trn-loadmore:hover { background: var(--trn-ink); color: #fff; border-color: var(--trn-ink); }
.trn-loadmore.loading { opacity: 0.5; pointer-events: none; }

/* ── SIGNIN POPUP ── */
.trn-popup-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.trn-popup-overlay.open { display: flex; }
.trn-popup { background: #fff; border-radius: 16px; padding: 36px 32px; max-width: 360px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.2); position: relative; animation: popIn 0.2s ease; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.trn-popup-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.trn-popup h3 { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: #222; }
.trn-popup p  { font-size: 14px; color: #666; margin: 0 0 24px; line-height: 1.5; }
.trn-popup-btns { display: flex; flex-direction: column; gap: 10px; }
.trn-popup-btn { padding: 12px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; font-family: inherit; text-decoration: none; display: block; transition: opacity 0.15s; text-align: center; }
.trn-popup-btn:hover { opacity: 0.85; }
.trn-popup-btn.primary { background: var(--trn-accent); color: #fff; }
.trn-popup-btn.secondary { background: #f0f0f0; color: #333; }
.trn-google-btn { background: #fff; color: #3c4043; border: 1px solid #dadce0 !important; display: flex !important; align-items: center; justify-content: center; gap: 10px; font-weight: 500; }
.trn-google-btn:hover { background: #f8f9fa !important; opacity: 1 !important; }
.trn-popup-divider { display: flex; align-items: center; gap: 10px; color: #aaa; font-size: 12px; }
.trn-popup-divider::before, .trn-popup-divider::after { content: ''; flex: 1; height: 1px; background: #e0e0e0; }
.trn-popup-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 18px; cursor: pointer; color: #999; }

/* ── SHARE POPUP ── */
.trn-share { position: relative; }
.trn-share-popup { display: none; position: fixed; background: #fff; border: 1px solid #e8e5e0; border-radius: 12px; padding: 6px; box-shadow: 0 8px 32px rgba(0,0,0,0.14); z-index: 9998; min-width: 190px; white-space: nowrap; animation: trn-popup-in 0.15s ease; }
.trn-share-popup.open { display: block; }
@keyframes trn-popup-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.trn-share-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: none; border-radius: 8px; background: none; font-size: 13px; font-family: inherit; color: #333; cursor: pointer; text-align: left; transition: background 0.1s; }
.trn-share-option:hover { background: var(--trn-bg); }
.trn-share-icon { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; background: #f0f0f0; }
.trn-icon-x  { background: #000; color: #fff; font-style: normal; font-weight: 700; font-size: 12px; }
.trn-icon-wa { background: #25d366; font-size: 14px; }
.trn-icon-fb { background: #1877f2; color: #fff; font-weight: 700; font-size: 14px; font-style: normal; }

/* ── FEEDBACK POPUP ── */
.trn-feedback-popup { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.trn-feedback-popup.open { display: flex; }
.trn-feedback-box { background: #fff; border-radius: 16px; padding: 28px; max-width: 420px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); position: relative; animation: popIn 0.2s ease; }
.trn-feedback-box h3 { margin: 0 0 16px; font-size: 17px; color: #222; }
.trn-feedback-types { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.trn-feedback-type { padding: 5px 13px; border-radius: 20px; border: 1px solid #e0e0e0; background: none; font-size: 12px; cursor: pointer; font-family: inherit; color: #555; transition: all 0.15s; }
.trn-feedback-type.active, .trn-feedback-type:hover { border-color: var(--trn-accent); color: var(--trn-accent); background: rgba(192,57,43,0.06); }
.trn-feedback-box textarea { width: 100%; border: 1px solid #e0e0e0; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-family: inherit; resize: vertical; min-height: 90px; outline: none; box-sizing: border-box; color: #222; transition: border-color 0.2s; }
.trn-feedback-box textarea:focus { border-color: var(--trn-accent); }
.trn-feedback-submit { margin-top: 12px; width: 100%; padding: 12px; background: var(--trn-accent); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.trn-feedback-submit:hover { background: var(--trn-accent-h); }

/* ── FAVORITES PAGE ── */
.trn-favorites-wrap { max-width: 780px; margin: 0 auto; padding: 40px 20px; }
.trn-favorites-header { margin-bottom: 20px; }
.trn-favorites-empty { text-align: center; padding: 60px 20px; }
.trn-empty-icon { font-size: 44px; display: block; margin-bottom: 12px; color: #ccc; }
.trn-favorites-empty h2 { font-size: 20px; color: var(--trn-ink); margin: 0 0 8px; }
.trn-favorites-empty p  { font-size: 14px; color: var(--trn-muted); margin: 0 0 20px; }
.trn-back-btn { display: inline-block; padding: 10px 24px; background: var(--trn-accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; }
.trn-back-btn:hover { background: var(--trn-accent-h); }

/* ── DARK MODE ── */
body.dark-mode .trn-wrapper     { background: #141414; }
body.dark-mode .trn-article     { background: #1e1e1e; border-color: #2a2a2a; }
body.dark-mode .trn-search      { background: #1e1e1e; border-color: #333; color: #ddd; }
body.dark-mode .trn-cat-btn     { background: #1e1e1e; border-color: #333; color: #aaa; }
body.dark-mode .trn-cat-btn.active { background: #ddd; color: #111; border-color: #ddd; }
body.dark-mode .trn-cat-more-btn { border-color: #444; color: #888; }
body.dark-mode .trn-title a     { color: #e8e4dc; }
body.dark-mode .trn-resume      { color: #999; }
body.dark-mode .trn-byline-sub  { color: #666; }
body.dark-mode .trn-action-btn  { color: #666; border-right-color: #333; }
body.dark-mode .trn-action-btn:hover { color: #ccc; }
body.dark-mode .trn-footer      { border-top-color: #2a2a2a; }
body.dark-mode .trn-read-btn    { color: #ccc; text-decoration-color: #555; }
body.dark-mode .trn-read-btn:hover { color: #ff6b6b; }
body.dark-mode .trn-loadmore    { background: #1e1e1e; border-color: #333; color: #aaa; }
body.dark-mode .trn-loadmore:hover { background: #ddd; color: #111; border-color: #ddd; }
body.dark-mode .trn-popup       { background: #1e1e1e; }
body.dark-mode .trn-popup h3    { color: #e8e4dc; }
body.dark-mode .trn-popup p     { color: #888; }
body.dark-mode .trn-share-popup { background: #1e1e1e; border-color: #333; }
body.dark-mode .trn-share-option { color: #ccc; }
body.dark-mode .trn-share-option:hover { background: #2a2a2a; }
body.dark-mode .trn-feedback-box { background: #1e1e1e; }
body.dark-mode .trn-feedback-box h3 { color: #e8e4dc; }
body.dark-mode .trn-feedback-box textarea { background: #141414; border-color: #333; color: #ddd; }
body.dark-mode .trn-save.active  { color: #f5a623; }
body.dark-mode .trn-like.active  { color: #e05a5a; }
body.dark-mode .trn-share.copied { color: #22c55e; }
body.dark-mode .trn-feedback.sent { color: #3b82f6; }
body.dark-mode .trn-read-badge  { background: rgba(34,197,94,0.15); color: #4ade80; }
body.dark-mode .trn-article.trn-read .trn-title a { color: #666; }
body.dark-mode .trn-source-avatar { background: #2a2a2a; border-color: #333; color: #777; }

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
    .trn-wrapper { padding: 24px 14px 60px; }
    .trn-article { padding: 18px 16px; }
    .trn-footer  {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .trn-actions-row { width: 100%; }
    .trn-read-btn    { align-self: flex-end; }
}

/* ── RECO STYLES (kept for compatibility) ── */
.trn-reco-loading { text-align: center; padding: 48px 20px; color: var(--trn-muted); font-size: 14px; }
.trn-reco-empty   { text-align: center; padding: 60px 20px; }
.trn-reco-empty h3 { font-size: 18px; color: var(--trn-ink); margin: 0 0 8px; }
.trn-reco-empty p  { font-size: 14px; color: var(--trn-muted); margin: 0 0 20px; }
.trn-reco-empty a  { display: inline-block; padding: 10px 22px; background: var(--trn-ink); color: #fff; border-radius: 100px; font-size: 13px; font-weight: 600; text-decoration: none; }

/* ── NEW BADGE ── */
.trn-new-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    background: var(--trn-accent);
    color: #fff;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
    animation: trn-pulse 2s ease-in-out infinite;
}
@keyframes trn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* ── BACK TO TOP ── */
.trn-back-top {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 18px;
    z-index: 999;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--trn-ink);
    color: #fff;
    border: none;
    outline: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.trn-back-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.trn-back-top:hover { background: var(--trn-accent); }
body.dark-mode .trn-back-top { background: #ddd; color: #111; }
body.dark-mode .trn-back-top:hover { background: var(--trn-accent); color: #fff; }

@media (max-width: 520px) {
    .trn-back-top { display: inline-flex; }
}

/* ── TRENDING SECTION ── */
.trn-trending-wrap {
    margin-top: 32px;
    margin-bottom: 14px;
}
.trn-trending-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.trn-trending-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--trn-ink);
}
.trn-trending-sub {
    font-size: 11px;
    color: var(--trn-subtle);
    font-family: 'Inter', sans-serif;
}
.trn-trending-cards {
    display: flex;
    gap: 10px;
}
.trn-trending-card {
    flex: 1;
    min-width: 0;
    background: var(--trn-white);
    border: 1px solid var(--trn-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-decoration: none;
    transition: border-color 0.15s;
}
.trn-trending-card:hover { border-color: var(--trn-border2); }
.trn-trending-rank {
    font-size: 11px;
    font-weight: 700;
    color: var(--trn-accent);
    font-family: 'Inter', sans-serif;
}
.trn-trending-cat {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.trn-trending-ttl {
    font-family: 'Lora', Georgia, serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--trn-ink);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.trn-trending-likes {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--trn-accent);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    margin-top: auto;
    padding-top: 4px;
}

/* ── SURPRISE ME ── */
.trn-surprise-wrap {
    margin: 14px 0 6px;
}
.trn-surprise-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--trn-ink);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s;
}
.trn-surprise-btn:hover { background: #333; }
.trn-surprise-sub {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.45);
}

/* Surprise popup */
.trn-surprise-popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.trn-surprise-popup.open { display: flex; }
.trn-surprise-box {
    background: #fff;
    border-radius: 18px;
    padding: 28px 28px 24px;
    max-width: 420px;
    width: 90%;
    position: relative;
    animation: popIn 0.2s ease;
}
.trn-surprise-box .trn-popup-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    font-size: 18px; cursor: pointer; color: #999;
}
.trn-surprise-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.trn-surprise-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
    margin-bottom: 8px;
}
.trn-surprise-author { font-size: 12px; color: #999; margin-bottom: 10px; }
.trn-surprise-resume {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.trn-surprise-actions {
    display: flex;
    gap: 10px;
}
.trn-surprise-read {
    flex: 1;
    padding: 11px;
    background: var(--trn-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: background 0.15s;
}
.trn-surprise-read:hover { background: var(--trn-accent-h); }
.trn-surprise-again {
    padding: 11px 16px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.trn-surprise-again:hover { background: #e0e0e0; }

/* dark mode */
body.dark-mode .trn-trending-card { background: #1e1e1e; border-color: #2a2a2a; }
body.dark-mode .trn-trending-ttl  { color: #e8e4dc; }
body.dark-mode .trn-surprise-btn  { background: #ddd; color: #111; }
body.dark-mode .trn-surprise-btn:hover { background: #bbb; }
body.dark-mode .trn-surprise-box  { background: #1e1e1e; }
body.dark-mode .trn-surprise-title { color: #e8e4dc; }
body.dark-mode .trn-surprise-author { color: #666; }
body.dark-mode .trn-surprise-resume { color: #999; }
body.dark-mode .trn-surprise-again { background: #2a2a2a; color: #ccc; }

@media (max-width: 520px) {
    .trn-trending-cards { gap: 8px; }
    .trn-trending-card  { padding: 10px 11px; }
    .trn-trending-ttl   { font-size: 11px; }
}

/* ── PROMO BANNER — shown to logged-out users only ── */
.trn-promo-banner {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 14px 18px;
    animation: trn-slide-down 0.4s ease;
}
@keyframes trn-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.trn-promo-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}
.trn-promo-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.trn-promo-text {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}
.trn-promo-text strong {
    color: #fff;
    font-weight: 600;
}
.trn-promo-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #C0392B;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}
.trn-promo-btn:hover { background: #a93226; color: #fff; }
.trn-promo-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 0 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.trn-promo-close:hover { color: rgba(255,255,255,0.75); }

/* Mobile: stack text and button */
@media (max-width: 520px) {
    .trn-promo-inner { flex-wrap: wrap; gap: 8px; }
    .trn-promo-icon  { display: none; }
    .trn-promo-text  { font-size: 12px; width: 100%; }
    .trn-promo-btn   { font-size: 12px; padding: 7px 16px; }
}

/* Dark mode — already dark banner, just adjust slightly */
body.dark-mode .trn-promo-banner { background: linear-gradient(135deg, #111 0%, #222 100%); }

/* ── SUBSCRIBE TOOLTIP ── */
.trn-sub-tooltip-wrap {
    position: relative;
    display: inline-block;
}
.trn-sub-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    padding: 9px 14px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.trn-sub-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
}
.trn-sub-tooltip-wrap:hover .trn-sub-tooltip,
.trn-sub-tooltip-wrap:focus-within .trn-sub-tooltip {
    opacity: 1;
    transform: translateY(0);
}
body.dark-mode .trn-sub-tooltip { background: #e8e4dc; color: #1a1a1a; }
body.dark-mode .trn-sub-tooltip::after { border-top-color: #e8e4dc; }

/* ── SURPRISE ME: desktop hidden, mobile visible ── */
@media (min-width: 901px) {
    .trn-surprise-mobile { display: none !important; }
}

/* ── AUTHOR FILTER ── */
.trn-author-filter {
    background: none; border: none; padding: 0;
    font-size: 12px; color: var(--trn-subtle);
    font-family: 'Inter', sans-serif; cursor: pointer;
    transition: color 0.15s; text-align: left;
}
.trn-author-filter:hover {
    color: var(--trn-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.trn-author-bar {
    display: none; /* hidden by default — JS shows it via style="display:flex" */
    align-items: center; justify-content: space-between;
    background: #fff4f3; border: 1px solid rgba(192,57,43,0.2);
    border-radius: 10px; padding: 10px 16px; margin-bottom: 16px;
    animation: trn-slide-down 0.25s ease;
}
.trn-author-bar.visible {
    display: flex;
}
.trn-author-bar-label {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; color: var(--trn-ink);
    font-family: 'Inter', sans-serif;
}
.trn-author-bar-label strong { color: var(--trn-accent); }
.trn-author-bar-clear {
    background: none; border: 1px solid rgba(192,57,43,0.35);
    border-radius: 20px; padding: 4px 12px; font-size: 12px;
    color: var(--trn-accent); cursor: pointer;
    font-family: 'Inter', sans-serif; transition: all 0.15s;
}
.trn-author-bar-clear:hover { background: var(--trn-accent); color: #fff; border-color: var(--trn-accent); }
body.dark-mode .trn-author-bar { background: rgba(192,57,43,0.1); border-color: rgba(192,57,43,0.25); }
body.dark-mode .trn-author-filter { color: #666; }
body.dark-mode .trn-author-filter:hover { color: var(--trn-accent); }

/* ── GUEST LIBRARY TOAST ── */
#trn-library-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #1a1a1a;
    color: rgba(255,255,255,0.85);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    padding: 14px 18px 14px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 99999;
    max-width: 420px;
    width: calc(100% - 40px);
    animation: trn-toast-in 0.3s ease;
    transition: opacity 0.3s, transform 0.3s;
}
@keyframes trn-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#trn-library-toast strong { color: #fff; }
#trn-library-toast a {
    color: #C0392B;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
#trn-library-toast a:hover { color: #e04030; }
#trn-library-toast button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
#trn-library-toast button:hover { color: rgba(255,255,255,0.7); }
@media (max-width: 520px) {
    #trn-library-toast { font-size: 12px; padding: 12px 14px; border-radius: 10px; }
}

/* ── FRESHNESS SIGNAL BAR ── */
.trn-freshness-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--trn-white);
    border: 1px solid rgba(22,163,74,0.2);
    border-radius: 20px;
    margin-bottom: 14px;
    width: fit-content;
}
.trn-freshness-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
    animation: trn-pulse-green 2s ease-in-out infinite;
}
@keyframes trn-pulse-green {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
    50%       { opacity: 0.8; box-shadow: 0 0 0 5px rgba(22,163,74,0); }
}
.trn-freshness-text {
    font-size: 12px;
    font-weight: 600;
    color: #16a34a;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.trn-freshness-latest {
    background: none;
    border: none;
    font-size: 11px;
    color: #16a34a;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
    opacity: 0.7;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.trn-freshness-latest:hover { opacity: 1; }
body.dark-mode .trn-freshness-bar { background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.2); }

/* ── HUMAN CURATION TRUST NOTE ── */
.trn-curation-note {
    font-size: 11px;
    color: var(--trn-subtle);
    font-family: 'Inter', sans-serif;
    font-style: italic;
    margin-bottom: 16px;
    letter-spacing: 0.01em;
    opacity: 0.7;
}
body.dark-mode .trn-curation-note { color: #555; }

/* ── LATEST SORT ACTIVE BAR ── */
.trn-latest-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    animation: trn-slide-down 0.25s ease;
}
.trn-latest-bar-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #1e40af;
    font-family: 'Inter', sans-serif;
}
.trn-latest-bar-label strong { color: #1d4ed8; }
.trn-latest-bar-clear {
    background: none;
    border: 1px solid rgba(37,99,235,0.3);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s;
    white-space: nowrap;
}
.trn-latest-bar-clear:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
body.dark-mode .trn-latest-bar { background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.2); }
body.dark-mode .trn-latest-bar-label { color: #93c5fd; }
body.dark-mode .trn-latest-bar-label strong { color: #bfdbfe; }
body.dark-mode .trn-latest-bar-clear { color: #93c5fd; border-color: rgba(37,99,235,0.3); }

/* ── READ HISTORY REMINDER TOAST ── */
#trn-read-reminder {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 380px;
    width: calc(100% - 48px);
    background: #fff;
    border: 1px solid #E8E4DC;
    border-radius: 16px;
    padding: 18px 18px 16px 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.14);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
#trn-read-reminder.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}
.trn-read-reminder-icon {
    font-size: 28px;
    line-height: 1;
}
.trn-read-reminder-text {
    font-size: 13px;
    color: #3a3a3a;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
}
.trn-read-reminder-text strong { color: #1a1a1a; }
.trn-read-reminder-text a {
    color: #C0392B;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.trn-read-reminder-cta {
    display: block;
    padding: 10px 16px;
    background: #C0392B;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}
.trn-read-reminder-cta:hover { background: #a93226; color: #fff; }
.trn-read-reminder-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 14px;
    color: #bbb;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.trn-read-reminder-close:hover { color: #666; }
/* Progress bar showing time left */
#trn-read-reminder::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: #C0392B;
    border-radius: 0 0 16px 16px;
    animation: trn-reminder-timer 10s linear forwards;
    transform-origin: left;
}
@keyframes trn-reminder-timer {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
body.dark-mode #trn-read-reminder {
    background: #1e1e1e;
    border-color: #2a2a35;
}
body.dark-mode .trn-read-reminder-text { color: #ccc; }
body.dark-mode .trn-read-reminder-text strong { color: #eee; }
@media (max-width: 480px) {
    #trn-read-reminder { right: 12px; left: 12px; width: auto; bottom: 16px; }
}

/* ── ALL READ NOTICE ── */
.trn-all-read-notice {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #0369a1;
    font-family: 'Inter', sans-serif;
    text-align: center;
}
body.dark-mode .trn-all-read-notice {
    background: rgba(3,105,161,0.1);
    border-color: rgba(3,105,161,0.2);
    color: #7dd3fc;
}

/* ── READ DIVIDER ── */
.trn-read-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 16px;
    color: var(--trn-subtle);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-style: italic;
}
.trn-read-divider::before,
.trn-read-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--trn-border);
}

/* ── HIDE LIKE COUNT ON TRENDING CARDS ── */
.trn-trending-likes { display: none; }
