:root {
  --ink: #1a1008;
  --paper: #f5f0e8;
  --paper-dark: #e8e0cc;
  --accent: #8b1a1a;
  --rule: #2a1f0e;
  --rule-light: #6b5a3e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #2a2018;
  font-family: 'Crimson Text', serif;
  color: var(--ink);
  min-height: 100vh;
}

/* ── NAVBAR ─────────────────────────────────────────── */
.nc-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1a1008;
  border-bottom: 2px solid var(--accent);
  z-index: 1000;
  padding: 0;
}

.nc-navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  font-family: 'Inter', sans-serif;
}

.nc-nav-home {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.nc-nav-home:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.nc-nav-icons {
  display: flex;
  gap: 15px;
}

.nc-nav-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-size: 30px;
}

.nc-nav-icon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px) scale(1.1);
}

.nc-nav-icon.active {
  background: rgba(44, 133, 254, 0.69);
  border-color: rgba(44, 133, 254, 0.9);
  box-shadow: 0 0 12px rgba(44, 133, 254, 0.35);
}

@media (max-width: 768px) {
  .nc-navbar-container {
    padding: 13px 10px;
  }
  .nc-nav-home {
    padding: 8px 18px;
    font-size: 16px;
  }
  .nc-nav-icon {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }
  .nc-nav-icons {
    gap: 4px;
  }
}

/* Nasconde editor immediatamente se URL ha ?id= (prima del JS asincrono) */
html.is-view-mode #editor-panel {
  display: none !important;
}
html.is-view-mode #view-mode-cta {
  display: flex !important;
}

/* VIEW MODE CTA */
#view-mode-cta {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: #1a1008;
  border-bottom: 3px solid var(--accent);
  z-index: 100;
  padding: 10px 16px;
  justify-content: center;
  align-items: center;
}
#view-mode-cta .btn-generate {
  text-decoration: none;
  margin-top: 5px;
}

@media (max-width: 768px) {
  #view-mode-cta {
    top: 54px;
  }
}

/* EDITOR PANEL */
#editor-panel {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: #1a1008;
  z-index: 100;
  padding: 10px 14px;
  border-bottom: 3px solid var(--accent);
}

@media (max-width: 768px) {
  #editor-panel {
    top: 54px;
  }
}

.editor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 6px;
}

.editor-row:last-child {
  margin-bottom: 0;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 130px;
}

.field-group label {
  font-family: 'Crimson Text', serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #b8956a;
}

.field-group input {
  background: #2a1f0e;
  border: 1px solid #5a4a2e;
  color: var(--paper);
  padding: 6px 10px;
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.field-group input:focus {
  border-color: var(--accent);
}
.field-group input::placeholder {
  color: #5a4a3e;
}

.api-key-group input {
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 1px;
}

.btn-group {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

.btn {
  padding: 8px 14px;
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  transition: all 0.2s;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .btn-group {
    flex: 1 1 100%;
    align-items: stretch;
  }
  .btn-group .btn {
    flex: 1;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    font-size: 12px;
    padding: 7px 6px;
  }
}

.btn-insert-photo {
  background: #0088cc;
  color: white;
  border: 1px solid #2a5a6a;
}
.btn-insert-photo:hover {
  background: #2a4a5a;
}
.btn-generate {
  background: #cd1111;
  color: white;
}
.btn-generate:hover {
  background: #a52020;
}
.btn-generate:disabled {
  background: #5a2a2a;
  cursor: not-allowed;
  opacity: 0.6;
}
.btn-print {
  background: #3a2f1e;
  color: #b8956a;
  border: 1px solid #5a4a2e;
}
.btn-print:hover {
  background: #4a3f2e;
}

#generate-hint {
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  color: #b8956a;
  padding: 3px 14px 0;
  font-style: italic;
  min-height: 16px;
  text-align: center;
}

#api-notice {
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  color: #7a956a;
  padding: 3px 0 0 2px;
  font-style: italic;
}

