/* ============================================================
   El Transmisor — UI Light Theme
   ============================================================ */

:root {
    --bg:        #f0f4f8;
    --bg-soft:   #ffffff;
    --card:      #ffffff;
    --card-2:    #f8fafc;
    --border:    #e2e8f0;
    --text:      #0f172a;
    --muted:     #64748b;
    --accent:    #4361ee;
    --accent-2:  #7c3aed;
    --like:      #ef4444;
    --dislike:   #1e293b;
    --ok:        #10b981;
    --warn:      #f59e0b;
    --danger:    #ef4444;
    --radius:    16px;
    --radius-sm: 10px;
    --shadow:    0 1px 3px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.05);
    --shadow-md: 0 4px 24px rgba(15,23,42,.10);
    --maxw:      1140px;
    --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9em; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
    box-shadow: 0 1px 4px rgba(15,23,42,.05);
}
.site-header-inner {
    display: flex; align-items: center; justify-content: space-between;
    max-width: var(--maxw); margin: 0 auto; padding: 12px 24px; gap: 12px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; }
.brand-name { font-weight: 700; letter-spacing: .2px; font-size: 1.05rem; }

.tx-badge {
    font-size: .7rem; font-weight: 700; letter-spacing: .5px;
    color: var(--accent); background: rgba(67,97,238,.1);
    padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(67,97,238,.18);
}

.top-nav {
    display: flex; align-items: center; gap: 2px; flex: 1; justify-content: center;
}
.top-nav a {
    color: var(--muted); font-size: .875rem; padding: 6px 11px;
    border-radius: 8px; font-weight: 500; transition: color .15s, background .15s;
    white-space: nowrap;
}
.top-nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.top-nav a.active { color: var(--accent); background: rgba(67,97,238,.08); font-weight: 600; }

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

/* Idioma */
.lang-switch { position: relative; }
.lang-btn {
    display: flex; align-items: center; gap: 5px;
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: .83rem;
    font-weight: 500; transition: border-color .15s;
}
.lang-btn:hover { border-color: var(--accent); }
.lang-menu {
    position: absolute; right: 0; top: 110%; list-style: none; margin: 0; padding: 6px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); display: none; min-width: 72px; z-index: 50;
}
.lang-menu.open { display: block; }
.lang-menu li a {
    display: block; padding: 6px 10px; border-radius: 8px;
    color: var(--muted); font-size: .85rem;
}
.lang-menu li a:hover,
.lang-menu li a.active { background: var(--bg); color: var(--text); text-decoration: none; }

/* ============================================================
   MAIN
   ============================================================ */
.site-main { max-width: var(--maxw); margin: 0 auto; padding: 24px 24px 60px; }

/* ============================================================
   METRIC CARDS (3 en la parte superior)
   ============================================================ */
