/* ================= Utilidades varias ================= */
.inline-ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em; }
.card-link { display: block; border-radius: var(--radius); }
.card:focus-within .cover { box-shadow: 0 0 0 2px var(--accent), 0 0 30px var(--accent-glow); }
.card-link:focus-visible { outline: none; }
.progress { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent-grad); box-shadow: 0 0 8px var(--accent-glow); }
.continue-card .progress { margin-top: 10px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-height: 32px; }
.link-btn:hover, .link-btn.is-on { color: var(--accent); }
.link-btn svg { width: 15px; height: 15px; }
.link-btn.is-on svg { fill: currentColor; }
.fav-btn.is-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.fav-btn.is-on svg { fill: currentColor; }
.rtl-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); white-space: nowrap; }
.rtl-badge svg { width: 16px; height: 16px; }
.rtl-badge--compact { padding: 5px 9px; font-size: 11px; }

/* ================= Cuenta (menú) ================= */
.account { position: relative; }
.account-btn { border-radius: 50%; display: block; }
.account-btn .avatar { box-shadow: 0 0 0 2px var(--line-strong), 0 0 16px var(--accent-glow); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 12px); width: 250px; padding: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-2); z-index: 90; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 10px; font-size: 14px; color: var(--text-2); text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.menu-pop svg { width: 18px; height: 18px; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head small { color: var(--muted); font-size: 12px; }

/* ================= Acceso rápido de sección ================= */
.quick-access { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: -36px; position: relative; z-index: 5; }
.quick-access a { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius-lg); background: rgba(21,21,28,0.85); backdrop-filter: blur(14px); border: 1px solid var(--line); transition: border-color 0.25s, transform 0.25s var(--ease); }
.quick-access a:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); transform: translateY(-2px); }
.quick-access svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.quick-access span { font-weight: 700; font-size: 14px; line-height: 1.3; }
.quick-access small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
@media (max-width: 960px) { .quick-access { grid-template-columns: 1fr 1fr; margin-top: 20px; } }
@media (max-width: 420px) { .quick-access a { padding: 12px; gap: 10px; } .quick-access small { display: none; } }

.author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .author-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ================= Encabezados de página ================= */
.page-head { padding-top: clamp(32px, 5vw, 56px); padding-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 14px; }
.page-head p { color: var(--text-2); margin-top: 8px; }
.page-head--genre { position: relative; isolation: isolate; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.page-head--genre::before { content: ""; position: absolute; inset: 0 0 0 0; z-index: -1; background: var(--tile-bg); border-radius: var(--radius-xl); opacity: 0.7; -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent); }
.page-head .genre-icon { width: 36px; height: 36px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
.back-link svg { width: 16px; height: 16px; }
.page-search { max-width: 560px; margin-top: 18px; }
.page-search input { height: 50px; }
.legal { max-width: 760px; padding-top: 48px; display: grid; gap: 20px; }
.legal ul { list-style: disc; padding-left: 20px; display: grid; gap: 10px; color: var(--text-2); }

/* ================= Ficha de obra ================= */
.work { position: relative; }
.work-banner { position: absolute; inset: 0 0 auto 0; height: 520px; z-index: -1; overflow: hidden; opacity: 0.55; }
.work-banner svg { width: 100%; height: 100%; filter: blur(2px) saturate(1.1); }
.work-banner-fade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,11,15,0.3), var(--bg) 92%), linear-gradient(90deg, var(--bg), transparent 40%, transparent 60%, var(--bg)); }
.work-head { display: grid; grid-template-columns: 260px 1fr; gap: clamp(24px, 4vw, 56px); padding-top: clamp(32px, 6vw, 80px); align-items: end; }
.work-cover .cover { border-radius: var(--radius-lg); box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 50px var(--accent-glow); }
.work-title { font-size: clamp(30px, 4.6vw, 56px); font-weight: 800; letter-spacing: -0.025em; margin-top: 14px; }
.work-author { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.work-author a { display: flex; align-items: center; gap: 10px; }
.work-author strong { display: block; font-size: 15px; }
.work-author small { color: var(--muted); font-size: 12.5px; }
.work-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.work-genres a.tag:hover { color: var(--text); border-color: var(--line-strong); }
.work-stats { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 20px 0 0; }
.work-stats dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.work-stats dd { margin: 2px 0 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.work-tagline { margin-top: 18px; font-size: 17px; font-weight: 600; color: var(--text); max-width: 64ch; }
.work-synopsis { margin-top: 8px; color: var(--text-2); max-width: 70ch; }
.work-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; margin-top: 56px; }
.chapter-list { display: grid; gap: 6px; max-height: 720px; overflow-y: auto; padding-right: 4px; }
.chapter-row { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; transition: border-color 0.2s, background 0.2s; }
.chapter-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--surface-2); }
.chapter-row.is-current { border-color: var(--accent); }
.chapter-num { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); font-family: var(--font-display); font-weight: 700; }
.chapter-thumb { width: 74px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; display: block; }
.chapter-info strong { display: block; font-size: 14.5px; }
.chapter-info small { color: var(--muted); font-size: 12.5px; }
.chapter-row .chev { width: 18px; height: 18px; color: var(--muted); }
.chapter-row.is-locked { opacity: 0.85; }
.lock-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--accent-strong); padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); white-space: nowrap; }
.lock-pill svg { width: 13px; height: 13px; }
.work-aside { display: grid; gap: 14px; align-content: start; }
.aside-card { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px; }
.aside-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.aside-card p { color: var(--text-2); font-size: 14px; }
.aside-author { display: flex; gap: 12px; align-items: center; }
.aside-author strong { display: block; }
.aside-author small { color: var(--muted); font-size: 12.5px; }
.aside-protect { grid-template-columns: auto 1fr; align-items: start; }
.aside-protect svg { width: 22px; height: 22px; color: var(--accent); }
.aside-protect p { font-size: 13px; }
@media (min-width: 1360px) { .aside-ad { display: none; } }
@media (max-width: 960px) { .work-body { grid-template-columns: 1fr; } .chapter-list { max-height: 520px; } }
@media (max-width: 700px) {
  .work-head { grid-template-columns: 1fr; text-align: left; }
  .work-cover { width: 56%; max-width: 230px; }
  .work-stats { gap: 10px 22px; }
  .work-stats dd { font-size: 17px; }
  .work .hero-actions .btn-lg { flex: 1 1 auto; }
}