#error-msg {
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  color: #e05050;
  padding: 3px 0 0 2px;
  font-style: italic;
  display: none;
}

/* NEWSPAPER */
#newspaper-wrapper {
  padding: 170px 16px 40px;
  display: flex;
  justify-content: center;
}

#newspaper {
  background: var(--paper);
  width: 100%;
  max-width: 900px;
  min-height: 1200px;
  padding: 32px 40px;
  box-shadow:
    0 20px 80px rgba(0, 0, 0, 0.7),
    inset 0 0 100px rgba(0, 0, 0, 0.04);
  position: relative;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 31px,
    rgba(0, 0, 0, 0.03) 31px,
    rgba(0, 0, 0, 0.03) 32px
  );
  outline: 4px double var(--rule);
  outline-offset: 7px;
  filter: url(#paper-noise);
}

/* Vignettatura angoli carta */
.paper-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(26, 16, 8, 0.13) 100%);
  pointer-events: none;
  z-index: 1;
}

.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Crimson Text', serif;
  font-size: clamp(11px, 2.5vw, 18px);
  color: var(--rule-light);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

/* Ornamento sopra/sotto la testata */
.masthead-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  color: var(--rule-light);
  letter-spacing: 10px;
  margin: 3px 0;
}
.masthead-ornament::before,
.masthead-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-light);
  opacity: 0.5;
}

.newspaper-title {
  font-size: 88px;
  color: var(--ink);
  text-align: center;
  text-overflow: clip;
  line-height: 0.9;
  letter-spacing: -1px;
  margin: 8px 0;
  white-space: nowrap;
  overflow: hidden;
  text-shadow:
    2px 3px 0 rgba(0, 0, 0, 0.1),
    4px 6px 0 rgba(0, 0, 0, 0.05);
}

.masthead-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-family: 'Crimson Text', serif;
  font-size: clamp(11px, 2vw, 16px);
  color: var(--rule-light);
  border-top: 3px double var(--rule);
  border-bottom: 3px double var(--rule);
  padding: 4px 0;
  margin-bottom: 16px;
}
.masthead-bottom span:last-child {
  text-align: right;
}

/* Banda colorata testata (colore = --accent del tema) */
.testata-accent-bar {
  height: 5px;
  background: var(--accent);
  margin-bottom: 14px;
  border-radius: 1px;
}

.main-headline {
  text-align: center;
  padding: 16px 0 12px;
  border-top: 3px solid var(--accent);
  border-bottom: 2px solid var(--rule);
}

.kicker {
  font-family: 'Crimson Text', serif;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: 8px;
}

.headline-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 900;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.1);
}

.headline-ornament {
  font-family: 'IM Fell English', serif;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 10px;
  padding: 2px 0 8px;
}

.deck {
  font-family: 'IM Fell English', serif;
  font-size: clamp(20px, 3vw, 28px);
  font-style: italic;
  line-height: 1.4;
  color: #3a2a1a;
  max-width: 600px;
  margin: 0 auto 14px;
}

.columns-wrapper {
  display: grid;
  grid-template-columns: 2fr 1px 1.5fr;
  gap: 0;
  padding-top: 16px;
}

.col-divider {
  background: var(--rule);
  margin: 0 16px;
}
.col-main {
  padding-right: 8px;
}
.col-side {
  padding-left: 8px;
}

.byline {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--rule-light);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-dark);
}

.article-body {
  font-family: 'Crimson Text', serif;
  font-size: clamp(16px, 2.7vw, 24px);
  line-height: 1.3;
  color: var(--ink);
}

.article-body p {
  margin-bottom: 12px;
  text-align: justify;
  hyphens: auto;
}

/* drop-cap: gestito via <span class="drop-cap"> per compatibilità html2canvas */
.drop-cap {
  font-family: 'Playfair Display', serif;
  font-size: 64px;
  font-weight: 900;
  float: left;
  line-height: 0.8;
  margin: 4px 8px -4px 0;
  color: var(--accent);
}