.metric-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.metric-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; flex-shrink: 0;
}
.tx-card .metric-icon   { background: rgba(67,97,238,.1); }
.timer-card .metric-icon { background: rgba(67,97,238,.08); }
.country-card .metric-icon { background: rgba(16,185,129,.08); font-size: 2.2rem; }
.metric-label {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; color: var(--muted); margin-bottom: 3px;
}
.metric-value { font-weight: 800; font-size: 1.35rem; color: var(--text); line-height: 1.2; }
.metric-sub   { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* Timer en metric card */
.timer-display {
    font-size: 2rem; font-weight: 800; color: var(--accent);
    font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1;
    transition: color .3s;
}
.timer-display.low { color: var(--danger); }
.timer-sub-row { display: flex; gap: 16px; margin-top: 3px; }
.timer-sub-row span { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ============================================================
   TARJETA DEL MENSAJE
   ============================================================ */
.message-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 40px 28px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: rise .4s ease;
}
@keyframes rise { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.badge {
    font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700;
    color: var(--accent); background: rgba(67,97,238,.1); padding: 5px 11px; border-radius: 999px;
}
.badge-expired { color: var(--muted); background: rgba(100,116,139,.1); }

/* Ghost (último mensaje expirado) */
.message-card.ghost {
    opacity: .6; filter: grayscale(.3); border-style: dashed; pointer-events: none;
    background: var(--card-2);
}
.ghost-text { font-size: 1.5rem !important; color: var(--muted) !important; }
.ghost-cta  { text-align: center; font-size: .9rem; margin: 10px 0 24px; color: var(--muted); }

/* Comillas decorativas */
.quote-mark {
    display: block; font-size: 5rem; line-height: .6;
    color: var(--accent); font-family: Georgia, "Times New Roman", serif;
    margin-bottom: 12px; opacity: .6; user-select: none;
}

/* Texto del mensaje */
.message-text {
    font-size: 1.75rem; line-height: 1.35; font-weight: 700;
    margin: 0 0 24px; word-break: break-word; white-space: pre-wrap;
    letter-spacing: -.3px; color: var(--text);
}
@media (min-width: 860px) { .message-text { font-size: 2.1rem; } }

/* Meta del mensaje (autor, idioma) */
.message-meta {
    display: flex; flex-wrap: wrap; gap: 8px 16px;
    align-items: center; margin-bottom: 0;
    padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.message-meta .author { color: var(--muted); font-size: .95rem; }
.message-meta .author strong { color: var(--accent); font-weight: 700; }
.flag { display: inline-flex; align-items: center; font-size: 1.2rem; }
.lang-badge {
    font-size: .72rem; border: 1px solid var(--border); border-radius: 999px;
    padding: 2px 8px; letter-spacing: .5px; color: var(--muted);
}
.link-btn {
    background: none; border: none; color: var(--accent); cursor: pointer;
    padding: 0; font-size: .88rem; margin: 12px 0 0; display: inline-block;
}
.link-btn:hover { text-decoration: underline; }

/* Stats row */
.stats-row {
    display: flex; gap: 0; flex-wrap: wrap; align-items: stretch;
    margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden;
}
.stat-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; padding: 12px 16px; flex: 1; min-width: 80px;
    border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-ico   { font-size: 1.1rem; }
.stat-num   { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ============================================================
   BARRA DE ACCIÓN (Votar + Comentar + Compartir)
   ============================================================ */
.action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 10px;
    margin-bottom: 14px;
    align-items: stretch;
}
.btn-vote {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; padding: 14px 16px; border-radius: var(--radius-sm); border: none;
    cursor: pointer; font-weight: 700; font-size: .95rem; min-height: 68px;
    transition: transform .12s, filter .12s;
}
.btn-vote:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.btn-vote:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-vote .vote-ico { font-size: 1.25rem; }
.btn-vote .vote-sub { font-size: .75rem; font-weight: 500; opacity: .85; }
.btn-vote.like    { background: var(--ok);      color: #fff; }
.btn-vote.dislike { background: var(--dislike); color: #fff; }
.btn-vote.voted   { opacity: .55 !important; }
.btn-vote.bump { animation: bump .3s ease; }
@keyframes bump { 0% { transform:scale(1);} 40% { transform:scale(1.1);} 100% { transform:scale(1);} }

.btn-action {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 14px 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--card); color: var(--text);
    cursor: pointer; font-size: .85rem; font-weight: 600;
    transition: background .12s, border-color .12s, transform .12s;
    min-height: 68px; text-decoration: none;
}
.btn-action:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.btn-action .act-ico { font-size: 1.3rem; }
.btn-action .act-lbl { font-size: .72rem; }

.vote-info {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    background: rgba(67,97,238,.05); border: 1px solid rgba(67,97,238,.12);
    border-radius: var(--radius-sm); padding: 10px 14px; font-size: .82rem; color: var(--muted);
    margin-bottom: 16px;
}
.rules-link {
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent; border: 1.5px solid var(--accent);
    color: var(--accent); padding: 4px 12px;
    border-radius: 999px; cursor: pointer;
    font-size: .78rem; font-weight: 600; font-family: inherit;
    letter-spacing: .02em;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.rules-link:hover, .rules-link:focus-visible {
    background: var(--accent); color: #fff; outline: none;
}
.vote-hint-msg { flex: 1; }
#vote-hint { color: var(--muted); font-size: .82rem; }

/* Compartir */
.share-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding-top: 16px; border-top: 1px solid var(--border);
    margin-top: 4px;
}
.share-bar.hidden { display: none; }
.share-label { color: var(--muted); font-size: .85rem; margin-right: 4px; }
.share-btn {
    width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
    cursor: pointer; font-weight: 700; text-decoration: none; font-size: .9rem;
    transition: transform .12s, background .12s, border-color .12s;
}
.share-btn:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--accent); color: var(--accent); background: rgba(67,97,238,.06); }

/* ============================================================
   COLA DE MENSAJES
   ============================================================ */
.queue-section {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.queue-header { margin-bottom: 14px; }
.queue-title {
    font-size: 1rem; font-weight: 700; margin: 0 0 4px;
    display: flex; align-items: center; gap: 8px;
}
.queue-count {
    font-size: .75rem; background: rgba(67,97,238,.1); color: var(--accent);
    border-radius: 999px; padding: 2px 8px; border: 1px solid rgba(67,97,238,.15);
}
.queue-sub { font-size: .82rem; color: var(--muted); margin: 0 0 12px; }
.queue-list { list-style: none; padding: 0; margin: 0 0 16px; }
.queue-item {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px;
    transition: border-color .15s, background .3s;
}
.queue-item.queue-top,
.queue-item:first-child { border-color: rgba(67,97,238,.4); background: rgba(67,97,238,.03); }
.queue-item.queue-promoted { animation: q-promote .55s ease; }
@keyframes q-promote { 0% { background: rgba(67,97,238,.18); } 100% { background: var(--bg); } }
.queue-item-text { font-size: .9rem; line-height: 1.4; margin-bottom: 8px; word-break: break-word; }
.queue-item-meta { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; gap: 8px; flex-wrap: wrap; }
.queue-vote-bar { display: flex; gap: 6px; }
.queue-vote-btn {
    background: none; border: 1px solid var(--border); color: var(--muted);
    padding: 3px 10px; border-radius: 999px; cursor: pointer; font-size: .8rem;
    transition: border-color .12s, color .12s, transform .1s;
}
.queue-vote-btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.queue-vote-btn.voted { opacity: .55; cursor: default; }

.queue-publish { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }

/* ============================================================
   FORMULARIO DE PUBLICAR
   ============================================================ */
.publish { padding: 0; }
.publish-intro { text-align: center; margin-bottom: 24px; }
.publish-title { font-size: 1.8rem; margin: 0 0 6px; }
.publish-form, .comment-form {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.publish-form.queue-form { box-shadow: none; background: transparent; border: none; padding: 0; }

.input {
    width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
    border-radius: var(--radius-sm); padding: 12px 14px; font-size: 1rem; font-family: inherit;
    margin-bottom: 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67,97,238,.12); }
.message-input { min-height: 100px; resize: vertical; font-size: 1.05rem; }
.char-counter { text-align: right; color: var(--muted); font-size: .82rem; margin: -6px 0 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.form-msg { flex: 1; font-size: .9rem; }
.form-msg.error { color: var(--danger); }
.form-msg.ok    { color: var(--ok); }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ============================================================
   BOTONES GENERALES
   ============================================================ */
.btn {
    background: var(--card-2); border: 1px solid var(--border); color: var(--text);
    padding: 10px 20px; border-radius: 999px; cursor: pointer; font-size: .93rem; font-weight: 600;
    transition: transform .12s, border-color .12s; text-decoration: none; display: inline-block;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: none; color: #fff;
}
.btn-primary:hover { color: #fff; border-color: transparent; filter: brightness(1.08); }
.btn-lg { padding: 13px 28px; font-size: 1.03rem; }

/* Botón comentar toggle */
.comment-toggle-btn { margin-bottom: 12px; font-size: .9rem; padding: 8px 16px; }

/* ============================================================
   COMENTARIOS
   ============================================================ */
.comments { margin-top: 28px; }
.comments-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.section-title { font-size: 1.2rem; margin: 0; font-weight: 700; }

.comments-sort { display: flex; gap: 6px; }
.sort-btn {
    background: none; border: 1px solid var(--border); color: var(--muted);
    padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: .82rem;
    transition: border-color .12s, color .12s;
}
.sort-btn.active, .sort-btn:hover { border-color: var(--accent); color: var(--accent); }

.comment-form { margin-bottom: 12px; }
.comment-form.collapsed { display: none; }
.comment-form textarea { min-height: 80px; resize: vertical; }

.comment-list { list-style: none; padding: 0; margin: 16px 0 0; }
.comment {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 16px; margin-bottom: 10px; animation: rise .3s ease;
}
.comment-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: .95rem; }
.comment-time { font-size: .78rem; color: var(--muted); }
.comment-body { margin: 0 0 8px; word-break: break-word; font-size: .95rem; }
.comment-votes { display: flex; gap: 8px; }
.comment-vote-btn {
    background: none; border: 1px solid var(--border); color: var(--muted);
    padding: 3px 10px; border-radius: 999px; cursor: pointer; font-size: .82rem;
    transition: border-color .12s, color .12s, transform .1s;
}
.comment-vote-btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.comment-vote-btn.voted { opacity: .55; cursor: default; transform: none; }

/* ============================================================
   ÚLTIMO MENSAJE EXPIRADO (ghost)
   ============================================================ */
.last-expired-wrap { margin-bottom: 20px; }
.last-expired-label {
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem; color: var(--muted); margin-bottom: 10px;
}
.expired-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--muted); display: inline-block;
}

/* ============================================================
   HOME PANELS (3 columnas: Calendario / Ranking / Recientes)
   ============================================================ */
.home-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.panel-title {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .9px;
    color: var(--muted); margin: 0 0 16px; display: flex; align-items: center; gap: 7px;
}
.panel-link { display: block; margin-top: 14px; text-align: center; font-size: .82rem; }

/* Mini Calendario */
.mini-cal-header {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin-bottom: 12px; font-weight: 600; font-size: .95rem;
}
.mini-cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px; text-align: center;
}
.cal-dow { font-size: .68rem; color: var(--muted); font-weight: 600; padding: 3px 0; }
.cal-cell { font-size: .8rem; padding: 4px 2px; border-radius: 6px; line-height: 1.4; }
.cal-cell a {
    display: block; border-radius: 6px; padding: 2px;
    color: var(--text); transition: background .12s;
}
.cal-cell a:hover { background: var(--bg); text-decoration: none; }
.cal-cell.has-msg a { color: var(--accent); font-weight: 700; }
.cal-cell.today a {
    background: var(--accent); color: #fff !important; font-weight: 700;
}
.cal-cell.empty { }

/* Mini Ranking */
.mini-rank-list { list-style: none; padding: 0; margin: 0 0 4px; }
.mini-rank-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.mini-rank-item:last-child { border-bottom: none; }
.rank-pos  { font-size: .78rem; font-weight: 700; color: var(--muted); width: 18px; text-align: center; flex-shrink: 0; }
.rank-flag { font-size: 1.2rem; flex-shrink: 0; }
.rank-name { flex: 1; font-size: .88rem; font-weight: 500; }
.rank-val  { font-size: .9rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Mensajes recientes */
.recent-list { list-style: none; padding: 0; margin: 0; }
.recent-item {
    display: grid; grid-template-columns: 44px 1fr 24px;
    gap: 10px; align-items: start; padding: 10px 0;
    border-bottom: 1px solid var(--border); text-decoration: none;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover .recent-text { color: var(--accent); }
.recent-date { text-align: center; padding-top: 2px; }
.recent-day   { font-size: 1.05rem; font-weight: 800; color: var(--accent); line-height: 1; display: block; }
.recent-month { font-size: .65rem; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; display: block; }
.recent-text {
    font-size: .85rem; font-weight: 500; color: var(--text);
    line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    transition: color .15s;
}
.recent-flag { font-size: 1rem; flex-shrink: 0; padding-top: 4px; }

/* ============================================================
   COUNTRY PICKER
   ============================================================ */
.country-picker { position: relative; }
.cp-input-row {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0 12px; margin-bottom: 12px; transition: border-color .15s, box-shadow .15s;
}
.cp-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67,97,238,.12); }
.cp-flag-preview { font-size: 1.2rem; flex-shrink: 0; display: flex; align-items: center; }
.cp-flag-preview .fi { font-size: 1.2em; }
.cp-search {
    border: none; background: transparent; flex: 1; padding: 11px 0;
    font-size: 1rem; font-family: inherit; outline: none; color: var(--text); min-width: 0;
}
.cp-clear { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1.3rem; padding: 0 2px; line-height: 1; }
.cp-clear:hover { color: var(--text); }
.cp-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% - 12px); z-index: 55;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); max-height: 220px; overflow-y: auto;
    list-style: none; margin: 0; padding: 4px; display: none;
}
.cp-dropdown.open { display: block; }
.cp-option { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.cp-option:hover, .cp-option.cp-selected { background: var(--bg); }

/* ============================================================
   HISTÓRICO (página)
   ============================================================ */
.historic-list { list-style: none; padding: 0; margin: 0; }
.historic-item { border-bottom: 1px solid var(--border); }
.historic-item:last-child { border-bottom: none; }
.historic-link {
    display: grid; grid-template-columns: 56px 1fr 24px;
    gap: 16px; align-items: center; padding: 16px 4px;
    text-decoration: none; transition: background .12s; border-radius: var(--radius-sm);
}
.historic-link:hover { background: var(--card-2); text-decoration: none; }
.historic-link:hover .historic-text { color: var(--accent); }
.historic-date { text-align: center; }
.historic-day   { font-size: 1.5rem; font-weight: 800; color: var(--accent); line-height: 1; display: block; }
.historic-month { font-size: .65rem; text-transform: uppercase; color: var(--muted); display: block; }
.historic-year  { font-size: .65rem; color: var(--muted); display: block; }
.historic-body  { min-width: 0; }
.historic-text  { margin: 0 0 6px; font-size: .95rem; font-weight: 500; color: var(--text); transition: color .15s; }
.historic-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; }
.historic-stats { color: var(--muted); }
.historic-arrow { color: var(--muted); font-size: 1.1rem; }