/* ================= Comentarios ================= */
.comments { margin-top: 8px; }
.comment-form { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.comment-login { display: flex; gap: 12px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); margin-bottom: 22px; }
.comment-login a { color: var(--accent); font-weight: 600; }
.comment-login svg { width: 20px; height: 20px; color: var(--accent); }
.comment-list { display: grid; gap: 4px; }
.comment { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.comment-head strong { font-size: 14px; }
.comment-head time { font-size: 12px; color: var(--muted); }
.comment p { margin-top: 4px; color: var(--text-2); overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 16px; margin-top: 4px; }

/* ================= Autenticación ================= */
.auth { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 72px); padding-top: clamp(28px, 5vw, 64px); align-items: start; }
.auth-side { position: sticky; top: calc(var(--header-h) + 32px); padding: 40px; border-radius: var(--radius-xl); overflow: hidden; background: radial-gradient(circle at 20% 20%, rgba(64,253,20,0.14), transparent 50%), radial-gradient(circle at 80% 90%, rgba(250,0,138,0.18), transparent 55%), var(--surface); border: 1px solid var(--line); }
.auth-side h2 { font-size: clamp(26px, 3vw, 38px); font-weight: 800; margin-top: 28px; }
.auth-side p { color: var(--text-2); margin-top: 12px; }
.auth-covers { position: relative; height: 300px; }
.auth-cover { position: absolute; width: 170px; }
.auth-cover .cover { border-radius: var(--radius-lg); box-shadow: 0 24px 50px rgba(0,0,0,0.6), 0 0 40px var(--accent-glow); }
.auth-cover.a { left: 6%; top: 10px; transform: rotate(-7deg); }
.auth-cover.b { left: 40%; top: 40px; transform: rotate(6deg); }
.auth-main { max-width: 480px; width: 100%; }
.auth-logo { margin-bottom: 22px; }
.auth-form h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; margin-bottom: 8px; }
.auth-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.auth-form legend { padding: 0; margin-bottom: 12px; }
.auth-form .field + .field, .auth-form .muted + .field { margin-top: 16px; }
.auth-form > .field:first-of-type { margin-top: 22px; }
.auth-form .btn-block, .auth-form .row-2 { margin-top: 18px; }
.auth-form .check a { color: var(--text); text-decoration: underline; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin-top: 22px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-switch { margin-top: 22px; color: var(--muted); font-size: 14px; text-align: center; }
.auth-switch a { color: var(--text); font-weight: 600; }
.auth-done { padding-top: 60px; }
.stepper { display: flex; gap: 10px; margin-bottom: 26px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.stepper li span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-size: 12px; }
.stepper li.is-active { color: var(--text); border-color: var(--text); }
.stepper li.is-active span { background: var(--text); color: var(--bg); }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-pick label { cursor: pointer; }
.role-pick input { position: absolute; opacity: 0; pointer-events: none; }
.role-pick label > span { display: grid; gap: 4px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--bg-2); transition: border-color 0.2s, box-shadow 0.2s; height: 100%; }
.role-pick label > span svg { width: 22px; height: 22px; color: var(--accent); }
.role-pick strong { font-size: 14.5px; }
.role-pick small { color: var(--muted); font-size: 12px; }
.role-pick input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.role-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-main { margin: 0 auto; } }