.pull-quote {
  border-top: 3px solid var(--rule);
  border-bottom: 3px solid var(--rule);
  padding: 16px 12px;
  margin: 16px 0;
  text-align: center;
  display: none;
}

.pull-quote p {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.4;
  color: var(--accent);
}

.sidebar-section {
  border: 1px solid var(--paper-dark);
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.02);
  display: none;
}

.sidebar-section.always-show {
  display: block;
}

.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
  margin-bottom: 10px;
  color: var(--accent);
}

.sidebar-body {
  font-family: 'Crimson Text', serif;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
}

.sidebar-body p {
  margin-bottom: 8px;
}

.generating-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 232, 0.93);
  backdrop-filter: blur(2px);
  z-index: 10;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 14px;
}

.generating-overlay.active {
  display: flex;
}

.press-animation {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: 52px;
  color: var(--ink);
  display: flex;
  gap: 10px;
}

.press-animation span {
  display: inline-block;
  animation: pressInk 1.2s ease-in-out infinite alternate;
}
.press-animation span:nth-child(2) {
  animation-delay: 0.2s;
}
.press-animation span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pressInk {
  from {
    opacity: 0.15;
    transform: translateY(4px) scaleY(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.generating-text {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--rule-light);
}

.generating-dots {
  display: flex;
  gap: 8px;
}
.generating-dots span {
  width: 8px;
  height: 8px;
  background: var(--ink);
  border-radius: 50%;
  opacity: 0.2;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.generating-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.generating-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@media (max-width: 600px) {
  .generating-overlay {
    position: fixed;
    top: 180px;
    bottom: auto;
    left: 0;
    right: 0;
    height: auto;
    padding: 24px 20px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
}

.placeholder-text {
  color: #b8a898;
  font-style: italic;
}

.photo-placeholder {
  width: 100%;
  height: 160px;
  background: repeating-linear-gradient(45deg, #e8e0cc, #e8e0cc 10px, #ddd8c8 10px, #ddd8c8 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  border: 1px solid var(--paper-dark);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.2s;
}

.photo-placeholder:hover {
  opacity: 0.88;
}

.photo-placeholder span {
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  color: var(--rule-light);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#photo-result {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#photo-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Overlay "cambia foto" quando immagine è presente */
.photo-placeholder.has-image::after {
  content: '📷 Cambia foto';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-family: 'Crimson Text', serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.photo-placeholder.has-image:hover::after {
  opacity: 1;
}

/* ── MOTTO DEL GIORNO ───────────────────────────────── */
.motto-giorno {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 16px;
  border-top: 1px solid var(--paper-dark);
  border-bottom: 1px solid var(--paper-dark);
  margin: 0 0 14px;
}

.motto-giorno-label {
  font-family: 'Crimson Text', serif;
  font-size: clamp(14px, 2vw, 16px);
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.motto-giorno-text {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(13px, 2.5vw, 18px);
  color: var(--ink);
  text-align: center;
}

.newspaper-footer {
  margin-top: 24px;
  border-top: 3px double var(--rule);
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  font-family: 'Crimson Text', serif;
  font-size: clamp(11px, 2vw, 16px);
  color: var(--rule-light);
}

/* .bottom-ticker rimosso */

/* DEBUG PANEL */
#debug-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: #0a0a0a;
  border-top: 2px solid #444;
  z-index: 999;
  font-family: monospace;
  font-size: 11px;
}
#debug-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  color: #888;
  font-size: 11px;
  font-family: monospace;
}
#debug-bar span {
  color: #e8956a;
  font-weight: bold;
}
#debug-close {
  cursor: pointer;
  color: #888;
  padding: 2px 8px;
  background: #333;
  border: none;
  border-radius: 2px;
  color: #ccc;
  font-size: 12px;
}
#debug-content {
  height: 185px;
  overflow-y: auto;
  padding: 8px 12px;
  color: #7ec87e;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

@media print {
  #editor-panel {
    display: none;
  }
  #newspaper-wrapper {
    padding: 0;
  }
  body {
    background: white;
  }
  #newspaper {
    box-shadow: none;
  }
  #crop-modal {
    display: none !important;
  }
}