/* ============================================================
   CALENDARIO (página)
   ============================================================ */
.calendar-grid {
    list-style: none; padding: 0; margin: 18px 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px;
}
.calendar-day a {
    display: flex; flex-direction: column; gap: 6px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px; color: var(--text); text-decoration: none;
    transition: border-color .15s, transform .12s;
}
.calendar-day a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.cal-date { font-weight: 700; }
.archive-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }

/* ============================================================
   RANKING (página)
   ============================================================ */
.rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.rank-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.rank-card h2 { font-size: 1rem; margin: 0 0 12px; color: var(--accent); font-weight: 700; }
.rank-list { list-style: none; counter-reset: r; padding: 0; margin: 0; }
.rank-list li {
    counter-increment: r; display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border);
}
.rank-list li:last-child { border-bottom: none; }
.rank-list li::before { content: counter(r); width: 22px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.rank-flag { font-size: 1.2rem; }
.rank-name { flex: 1; font-size: .9rem; }
.rank-val  { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }

/* ============================================================
   ERROR
   ============================================================ */
.error-page { text-align: center; padding: 60px 0; }
.error-code { font-size: 4rem; margin: 0; color: var(--accent); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-md);
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    animation: rise .2s ease;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.modal-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--muted); line-height: 1; padding: 0 4px;
    transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; }
