:root {
    --bg: #0B0E14;
    --panel: #131826;
    --panel-raised: #191F30;
    --gold: #C9A227;
    --gold-bright: #E8C766;
    --ember: #8B2E2E;
    --text: #E8E3D3;
    --text-muted: #7C8497;
    --line: #262E42;
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    background: var(--bg);
    background-image:
      radial-gradient(ellipse 900px 500px at 50% -10%, rgba(201,162,39,0.08), transparent 60%);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
  }

  header {
    text-align: center;
    padding: 48px 20px 32px;
    border-bottom: 1px solid var(--line);
  }

  header .eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--gold);
    text-transform: uppercase;
  }

  header h1 {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 42px;
    margin: 8px 0 4px;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
  }

  header p {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
  }

  .layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 680px) 200px;
    gap: 24px;
    max-width: 1180px;
    margin: 36px auto;
    padding: 0 20px;
    align-items: start;
  }

  .ad-rail {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  @media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; }
    .ad-rail { display: none; }
  }

  .ad-slot {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 6px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
  }

  .ad-slot span { display: block; color: var(--gold); font-size: 11px; letter-spacing: 1px; margin-bottom: 6px; }

  .ad-slot.ad-banner {
    padding: 0;
    display: block;
    border: 1px solid var(--line);
    overflow: hidden;
  }
  .ad-slot.ad-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

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

  .feed-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-bright);
    margin: 0;
    letter-spacing: 0.5px;
  }

  #post-count { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); }

  button.primary {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #14100a;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 5px;
    cursor: pointer;
  }
  button.primary:hover { filter: brightness(1.08); }
  button.primary:disabled {
    background: var(--panel-raised);
    color: var(--text-muted);
    cursor: not-allowed;
    filter: none;
  }

  /* Formulario de publicación */
  #post-form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    display: none;
  }
  #post-form.open { display: block; }

  #post-form .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #post-form .grid.full { grid-template-columns: 1fr; }

  #post-form label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
  }

  #post-form input, #post-form textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 9px 10px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    margin-bottom: 12px;
  }
  #post-form input:focus, #post-form textarea:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
  #post-form textarea { resize: vertical; min-height: 60px; }

  /* Feed de publicaciones */
  .post-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: 6px;
    padding: 18px 20px;
    margin-bottom: 14px;
    animation: appear 0.5s ease;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
  }

  /* Niveles de brillo según likes, tipo rareza de item en MU */
  .post-card.tier-1 { border-color: var(--gold-bright); box-shadow: 0 0 12px -2px rgba(201,162,39,0.35); }
  .post-card.tier-2 { border-color: #7FD9C4; box-shadow: 0 0 18px -2px rgba(127,217,196,0.45); }
  .post-card.tier-3 {
    border-color: #E8556B;
    box-shadow: 0 0 26px -2px rgba(232,85,107,0.55);
    animation: pulse-glow 2.2s ease-in-out infinite;
  }

  @keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px -2px rgba(232,85,107,0.45); }
    50% { box-shadow: 0 0 32px 0px rgba(232,85,107,0.75); }
  }

  .like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 4px 2px;
  }
  .like-btn svg { width: 15px; height: 15px; stroke: var(--text-muted); fill: none; transition: all 0.2s ease; }
  .like-count:hover { text-decoration: underline; }
  .like-btn:hover svg { stroke: var(--ember); }
  .like-btn.liked svg { stroke: #E8556B; fill: #E8556B; }
  .like-btn.liked { color: #E8556B; }

  @keyframes appear {
    from { opacity: 0; transform: translateY(-8px); background: rgba(201,162,39,0.12); }
    to { opacity: 1; transform: translateY(0); }
  }

  .post-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
  }

  .post-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-bright);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .post-time { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }

  .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

  .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 3px 8px;
    border-radius: 3px;
  }
  .badge b { color: var(--gold); }

  .post-desc { font-size: 14px; color: var(--text); line-height: 1.5; margin-bottom: 6px; white-space: pre-wrap; }

  .read-more {
    background: none;
    border: none;
    color: var(--gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 12px;
    display: block;
  }
  .read-more:hover { color: var(--gold-bright); text-decoration: underline; }

  .hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
  }

  .cf-turnstile { margin-bottom: 14px; }

  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(2px);
    z-index: 100;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal-box {
    position: relative;
    background: var(--panel-raised);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 28px;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modal-in 0.2s ease;
  }
  @keyframes modal-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
  }
  .modal-close:hover { color: var(--gold-bright); }
  #likes-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
  #likes-list .liker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--gold-bright);
    padding: 6px 10px;
    background: var(--bg);
    border-radius: 4px;
  }
  .auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
  .auth-tab {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text-muted);
    padding: 7px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
  }
  .auth-tab.active { border-color: var(--gold); color: var(--gold-bright); }
  .modal-box input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 9px 10px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    margin-bottom: 10px;
  }
  .auth-error { color: #E8556B; font-size: 12px; margin-bottom: 8px; min-height: 14px; }

  #forgot-password-link {
    display: block;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    margin: 10px auto 0;
    text-align: center;
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
  }
  #forgot-password-link:hover { color: var(--gold-bright); text-decoration: underline; }

  .user-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
  }
  .user-bar b { color: var(--gold-bright); }
  .user-bar button {
    background: none;
    border: 1px solid var(--line);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
  }

  .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 4px;
  }
  .checkbox-row input { width: auto; margin: 0; accent-color: var(--gold); }
  #post-form .checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    background: none;
    border: 1px solid var(--line);
    padding: 0;
    margin: 0;
  }

  .launching-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #0B0E14;
    background: linear-gradient(90deg, #7FD9C4, #A8E6D5);
    padding: 3px 9px;
    border-radius: 3px;
    font-weight: 600;
    animation: badge-pulse 1.8s ease-in-out infinite;
  }
  @keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
  }

  .post-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

  .web-copy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--gold-bright);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .web-copy:hover { border-color: var(--gold); }

  .post-links a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    margin-left: 12px;
  }
  .post-links a:hover { color: var(--gold-bright); }

  .own-delete-btn {
    background: none;
    border: none;
    color: #E8556B;
    font-size: 12px;
    cursor: pointer;
    margin-left: 12px;
    font-family: 'Inter', sans-serif;
    padding: 0;
  }
  .own-delete-btn:hover { text-decoration: underline; }

  .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    border: 1px dashed var(--line);
    border-radius: 8px;
  }

/* ===== Estilos compartidos del panel admin y páginas de cuenta ===== */
.admin-wrap { max-width: 640px; margin: 60px auto; padding: 0 20px; }
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.login-box h2 { font-family: 'Cinzel', serif; color: var(--gold-bright); margin-top: 0; }
.login-box input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  margin-bottom: 12px;
}
.login-error { color: #E8556B; font-size: 13px; margin-bottom: 10px; display: none; }
.admin-post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.admin-post-info { font-size: 13px; }
.admin-post-info b { color: var(--gold-bright); font-family: 'Cinzel', serif; }
.admin-post-info .meta { color: var(--text-muted); font-size: 11px; font-family: 'JetBrains Mono', monospace; margin-top: 3px; }
.delete-btn {
  background: none;
  border: 1px solid var(--ember);
  color: #E8556B;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.delete-btn:hover { background: var(--ember); color: var(--text); }
#logout-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}