@media (max-width: 600px) {
  #newspaper {
    padding: 20px 18px;
    margin-top: 50px;
  }
  .columns-wrapper {
    grid-template-columns: 1fr;
  }
  .col-divider {
    display: none;
  }
  .col-side {
    padding-left: 0;
    margin-top: 20px;
    border-top: 2px solid var(--rule);
  }
  #newspaper-wrapper {
    padding-top: 200px;
  }
  #crop-container {
    width: 300px;
    height: 200px;
  }
  body.view-mode #newspaper {
    margin-top: -80px;
  }
  .motto-giorno {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
  .motto-giorno-label {
    flex-shrink: unset;
  }
}

/* ── SELECT (testata preset) ──────────────────────────── */
.field-group select {
  background: #2a1f0e;
  border: 1px solid #5a4a2e;
  color: var(--paper);
  padding: 6px 10px;
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.field-group select:focus {
  border-color: var(--accent);
}

.field-group select option {
  background: #2a1f0e;
  color: var(--paper);
}

/* ── CONTATORI CARATTERI ─────────────────────────────── */
.label-counter-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
}

.char-counter {
  font-family: monospace;
  font-size: 10px;
  color: #569c56;
  white-space: nowrap;
  flex-shrink: 0;
}

.char-counter.near-limit {
  color: #e8956a;
}
.char-counter.at-limit {
  color: #e05050;
}

/* ── EDITOR: font più grandi su desktop ─────────────── */
@media (min-width: 769px) {
  .field-group label {
    font-size: 18px;
  }
  .field-group input,
  .field-group select {
    font-size: 18px;
    padding: 9px 18px;
  }
  .btn {
    font-size: 16px;
    padding: 9px 18px;
  }
  .char-counter {
    font-size: 16px;
  }
  #api-notice,
  #error-msg {
    font-size: 18px;
  }
}

/* ── CROP MODAL ──────────────────────────────────────── */
#crop-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 500;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
}

#crop-hint {
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  color: #b8956a;
  font-style: italic;
  letter-spacing: 1px;
  margin: 0;
}

#crop-container {
  width: 480px;
  height: 320px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  border: 2px solid var(--accent);
  border-radius: 2px;
  background: #000;
}

#crop-img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transform-origin: top left;
}

.crop-btns {
  display: flex;
  gap: 10px;
}

.crop-btns button {
  padding: 8px 20px;
  font-family: 'Crimson Text', serif;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 2px;
  border: none;
  transition: background 0.2s;
}

#btn-crop-apply {
  background: var(--accent);
  color: var(--paper);
}

#btn-crop-apply:hover {
  background: #a52020;
}

#btn-crop-cancel {
  background: #3a2f1e;
  color: #b8956a;
  border: 1px solid #5a4a2e;
}

#btn-crop-cancel:hover {
  background: #4a3f2e;
}

/* ── RATIO BUTTONS (crop modal) ─────────────────────── */
.ratio-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.ratio-btn {
  padding: 4px 14px;
  background: #1a1008;
  color: #b8956a;
  border: 1px solid #5a4a2e;
  font-family: 'Crimson Text', serif;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.ratio-btn.active {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.ratio-btn:hover:not(.active) {
  background: #2a1f0e;
}

/* ── ZOOM SLIDER (crop modal) ──────────────────────── */
.zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
  max-width: 480px;
}

.zoom-icon {
  font-size: 18px;
  font-weight: 700;
  color: #b8956a;
  user-select: none;
  line-height: 1;
  width: 16px;
  text-align: center;
}

#zoom-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}

/* ── ROTATE ROW (crop modal) ───────────────────────── */
.rotate-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 0;
}

.rotate-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f5d9a0;
  padding: 5px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s;
}

.rotate-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

#rotate-display {
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Crimson Text', serif;
  font-size: 12px;
  min-width: 28px;
  text-align: center;
  letter-spacing: 1px;
}