/* ================= Perfil / Autor ================= */
.profile-hero { padding-top: clamp(32px, 5vw, 64px); background: radial-gradient(ellipse at 20% 0%, rgba(64,253,20,0.07), transparent 50%), radial-gradient(ellipse at 80% 0%, rgba(250,0,138,0.08), transparent 50%); }
.profile-head, .author-head { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; }
.profile-head h1, .author-head h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 800; margin: 10px 0 6px; display: flex; align-items: center; gap: 10px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 32px 0 0; }
.profile-stats > div { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.profile-stats dd { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; }
.profile-stats dt { color: var(--muted); font-size: 13px; }
.author-hero { position: relative; padding-top: clamp(40px, 7vw, 96px); }
.author-head { grid-template-columns: auto 1fr; align-items: end; }
.author-head .avatar { box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent), 0 0 40px var(--accent-glow); }
.author-bio { color: var(--text-2); max-width: 60ch; margin-top: 10px; }
.verified { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-grad); color: var(--accent-ink); }
.verified svg { width: 16px; height: 16px; }
@media (max-width: 760px) {
  .profile-head, .author-head { grid-template-columns: 1fr; gap: 16px; }
  .profile-stats { grid-template-columns: 1fr 1fr; }
  .profile-stats dd { font-size: 22px; }
}
.history-list { display: grid; gap: 10px; }

/* ================= Estudio ================= */
.studio-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.studio-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.studio-stats > div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.studio-stats svg { grid-row: span 2; width: 26px; height: 26px; color: var(--text-2); }
.studio-stats dd { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.studio-stats dt { color: var(--muted); font-size: 12.5px; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
.studio-work { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.studio-work-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.studio-work h3 { font-size: 18px; margin: 10px 0 2px; }
.studio-work-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.studio-chapters { margin-top: 14px; display: grid; gap: 6px; }
.studio-chapters li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 14px; }
.chapter-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.chapter-editor .hero-actions { margin-top: 14px; }
.status-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status-muted { background: var(--surface-3); color: var(--text-2); }
.status-warn { background: rgba(255,196,0,0.14); color: #ffd666; }
.status-ok { background: rgba(77,225,160,0.14); color: #6ff0b8; }
.status-bad { background: rgba(255,93,93,0.14); color: #ff8a8a; }
.workflow { margin-top: 24px; padding: 20px; border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); }
.workflow h3 { font-size: 15px; margin-bottom: 12px; }
.workflow ol { display: grid; gap: 10px; }
.workflow li { display: flex; gap: 12px; align-items: center; color: var(--text-2); font-size: 14px; }
.studio-new { padding: 22px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); position: sticky; top: calc(var(--header-h) + 20px); }
.genre-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-checks label { cursor: pointer; }
.genre-checks input { position: absolute; opacity: 0; }
.genre-checks span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 13px; color: var(--text-2); }
.genre-checks input:checked + span { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; }
.genre-checks input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload-drop { display: grid; justify-items: center; gap: 8px; padding: 22px; border-radius: var(--radius); border: 1.5px dashed var(--line-strong); color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; transition: border-color 0.2s; position: relative; }
.upload-drop:hover { border-color: var(--accent); color: var(--text-2); }
.upload-drop svg { width: 26px; height: 26px; }
.cover-drop img { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; }
@media (max-width: 1100px) { .studio-grid { grid-template-columns: 1fr; } .studio-new { position: static; } }
@media (max-width: 760px) { .studio-stats { grid-template-columns: 1fr 1fr; } }
