@media print {
  @page {
    size: A4 portrait;
    margin: 0.8cm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html {
    font-size: 8pt;
  }

  body {
    background: none;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .toolbar,
  .portrait-upload,
  .btn,
  .btn-small,
  .btn-remove,
  .col-actions,
  .theme-group,
  .lang-group,
  #btn-add-skill,
  #btn-add-weapon,
  #btn-add-equipment,
  #btn-add-trait,
  #btn-add-inventory,
  #btn-add-language {
    display: none !important;
  }

  .sheet-wrapper {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-width: 2px;
    overflow: visible;
  }

  .frame-ornament {
    font-size: 0.65rem;
  }

  /* Layout principal en impresión */
  .character-sheet {
    display: grid !important;
    grid-template-columns: 24% 76% !important;
    gap: 0.35rem !important;
    align-items: start !important;
    width: 100% !important;
  }

  .portrait-column {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
  }

  .content-column {
    gap: 0.35rem !important;
    min-width: 0 !important;
  }

  .content-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.35rem !important;
    align-items: start !important;
  }

  /* Etiquetas de tarjeta: sin solapamiento absoluto */
  .card {
    position: relative !important;
    break-inside: auto;
    page-break-inside: auto;
    overflow: visible !important;
    padding: 0.5rem 0.35rem 0.35rem !important;
    margin-top: 0 !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
    box-shadow: 1px 1px 0 0 var(--color-border, #3b2418) !important;
  }

  .card-label {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 0.3rem 0 !important;
    padding: 0.2rem 0.35rem !important;
    font-size: 0.32rem !important;
    text-align: center;
    white-space: normal !important;
  }

  /* Solo evitar corte en elementos pequeños */
  .stat-card,
  .hp-heart,
  .competence-item,
  .skill-item,
  .passive-stat {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .stat-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Salto de página antes de armas/combate */
  .print-page-break {
    break-before: page;
    page-break-before: always;
  }

  .card-weapons,
  .card-equipment,
  .card-traits,
  .card-spell-slots,
  .card-inventory,
  .card-notes,
  .card-languages {
    grid-column: 1 / -1 !important;
  }

  .card-hp,
  .card-passive {
    grid-column: span 1 !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.2rem !important;
  }

  .stat-card {
    padding: 0.25rem !important;
    aspect-ratio: auto !important;
  }

  .stat-card-value {
    font-size: 1.1rem !important;
  }

  .stat-card-icon {
    font-size: 0.85rem !important;
  }

  .stat-card-name {
    font-size: 0.55em !important;
  }

  .hp-row {
    gap: 1rem !important;
    margin: 0.35rem 0 !important;
  }

  .hp-heart-display {
    width: 3.5rem !important;
    height: 2.75rem !important;
  }

  .hp-heart-icon {
    font-size: 1.75rem !important;
  }

  .hp-value {
    font-size: 0.9rem !important;
    top: 46% !important;
  }

  .secondary-stats {
    gap: 0.35rem !important;
    padding-top: 0.35rem !important;
    margin-top: 0.25rem !important;
  }

  .header-fields {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.25rem !important;
  }

  .competence-item,
  .skill-item,
  .dynamic-list-item,
  .weapon-row {
    padding: 0.05rem 0 !important;
    font-size: 0.85em !important;
  }

  .inline-input,
  .inline-textarea,
  .stat-card-value,
  .hp-value,
  .currency-input,
  .spell-slot-count {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    font-size: inherit !important;
  }

  .inline-select,
  .skill-name-select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
    padding: 0 !important;
    font-size: inherit !important;
    width: auto !important;
    max-width: 100% !important;
  }

  .header-custom,
  .skill-custom-input {
    display: none !important;
  }

  .inline-textarea {
    min-height: 45px !important;
    max-height: 80px !important;
    resize: none !important;
    overflow: hidden !important;
    font-size: 0.8em !important;
  }

  .card-notes .inline-textarea {
    min-height: 55px !important;
  }

  .portrait-frame {
    max-height: 120px !important;
  }

  .portrait-placeholder {
    font-size: 2rem !important;
  }

  .weapon-row select.no-print {
    display: none !important;
  }

  .weapon-row .print-only {
    display: inline !important;
    font-size: 0.8em !important;
  }

  .spell-slots-grid {
    gap: 0.25rem !important;
  }

  .currency-row {
    gap: 0.35rem !important;
    margin-bottom: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
}
