/* Complementos: modal de desbloqueo, modo de demostración y contenido del lector. */
.upgrade-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(8, 6, 4, 0.78); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: bpFade .2s ease; }
.upgrade-modal { position: relative; width: 100%; max-width: 440px; background: linear-gradient(180deg, var(--bg-card2), var(--bg-card)); border: 1px solid var(--border); border-radius: 18px; padding: 34px 30px 26px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(var(--gold-rgb), .08) inset; animation: bpRise .25s ease; }
.upgrade-modal h2 { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.25; margin: 10px 0 10px; }
.upgrade-modal p { color: var(--muted); font-size: .92rem; }
.upgrade-icon { display: flex; margin-left: auto; margin-right: auto; width: 52px; height: 52px; border-radius: 50%; align-items: center; justify-content: center; color: var(--gold); background: rgba(var(--gold-rgb), .1); border: 1px solid rgba(var(--gold-rgb), .35); margin-bottom: 14px; }
.upgrade-price { font-family: var(--font-num); font-weight: 900; font-size: 2rem; margin: 16px 0 4px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.upgrade-cta { margin-top: 18px; width: 100%; justify-content: center; }
.upgrade-note { font-size: .76rem !important; color: var(--faint) !important; margin-top: 14px; }
.upgrade-close { position: absolute; top: 12px; right: 12px; background: transparent; border: 0; color: var(--faint); cursor: pointer; padding: 6px; border-radius: 8px; }
.upgrade-close:hover { color: var(--text); background: var(--bg-card3); }
button.tool-card { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tool-card:hover { transform: none; border-color: var(--gold); }
.tool-card:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* Retorno único, en el mismo flujo y alineación del contenido. */
.page-back { display: inline-flex; justify-content: flex-start; height: auto; min-height: 36px; padding: 6px 0; margin: 0 0 24px; background: transparent; border: 0; border-radius: 4px; font: inherit; font-size: .9rem; color: var(--muted); white-space: normal; text-align: left; }
.page-back:hover { background: transparent; color: var(--gold-light); }
.page-back svg { width: 16px; height: 16px; flex-shrink: 0; }
.reader-page { max-width: 1080px; margin: 0 auto; padding: 40px 24px 60px; }
.reader-page > .reader-layout { max-width: none; padding: 0; margin: 0; }
.content-library, .library-reading { padding-top: 40px; }

/* Conserva el selector nativo accesible con una flecha interior uniforme. */
.select-field { position: relative; width: 100%; min-width: 0; color: var(--muted); }
.select-field select { appearance: none; -webkit-appearance: none; padding-right: 46px; cursor: pointer; }
.select-field > svg { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; pointer-events: none; }
.select-field:focus-within { color: var(--gold-light); }
.select-field select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.demo-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 5px; border: 1px dashed var(--border); border-radius: 999px; font-size: .75rem; flex-wrap: wrap; justify-content: center; }
.demo-toggle-label { color: var(--faint); padding: 0 8px; text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; }
.demo-toggle button { background: transparent; border: 0; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit; }
.demo-toggle button.is-on { background: var(--gold-grad); color: var(--on-gold); font-weight: 600; }
.dashboard-footer .demo-row { display: block; }

.history-list { list-style: none; display: grid; gap: 8px; margin-top: 12px; }
.history-list button { width: 100%; text-align: left; background: var(--bg-card2); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-size: .88rem; }
.history-list button:hover { border-color: rgba(var(--gold-rgb), .5); }
.history-list small { display: block; color: var(--faint); font-size: .74rem; }
.history-block { margin-top: 28px; }
.history-block h3 { font-family: var(--font-display); font-size: 1.05rem; }

@keyframes bpFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes bpRise { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@media print { .upgrade-overlay, .demo-toggle { display: none !important; } }

/* Resultado generado: jerarquía y contraste como el producto de referencia */
.result-box { line-height: 1.75; }
.result-box h2 { font-size: 1.22rem; margin: 26px 0 10px; }
.result-box h3 { font-weight: 700; font-size: 1rem; margin: 18px 0 8px; }
.result-box h4 { color: var(--gold-light); font-size: .95rem; font-weight: 600; margin: 14px 0 6px; }
.result-box p { margin-bottom: 12px; }
.result-box li { margin-bottom: 8px; }
.result-box li::marker { color: var(--gold); }
@media print { body.tool-body-page .result-box h4 { color: var(--bg-card); } }

/* ── Barra de acciones del resultado (simétrica en todos los tamaños) ── */
.result-actions.active { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 18px; }
.result-actions-copy { min-width: 0; text-align: center; }
.result-actions-copy strong { font-size: .95rem; }
.result-actions-copy span { font-size: .8rem; }
.result-actions-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.result-actions-btns > button { width: 100%; min-width: 0; min-height: 46px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 12px; }
.result-actions-btns svg { flex-shrink: 0; }
@media (max-width: 640px) { .result-actions-btns { grid-template-columns: 1fr; } }
.export-menu { min-width: 230px; background: var(--bg-card2); color: var(--text); border-color: var(--border); padding: 6px; border-radius: 8px; }
.export-menu [role="menuitem"][data-highlighted] { background: var(--bg-card3); color: var(--gold-light); }
.export-menu [data-slot="dropdown-menu-label"], .export-menu > div:not([role]) { color: var(--gold-light); font-size: .76rem; padding: 8px 12px; }
.export-menu [role="separator"] { background: var(--border); }
.export-menu [role="menuitem"] { gap: 10px; padding: 10px 12px; cursor: pointer; font-size: .86rem; }
.export-menu svg { width: 16px; height: 16px; }

/* ── Historial guardado ── */
.history-head { display: grid; grid-template-columns: minmax(0,1fr) minmax(0, 260px); gap: 12px; align-items: center; }
.history-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.history-head h3 span { font: 700 .72rem var(--font-num); color: var(--on-gold); background: var(--gold-grad); border-radius: 999px; padding: 2px 9px; }
.history-search { display: flex; align-items: center; gap: 8px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; }
.history-search svg { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }
.history-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); padding: 10px 0; font: inherit; font-size: .86rem; }
.history-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 8px 6px 4px; }
.history-item:hover { border-color: rgba(var(--gold-rgb), .5); }
.history-list .history-open { background: transparent; border: 0; padding: 8px 10px; min-width: 0; }
.history-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.history-actions { display: flex; gap: 6px; }
.history-icon-btn { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; color: var(--gold-light); background: transparent; }
.history-icon-btn svg { width: 16px; height: 16px; }
.history-icon-btn.danger { color: var(--muted); }
.history-icon-btn.danger:hover { color: #e57373; border-color: #e57373; }
.history-empty { color: var(--faint); font-size: .86rem; margin-top: 14px; text-align: center; }
.history-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; color: var(--muted); font-size: .82rem; }
.history-pager button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--gold-light); cursor: pointer; }
.history-pager button:disabled { opacity: .35; cursor: default; }
.history-pager svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .history-head { grid-template-columns: 1fr; } }