/* ── FLIP ROW (crop modal, IT) ──────────────────────── */
.flip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 0;
}

.flip-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f5d9a0;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  transition: background 0.15s;
}

.flip-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.flip-btn.active {
  background: rgba(245, 217, 160, 0.3);
  border-color: #f5d9a0;
}

/* ── CENSOR BUTTONS ROW (crop modal, IT) ────────────── */
.censor-btns-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 8px 0 2px;
  flex-wrap: wrap;
}

.cc-add-btn {
  background: #1a0000;
  color: #ff3333;
  border: 1px solid #cc0000;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s;
}

.cc-add-btn:hover {
  background: #2a0000;
}

.cc-add-btn.active {
  background: #000;
  border-color: #ff4444;
  color: #ff4444;
}

/* ── CROP CENSOR OVERLAYS (IT) ──────────────────────── */
.crop-censor {
  position: absolute;
  background: #000;
  border: 2px solid #cc0000;
  color: #ff3333;
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: move;
  user-select: none;
  z-index: 10;
}

/* border-radius clips the background to a circle; child elements (text, resize handle) are NOT clipped */
.crop-censor-circle {
  border-radius: 50%;
}

.crop-censor span {
  pointer-events: none;
}

.cc-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  cursor: se-resize;
  font-size: 10px;
  color: #cc0000;
  opacity: 0.8;
  line-height: 1;
  pointer-events: all;
  background: rgba(0, 0, 0, 0.7);
  padding: 0 2px;
}

/* ── CENSOR OVERLAY (inside photo-placeholder) ─────── */
#censor-overlay {
  display: none;
  position: absolute;
  background: #000;
  color: #fff;
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  align-items: center;
  justify-content: center;
  cursor: move;
  user-select: none;
  z-index: 6;
  left: 5%;
  width: 90%;
  top: 50%;
  transform: translateY(-50%);
  min-height: 22px;
  padding: 3px 24px 3px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

#censor-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 2px;
  cursor: se-resize;
  font-size: 11px;
  opacity: 0.55;
  line-height: 1;
  color: #ccc;
}

/* ── PHOTO TOOLS (below newspaper, outside capture) ── */
#photo-tools {
  display: none;
  text-align: center;
  padding: 8px 0 2px;
}

.photo-tool-btn {
  background: #1a1008;
  color: #f5f0e8;
  border: 1px solid rgba(245, 240, 232, 0.25);
  padding: 5px 18px;
  border-radius: 16px;
  font-family: 'Crimson Text', serif;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s;
}

.photo-tool-btn:hover {
  background: #2a2018;
}

.photo-tool-btn.active {
  background: #2a2018;
  border-color: rgba(245, 240, 232, 0.6);
}

/* ── SHARE BUTTON (editor panel) ───────────────────── */
.btn-share {
  background: #25d366;
  color: white;
  border: 1px solid #2a5248;
}

.btn-share:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-share:hover {
  background: #2a4238;
}

/* ── SHARE MODAL ───────────────────────────────────── */
#share-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 600;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#share-inner {
  background: white;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 25px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: shareSlideUp 0.3s ease;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes shareSlideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#share-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: #666;
  font-size: 15px;
}

.share-spinner {
  font-size: 40px;
  animation: pressInk 1.2s ease-in-out infinite alternate;
}

.share-title {
  font-size: 20px;
  font-weight: 700;
  color: #222;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
  text-align: center;
}

#share-preview {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #eee;
  display: block;
}

.share-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
}

.share-section-label::before,
.share-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ebebeb;
}

.share-section-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.25s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.share-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.2);
}
.share-btn:active {
  transform: translateY(0);
}

.sbn-download {
  background: #222a5c;
  color: #ffd600;
  border: 2px solid #ffd600;
}

/* Link input */
#share-link-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 13px;
  color: #444;
  background: #f9f9f9;
  box-sizing: border-box;
  text-overflow: ellipsis;
  outline: none;
}

