body {
  font-family: sans-serif;
  max-width: 1140px;
  margin: auto;
  padding: 20px;
}

.toolbar button,
.toolbar select {
  margin: 4px 3px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}

#editor {
  font-family: 'Cambria Math', 'Segoe UI Symbol', sans-serif;
  width: 93%;
  height: 150px;
  padding: 10px;
  font-size: 16px;
  margin-top: 10px;
}

#output {
  font-family: 'Cambria Math', 'Segoe UI Symbol', sans-serif;
  white-space: pre-wrap;
  background: #f4f4f4;
  padding: 10px;
  border: 1px solid #ccc;
  margin-top: 20px;
}

.emoji-box {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  z-index: 10;
  max-width: 340px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-size: 16px;
}

#emojiSearch {
  width: 100%;
  padding: 6px;
  margin: 8px 0;
  box-sizing: border-box;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 32px);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-grid span {
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}

.emoji-grid span:hover {
  background: #eee;
  border-radius: 5px;
}

#emojiCategories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

#emojiCategories button {
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
}

#channelSelector {
  margin-bottom: 10px;
  font-size: 16px;
  padding: 4px 8px;
}

.char-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

#charCount {
  text-align: right;
  font-size: 14px;
  margin-top: 4px;
}

#charCount.over {
  color: red;
  font-weight: bold;
}

.social-channel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.channel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  background: #fff;
}

.channel-icon {
  width: 48px;
  height: 48px;
  margin-right: 8px;
}

.channel-name {
  flex: 1;
  margin-left: 8px;
  font-weight: bold;
}

.char-counter {
  font-family: monospace;
  white-space: nowrap;
}

/* Evidenza canale selezionato */
#channelSelector .channel { cursor: pointer; }
#channelSelector .channel.active {
  outline: 2px solid #4c9ffe;
  background: #f0f7ff;
  border-color: #cfe6ff;
  border-radius: 10px;
}

/* Badge "caratteri rimasti" sul canale attivo */
#channelSelector .remaining-badge {
  display: none;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #cfe6ff;
  background: #f0f7ff;
}

#channelSelector .channel.active .remaining-badge {
  display: inline-block;
}

/* === NAVBAR CENTRALE === */
nav.main-nav {
  text-align: center;
  margin-bottom: 20px;
}
nav.main-nav a {
  margin: 0 15px;
  text-decoration: none;
  font-weight: bold;
  color: #2b9cff;
  font-size: 15px;
  transition: color 0.2s ease;
}
nav.main-nav a:hover {
  color: #145a8d;
}
/* === Layout editor a due colonne === */
.editor-layout {
  display: flex;
  gap: 20px;
  align-items: stretch;
  margin: 20px 0;
}

.editor-col {
  flex: 1 1 0;
  min-width: 0; /* evita overflow dell'output */
}

.panel {
  background: #fff;
  border: 1px solid #e5e8eb;
  border-radius: 8px;
  padding: 16px;
  height: 100%;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.panel h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: #2b9cff;
}

/* Mobile: impila le colonne */
@media (max-width: 768px) {
  .editor-layout {
    flex-direction: column;
  }
  .editor-col {
  margin-top:20px;
}
}


/* === PARAGRAFO INTRODUTTIVO === */
.editor-intro {
  max-width: 100%;
  margin: 10px auto 20px auto;
  text-align: left;
  font-size: 15px;
  line-height: 1.6;
  color: #444;
}

/* === AREA TOOL CENTRALE === */
.tool-area {
  width: 100%;
  margin: 30px 0;
  text-align: center;
}
.tool-area-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  border: 1px dashed #ccc;
  border-radius: 6px;
  background: #fafafa;
}
.tool-area-inner h3 {
  margin-top: 0;
}
.tool-area-inner p {
  color: #666;
  margin: 10px 0 0 0;
}

/* Banner area: due colonne sotto l'output */
.banner-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
}

.banner-slot {
  flex: 0 0 auto;
}

.ad-banner {
  width: 336px;
  height: 336px;
  background: #eee;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
}

.ad-banner a:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border-radius: 6px;
  cursor: pointer;
}

.banner-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Spazio copy SEO */
.seo-copy {
  max-width: 1000px;
  margin: 40px auto;
  padding: 20px;
  background: #fafafa;
  border-radius: 6px;
  line-height: 1.6;
  color: #333;
}
.seo-copy h3 {
  margin-top: 0;
  color: #2b9cff;
}

/* Banner orizzontale centrato */
.banner-horizontal {
  display: flex;
  justify-content: center;
  margin: 40px 0;
}

.ad-banner-horizontal {
  width: 728px;   /* cambia qui se vuoi 970x90 o 970x250 */
  height: 90px;
  background: #eee;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
}

.ad-banner-horizontal a {
  display: inline-block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ad-banner-horizontal a:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border-radius: 6px; /* per mantenere armonia con il contenitore */
}

.banner-gif {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}