/* Impresión directa (Ctrl+P): solo el contenido */
@media print {
  body.tool-body-page .tool-form-card > form,
  body.tool-body-page .tool-form-card > [role="alert"],
  body.tool-body-page .history-block { display: none !important; }
}

/* Favoritos dentro de los contenidos + tarjetas con vista previa */
.btn-copy-all.is-fav { background: rgba(var(--gold-rgb), .16); border-color: var(--gold); color: var(--gold-light); }
.btn-copy-all.is-fav svg, .history-fav-dot svg, .history-filter .on svg { fill: currentColor; }
.history-filter { display: inline-flex; gap: 4px; margin-top: 12px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card2); }
.history-filter button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 7px; cursor: pointer; font: 700 .78rem var(--font-num); }
.history-filter button.on { background: var(--gold-grad); color: var(--on-gold); }
.history-filter svg { width: 14px; height: 14px; }
.history-item { align-items: start; padding: 6px 6px 6px 4px; }
.history-item.current { border-color: var(--gold); }
.history-list .history-open { display: grid; gap: 4px; text-align: left; cursor: pointer; }
.history-title { display: flex !important; align-items: center; gap: 6px; color: var(--text); }
.history-fav-dot { color: var(--gold); display: inline-flex; flex-shrink: 0; }
.history-fav-dot svg { width: 14px; height: 14px; }
.history-preview { color: var(--muted); font-size: .8rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-icon-btn .dots { font-size: 1.2rem; line-height: 1; }
.history-icon-btn { margin-top: 4px; }
.menu-danger { color: #e57373 !important; }
.tool-print-document { scroll-margin-top: 90px; }

/* Cerrar contenido: discreto, como los paneles de apps grandes */
.result-wrap { position: relative; }
.result-close-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--faint); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.result-close-x:hover, .result-close-x:focus-visible { background: var(--bg-card2); color: var(--gold-light); border-color: var(--border); outline: none; }
.result-close-x svg { width: 17px; height: 17px; }
.result-new-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px auto 0; background: transparent; border: 0; color: var(--muted); font: 600 .8rem var(--font-num); cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.result-new-link:hover { color: var(--gold-light); }
.result-new-link svg { width: 15px; height: 15px; }
@media print { .result-close-x, .result-new-link { display: none !important; } }

/* Bibliotecas individuais e leitores com índice lateral em fluxo normal. */
.reader-layout { grid-template-columns: 280px minmax(0, 1fr); }
.reader-layout .ebook-sidebar { position: static; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 0 22px 0 0; border-right: 1px solid var(--border); }
.reader-layout .ebook-sidebar h1 { overflow-wrap: anywhere; }
.reader-chapter-btn { display: flex; align-items: baseline; justify-content: flex-start; gap: 10px; width: 100%; height: auto; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: .88rem; color: var(--muted); white-space: normal; text-align: left; }
.reader-chapter-btn > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.reader-chapter-btn:hover { background: var(--bg-card2); color: var(--text); }
.reader-chapter-btn.active { background: var(--bg-card2); color: var(--gold-light); }
.reader-chapter-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.reader-chapter-star { flex-shrink: 0; align-self: center; color: var(--gold-light); }
.reader-chapter-star svg { fill: currentColor; }
.reader-filters { display: flex; width: 100%; margin: 0 0 12px; border-radius: 8px; }
.reader-filters button { flex: 1; justify-content: center; height: auto; min-height: 36px; padding: 7px 8px; white-space: nowrap; }
.reader-favorites-empty { color: var(--muted); font-size: .84rem; padding: 12px 0; }
.ebook-tools .reader-favorite.active-fav { background: transparent; border-color: var(--border); }
.reader-favorite[aria-pressed="true"] svg { fill: currentColor; }
.export-menu { max-width: calc(100vw - 32px); }
.library-topic select { width: 100%; min-width: 0; background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 11px 46px 11px 12px; font: inherit; font-size: .86rem; cursor: pointer; }
.reader-layout .ebook-content { background: transparent; border: 0; border-radius: 0; padding: 0; }
.ebook-content-head { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.ebook-tools { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.ebook-tools .icon-btn { flex-shrink: 0; }
.reader-command { background: transparent; border: 1px solid var(--border); color: var(--gold-light); box-shadow: none; font: 600 .83rem var(--font-num); border-radius: 8px; padding: 8px 12px; height: auto; min-height: 36px; }
.reader-command:hover { background: var(--bg-card2); border-color: var(--gold); }
.icon-btn.active-fav { color: var(--gold-light); border-color: var(--gold); background: var(--bg-card2); }
.icon-btn.active-fav svg { fill: currentColor; }
.content-library { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.library-heading { margin-bottom: 26px; }
.library-heading h1 { font: 400 2rem/1.2 var(--font-display); margin: 8px 0 10px; overflow-wrap: anywhere; }
.library-heading p, .library-count { color: var(--muted); font-size: .84rem; }
.library-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px) auto; align-items: end; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.library-search { border-radius: 8px; min-height: 44px; }
.library-search input { padding: 12px 0; }
.library-topic { min-width: 0; }
.library-topic > span { display: block; color: var(--muted); font-size: .75rem; margin-bottom: 6px; }
.library-controls .history-filter { margin: 0; border-radius: 8px; min-height: 44px; }
.library-count { margin: 18px 0; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.library-card { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); transition: border-color .15s; }
.library-card:hover, .library-card:focus-within { border-color: var(--gold); }
.library-card .library-card-open { display: flex; align-items: stretch; justify-content: flex-start; flex-direction: column; width: 100%; height: 100%; min-height: 264px; padding: 22px; border-radius: 8px; white-space: normal; text-align: left; gap: 14px; background: transparent; color: var(--text); }
.library-card-category { color: var(--gold-light); font: 700 .7rem/1.4 var(--font-num); padding-right: 32px; }
.library-card h2 { font: 400 1.25rem/1.3 var(--font-display); min-height: 3.9em; overflow-wrap: anywhere; }
.library-preview { color: var(--muted); font-size: .85rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.library-card-bottom { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: auto; font-size: .78rem; color: var(--gold-light); }
.library-card-bottom .history-fav-dot { margin-left: auto; }
.library-card-menu { position: absolute; right: 12px; top: 12px; font-size: 1.3rem; }
.library-reading { max-width: 860px; margin: 0 auto; padding: 28px 24px 60px; }
.library-return { margin: 0 0 26px; }
.library-reading > .library-return:last-child { margin: 28px 0 0; }
.library-reading-title { font: 400 1.9rem/1.25 var(--font-display); color: var(--gold-light); margin: 0 0 24px; overflow-wrap: anywhere; outline: none; }
.library-empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.library-empty > svg { margin: 0 auto 16px; color: var(--gold); }
.library-empty h2 { font: 400 1.3rem var(--font-display); margin-bottom: 20px; }
.reader-layout .ebook-footer-nav { display: grid; grid-template-columns: auto minmax(0,1fr) auto; }
.reader-layout .ebook-nav-current { text-align: center; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .reader-layout .ebook-sidebar { padding: 0 0 20px; border-right: 0; border-bottom: 1px solid var(--border); }
  .library-controls { grid-template-columns: minmax(0,1fr) minmax(0, 240px); }
  .library-controls .history-filter { grid-column: 1 / -1; justify-self: start; }
  .library-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .reader-page { padding: 28px 16px 40px; }
  .library-grid, .library-controls { grid-template-columns: minmax(0,1fr); }
  .content-library, .library-reading { padding: 24px 16px 40px; }
  .library-heading h1 { font-size: 1.65rem; }
  .library-card .library-card-open { min-height: 250px; }
  .library-card h2 { min-height: 0; }
  .ebook-content-head { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .ebook-tools { justify-content: flex-start; }
  .library-reading-title { font-size: 1.6rem; }
  .reader-layout .ebook-footer-nav { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .reader-layout .ebook-nav-current { grid-column: 1 / -1; grid-row: 1; }
  .reader-layout .ebook-nav-btn { justify-content: center; padding: 10px; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .library-card { transition: none; } }
@media print {
  .reader-layout .ebook-sidebar, .ebook-content-head, .ebook-footer-nav, .reader-feedback, .module-complete-panel, .library-return, .back-link, .inner-header { display: none !important; }
  .reader-page { max-width: none; padding: 0; }
  .reader-layout, .library-reading { display: block; max-width: none; padding: 0; }
}

/* Favoritos unificados: vista previa acotada y biblioteca sin carrusel. */
.dashboard-main .favorites-section { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
.favorites-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.favorite-card { position: relative; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; }
.favorite-card:hover, .favorite-card:focus-within { border-color: var(--gold); }
.favorite-card-open { display: flex; flex-direction: column; gap: 12px; min-height: 292px; height: 100%; padding: 22px; color: var(--text); border-radius: 8px; }
.favorite-card-open:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.favorite-kind { display: flex; align-items: center; gap: 7px; padding-right: 64px; color: var(--gold-light); font-size: .73rem; }
.favorite-card h2 { font: 500 1.2rem/1.35 var(--font-display); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.favorite-collection { color: var(--faint); font-size: .74rem; overflow-wrap: anywhere; }
.favorite-card-bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted); }
.favorite-card-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 2px; }
.favorite-card-actions button { width: 32px; height: 32px; background: transparent; color: var(--gold-light); padding: 0; border-radius: 4px; }
.favorite-card-actions button:hover { background: var(--bg-card2); }
.favorite-star svg { fill: currentColor; }
.favorite-more { font-size: 1.35rem; }
.favorites-controls { display: grid; grid-template-columns: minmax(0, 1fr) 200px 190px; gap: 16px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.favorites-view-all { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: normal; }
.favorites-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); margin: 16px 0; font-size: .86rem; }
@media (max-width: 1050px) { .favorites-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .favorites-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } .favorites-controls > .history-search { grid-column: 1 / -1; } }
@media (max-width: 600px) { .favorites-grid { grid-template-columns: minmax(0, 1fr); } .favorites-section .section-head { flex-wrap: wrap; gap: 14px; } .favorite-card-open { min-height: 264px; padding: 20px; } .favorites-controls { grid-template-columns: minmax(0, 1fr); } .favorites-controls > .history-search { grid-column: auto; } .favorites-notice { flex-wrap: wrap; } }

/* ── Perfil (topbar) ── */
.pf-trigger { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); cursor: pointer; font: inherit; transition: border-color .15s; max-width: 240px; }
.pf-trigger:hover, .pf-trigger[data-state="open"] { border-color: var(--gold); }
.pf-trigger svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.pf-trigger-name { font-size: .86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 620px) { .pf-trigger-name, .pf-trigger > svg { display: none; } .pf-trigger { padding: 0; border: 0; background: none; } }
.pf-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; overflow: hidden; border: 1.5px solid var(--gold); background: radial-gradient(circle at 50% 30%, var(--bg-card3), var(--bg-deep)); }
.pf-avatar-sm { width: 34px; height: 34px; } .pf-avatar-lg { width: 96px; height: 96px; border-width: 2px; }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.pf-avatar-edit { position: relative; margin: 0 auto; }
.pf-pencil { position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg-card, var(--bg-deep)); background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--bg-deep); cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.35); transition: transform .15s; }
.pf-pencil:hover { transform: scale(1.08); }
.pf-pop-backdrop { position: fixed; inset: 0; z-index: 5; }
.pf-pop { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 6; min-width: 220px; }
button.pf-menu-item { width: 100%; background: none; border: 0; font: inherit; text-align: left; }
button.pf-menu-item:hover, button.pf-menu-item:focus-visible { background: var(--bg-card2); }
.pf-menu { z-index: 80; min-width: 260px; max-width: calc(100vw - 24px); background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.pf-menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.pf-menu-id { display: flex; flex-direction: column; min-width: 0; }
.pf-menu-id strong { color: var(--text); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-menu-id span { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; color: var(--text); font-size: .88rem; cursor: pointer; outline: none; }
.pf-menu-item svg { width: 17px; height: 17px; color: var(--gold-light); }
.pf-menu-item[data-highlighted] { background: var(--bg-card2); }
.pf-danger svg { color: var(--muted); }
.pf-menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pf-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.65); backdrop-filter: blur(3px); }
.pf-dialog { position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 26px; color: var(--text); }
.pf-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.pf-close svg { width: 16px; height: 16px; }
.pf-title { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 20px; }
.pf-photo-row { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.pf-photo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.pf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card2); color: var(--text); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; transition: border-color .15s; }
.pf-btn:hover { border-color: var(--gold); }
.pf-btn svg { width: 16px; height: 16px; color: var(--gold-light); }
.pf-btn-ghost { background: none; color: var(--muted); }
.pf-btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--bg-deep); border-color: transparent; }
.pf-error { color: var(--gold-light); font-size: .84rem; margin: -6px 0 12px; }
.pf-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pf-field span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.pf-field input { min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-deep); color: var(--text); font: inherit; font-size: .92rem; outline: none; }
.pf-field input:focus { border-color: var(--gold); }
.pf-field input:disabled { color: var(--muted); }
.pf-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
@media (max-width: 420px) { .pf-dialog { padding: 22px 18px; } .pf-photo-row { flex-direction: column; align-items: stretch; text-align: center; } .pf-photo-row .pf-avatar-lg { align-self: center; } }
.pf-crop { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pf-crop-hint { margin: 0; color: var(--muted); font-size: .84rem; text-align: center; }
.pf-crop-view { position: relative; overflow: hidden; border-radius: 16px; background: var(--bg-deep); touch-action: none; cursor: grab; user-select: none; max-width: 100%; }
.pf-crop-view:active { cursor: grabbing; }
.pf-crop-view img { position: absolute; left: 50%; top: 50%; max-width: none; pointer-events: none; }
.pf-crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.55); border: 2px solid var(--gold); pointer-events: none; }
.pf-crop-zoom { display: flex; align-items: center; gap: 10px; width: 260px; max-width: 100%; color: var(--gold-light); font-weight: 700; }
.pf-crop-zoom input { flex: 1; accent-color: var(--gold); }
.pf-crop .pf-footer { width: 100%; }