/* Copy button */
.sbn-copy-btn {
  width: 100%;
  padding: 11px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.sbn-copy-btn:hover {
  background: #218838;
}

/* Native share button */
.btn-native-share {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  margin-top: 5px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.btn-native-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Divider */
.share-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aaa;
  font-size: 12px;
}
.share-divider::before,
.share-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

/* Social buttons grid */
.share-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}
.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition:
    filter 0.2s,
    transform 0.2s;
}
.btn-share:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}
.btn-share:active {
  transform: translateY(0);
}
.btn-share.btn-whatsapp {
  background: #25d366;
}
.btn-share.btn-telegram {
  background: #0088cc;
}
.btn-share.btn-messenger {
  background: linear-gradient(45deg, #00b2ff, #006aff);
}
.btn-share.btn-line {
  background: #00b900;
}

#share-status {
  font-size: 13px;
  color: #888;
  text-align: center;
  font-style: italic;
  min-height: 18px;
  margin: 0;
}

#share-close {
  background: #222a5c;
  color: #ffd600;
  border: 2px solid #ffd600;
  padding: 10px 30px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 15px #ffd60055;
  outline: none;
  transition:
    all 0.3s,
    box-shadow 0.2s;
  margin-top: 4px;
}

#share-close:hover {
  background: #ffd600;
  color: #222a5c;
  box-shadow:
    0 0 0 3px #ffd600,
    0 0 0 6px #222a5c;
}

@media (max-width: 600px) {
  .share-section-btns {
    grid-template-columns: 1fr;
  }
  #share-inner {
    padding: 18px;
  }
}

/* ═══════════════════════════════════════════════════════
TEMI TESTATA
═══════════════════════════════════════════════════════ */

/* ── Il Giornale della Verità ── */
body.theme-verita {
  --paper: #f1ece2;
  --paper-dark: #e0d8c8;
  --ink: #111;
  --accent: #8b0000;
  --rule: #1c1c1c;
  --rule-light: #444;
  background: #1a1610;
}
.theme-verita .newspaper-title {
  font-family: 'Cinzel', serif;
  letter-spacing: 1px;
}

/* ── Il Quotidiano del Ridicolo ── */
body.theme-ridicolo {
  --paper: #fff8e8;
  --paper-dark: #f0e4b8;
  --ink: #2b1b00;
  --accent: #ff6f00;
  --rule: #d9a441;
  --rule-light: #c48a00;
  background: #1a1000;
}
.theme-ridicolo .newspaper-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(52px, 7vw, 92px);
  letter-spacing: 1px;
}
.theme-ridicolo .kicker {
  background: var(--accent);
  color: #fff;
  padding: 4px 8px;
  border-radius: 2px;
}

/* ── La Gazzetta del Sesso ── */
body.theme-sesso {
  --paper: #f8f0f4;
  --paper-dark: #e8d0dc;
  --ink: #2a0f18;
  --accent: #d1005c;
  --rule: #4a1025;
  --rule-light: #7a2c4f;
  background: #180810;
}
.theme-sesso .newspaper-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-style: italic;
}
.theme-sesso .kicker {
  color: #ff2e88;
  letter-spacing: 6px;
}

/* ── Il Corriere dell'Assurdo ── */
body.theme-assurdo {
  --paper: #eef3ff;
  --paper-dark: #d0daff;
  --ink: #10152a;
  --accent: #4b5fff;
  --rule: #2b3466;
  --rule-light: #4a5aaa;
  background: #080e28;
}
.theme-assurdo .newspaper-title {
  font-family: 'Cormorant Unicase', serif;
  letter-spacing: 2px;
}

/* ── La Voce del Nulla ── */
body.theme-nulla {
  --paper: #f7f7f7;
  --paper-dark: #e0e0e0;
  --ink: #111;
  --accent: #222;
  --rule: #d0d0d0;
  --rule-light: #888;
  background: #181818;
}
.theme-nulla .newspaper-title {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  letter-spacing: 0px;
}
.theme-nulla .kicker {
  color: #555;
}

#seo-info-news {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