.rules-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.rules-list li { display: flex; gap: 14px; align-items: flex-start; }
.rules-ico { font-size: 1.5rem; flex-shrink: 0; margin-top: 1px; }
.rules-list strong { font-size: .95rem; display: block; margin-bottom: 2px; }
.rules-list .muted { font-size: .85rem; line-height: 1.4; }

/* Share button used state */
.share-btn.used { opacity: .4; cursor: not-allowed; pointer-events: none; }
.share-btn.used:hover { transform: none; }

/* Comment toggle disabled */
.comment-toggle-btn.already-commented {
    opacity: .6; cursor: default; pointer-events: none;
    background: var(--bg);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--text); color: rgba(255,255,255,.75);
    margin-top: 40px; padding: 40px 24px 24px;
}
.footer-inner {
    max-width: var(--maxw); margin: 0 auto;
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
}
.footer-brand .brand { color: #fff; margin-bottom: 10px; }
.footer-brand .brand-name { color: #fff; }
.footer-tagline { font-size: .85rem; color: rgba(255,255,255,.55); margin: 0 0 16px; line-height: 1.5; }
.footer-social { display: flex; gap: 8px; margin-top: 12px; }
.footer-social a {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.7);
    font-size: .85rem; transition: background .15s;
}
.footer-social a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.footer-col h4 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.45); margin: 0 0 12px; }
.footer-col a { display: block; color: rgba(255,255,255,.65); font-size: .88rem; margin-bottom: 8px; transition: color .15s; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
    max-width: var(--maxw); margin: 28px auto 0; padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    font-size: .8rem; color: rgba(255,255,255,.4);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
    background: var(--text); color: #fff;
    padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow-md); opacity: 0;
    transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none; max-width: 90vw;
    font-size: .9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.ok    { background: var(--ok); }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 20px; }