/* === FOOTER === */
.main-footer {
  background: #f8f9fa;
  border-top: 1px solid #ddd;
  padding: 20px 10px;
  text-align: center;
  font-size: 14px;
  color: #555;
}

.main-footer .footer-menu {
  margin-bottom: 12px;
}

.main-footer .footer-menu a {
  margin: 0 10px;
  text-decoration: none;
  color: #2b9cff;
  font-weight: 500;
  transition: color 0.2s ease;
}

.main-footer .footer-menu a:hover {
  color: #145a8d;
}

.main-footer .footer-meta p {
  margin: 4px 0;
  font-size: 13px;
  color: #777;
}

/* Banner sticky footer */
.sticky-footer-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  border-top: 1px solid #ccc;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 9999;
}

.sticky-footer-banner .sticky-banner-inner {
  max-width: 970px; /* o 728px se usi formato più piccolo */
  margin: 0 auto;
  padding: 8px 40px 8px 8px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-banner-sticky {
  width: 728px;   /* default Leaderboard */
  height: 90px;
  background: #eee;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 14px;
}

/* Immagine gif */
.banner-sticky-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Effetto hover */
.sticky-banner-inner a:hover .banner-sticky-img {
  transform: scale(1.03);
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  cursor: pointer;
}

.sticky-close:hover {
  background: rgba(0,0,0,0.8);
}

.sticky-close {
  position: absolute;
  right: 10px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s;
}
.sticky-close:hover {
  color: #333;
}

/* Mobile base */
@media (max-width: 768px) {
  body { padding: 12px; max-width: 100%; }
  .toolbar button { font-size: 16px; padding: 6px 8px; }
  #editor { height: 180px; font-size: 15px; }
  .social-channel { gap: 6px; }
  .channel { padding: 6px 8px; }
  .channel-icon { width: 36px; height: 36px; }
  .emoji-box { left: 0 !important; right: 0 !important; max-width: 100%; box-sizing: border-box; }
  .emoji-grid { grid-template-columns: repeat(auto-fill, 28px); gap: 4px; max-height: 160px; }
  .banner-row { flex-wrap: wrap; }
  .ad-banner { width: 250px; height: 250px; } /* quadrato mobile */
  .seo-copy { margin: 24px auto; padding: 16px; }
  .ad-banner-horizontal { width: 320px; height: 50px; } /* Mobile Leaderboard */
  .sticky-footer-banner .sticky-banner-inner { max-width: 320px; padding-right: 36px; }
  .ad-banner-sticky { width: 320px; height: 50px; }
}

/* Tablet medio */
@media (min-width: 769px) and (max-width: 1024px) {
  .ad-banner { width: 300px; height: 250px; } /* medium rectangle */
  .ad-banner-horizontal { width: 728px; height: 90px; }
  .sticky-footer-banner .sticky-banner-inner { max-width: 728px; }
  .ad-banner-sticky { width: 728px; height: 90px; }
}
/* === Layout pagina pubblica === */
.page-wrap {
  /*max-width: 1000px;*/
  margin: 20px auto 60px auto;
  padding: 0 12px;
}

/* Intestazione pagina */
.page-header h1 {
  margin: 0 0 8px 0;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.2;
}
.page-header .lead {
  color: #555;
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 16px 0;
}

/* Iframe section */
.page-iframe {
  margin: 20px 0;
}
.page-iframe iframe {
  width: 100%;
  min-height: 360px;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* Contenuto lungo SEO */
.page-content {
  margin: 20px 0 0 0;
  line-height: 1.8;
  color: #333;
}
.page-content h2, .page-content h3, .page-content h4 {
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}
.page-content p {
  margin: 0 0 1em 0;
}
.page-content ul, .page-content ol {
  padding-left: 20px;
  margin: 0 0 1em 0;
}
.page-content a {
  color: #2b9cff;
  text-decoration: none;
}
.page-content a:hover {
  color: #145a8d;
  text-decoration: underline;
}

/* Navbar già definita .main-nav ... – aggiungo padding top/bottom */
nav.main-nav {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 14px;
}

/* Footer già definito .main-footer ... – aggiungo margine top extra */
.main-footer {
  margin-top: 40px;
}

/* Responsive migliorato per contenuti incorporati */
@media (max-width: 768px) {
  .page-iframe iframe { min-height: 220px; }
  .page-header .lead { font-size: 15px; }
}
/* Help box collassabile */
.admin-help {
  border: 1px solid #e5e8eb;
  background: #f9fbff;
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0 16px 0;
}
.admin-help-toggle {
  display: inline-block;
  background: #2b9cff;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}
.admin-help-content {
  margin-top: 10px;
  color: #333;
  line-height: 1.6;
  font-size: 14px;
}
.admin-help-content ul { margin: 8px 0; padding-left: 18px; }
.admin-help[aria-expanded="true"] .admin-help-toggle { background: #145a8d; }
.admin-help[aria-expanded="false"] .admin-help-content { display: none; }