.admin-login { max-width: 360px; margin: 60px auto; }
.admin-nav { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.admin-nav a { color: var(--muted); font-size: .9rem; }
.admin-nav a.active { color: var(--text); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.stat-card .num { font-size: 1.8rem; font-weight: 700; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.admin-form .input { max-width: 420px; }
.badge-tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }

/* ============================================================
   FLAG ICONS
   ============================================================ */
.fi { vertical-align: middle; font-size: 1.25em; }
.rank-flag .fi { font-size: 1.35em; }
.flag .fi { font-size: 1.2em; }
.metric-icon .fi { font-size: 2rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .metric-cards { grid-template-columns: 1fr 1fr; }
    .metric-cards .country-card { grid-column: span 2; }
    .home-panels { grid-template-columns: 1fr 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
    .rank-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .metric-cards { grid-template-columns: 1fr; }
    .metric-cards .country-card { grid-column: span 1; }
    .home-panels { grid-template-columns: 1fr; }
    .action-bar { grid-template-columns: 1fr 1fr; }
    .action-bar .btn-action { display: flex; }
    .message-text { font-size: 1.45rem; }
    .stats-row .stat-item { padding: 10px 8px; }
    .form-grid { grid-template-columns: 1fr; }
    .top-nav { display: none; }
    .footer-inner { grid-template-columns: 1fr; }
    .site-main { padding: 16px 16px 50px; }
    .message-card { padding: 24px 20px 20px; }
    .footer-bottom { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
    .stats-row { flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
    .stats-row .stat-item { flex-direction: row; justify-content: space-between; border-right: none; border-bottom: 1px solid var(--border); }
    .stats-row .stat-item:last-child { border-bottom: none; }
}
