:root {
  --bg-color: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #fdfdfd;
  --primary: #4c6ef5;
  --primary-dark: #3954c6;
  --accent: #00b894;
  --text: #1c1f26;
  --text-muted: #5c6270;
  --border: #d9dfeb;
  --shadow: 0 18px 32px rgba(20, 23, 31, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
  --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(120% 120% at 50% 0%, #ffffff 0%, var(--bg-color) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #8a63f4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 12px 24px rgba(76, 110, 245, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text strong {
  font-size: 20px;
  letter-spacing: -0.2px;
}

.brand-text span {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(76, 110, 245, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 16px 30px rgba(76, 110, 245, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--primary);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 32px;
  padding: 40px 48px 80px;
  max-width: 1280px;
  margin: 0 auto;
}

.puzzle-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.puzzle-card h1 {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: -0.4px;
}

.puzzle-subtitle {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 16px;
}

.puzzle-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.share-actions {
  display: flex;
  gap: 12px;
}

.share-actions button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.share-actions button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.success-banner {
  background: #ecfdf3;
  color: #05603a;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: none;
}

.success-banner.active {
  display: block;
}

table.center {
  margin-left: auto;
  margin-right: auto;
  border-spacing: 0;
  border-collapse: collapse;
  white-space: nowrap;
}

table.center td.pista {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 6px;
  white-space: nowrap;
}

table.casillero {
  border: 1px solid var(--border);
  width: 36px;
  height: 48px;
  border-spacing: 0;
  border-collapse: collapse;
  margin-left: auto;
  margin-right: auto;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(76, 110, 245, 0.08);
}

table.casillero td.letra {
  position: relative;
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: 14px 14px;
  --puntuacion-url: none;
}

table.casillero_negro {
  border: 1px solid #000;
  width: 36px;
  height: 48px;
  border-spacing: 0;
  border-collapse: collapse;
  background: linear-gradient(160deg, #1f2933 0%, #121923 100%);
  border-radius: var(--radius-sm);
  margin-left: auto;
  margin-right: auto;
}

td.blanco {
  width: 18px;
}

.titulo {
  font-size: 32px;
  text-align: center;
  height: 50px;
}

.titulo2 {
  font-size: 18px;
  text-align: center;
  height: 42px;
  color: var(--text);
}

.subtitulo {
  font-size: 14px;
  text-align: center;
  height: 50px;
  color: var(--text-muted);
}

.numeracion,
.numeracion_right {
  font-size: 10px;
  height: 10px;
  color: var(--text-muted);
}

.numeracion_right {
  text-align: right;
}

td.pista,
td.pista_numero {
  white-space: nowrap;
}

.text_center {
  text-align: center;
}

.soloborde_d {
  border-right: 1px solid var(--border);
}

.pista_numero {
  font-size: 11px;
  text-align: center;
  vertical-align: top;
  color: var(--text-muted);
}

.pista_definicion {
  font-size: 13px;
  color: var(--text);
  width: 100%;
}

.pista_definicion_textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(76, 110, 245, 0.08);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}

.puntuacion {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  z-index: 5;
}

.puntuacion-texto {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 12px;
  color: #4b5563;
  font-weight: 700;
  pointer-events: none;
}

.puntuacion-texto::after {
  display: none;
}

.puntuacion img {
  position: absolute;
  bottom: 4px;
  right: 4px;
  /*width: 14px;
  height: 14px;*/
  display: block;
  opacity: 0.9;
  pointer-events: none;
}

.unselectable {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input.letra {
  font-size: 15px;
  height: 26px;
  width: 34px;
  text-align: center;
  font-weight: 700;
  color: #19216c;
  border: none;
  background: transparent;
}

input.letra:focus {
  outline: none;
  background: rgba(76, 110, 245, 0.07);
}

input.sin_usar {
  color: transparent;
}

input.posible {
  color: #00bb7c;
}

input.pista_letra,
input.pista_letra_inicial {
  display: inline-block;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid #1f2933;
  vertical-align: middle;
  width: 40px;
  padding: 4px 2px;
  background: transparent;
  transition: border-color var(--transition);
}

input.pista_letra_inicial {
  color: #f04d4d;
}

input.pista_letra:focus,
input.pista_letra_inicial:focus {
  outline: none;
  border-bottom-color: var(--primary);
}

input.pn_edit {
  display: inline-block;
  width: 40px;
  border: 1px solid rgba(76, 110, 245, 0.35);
  text-align: center;
  line-height: 16px;
  background: rgba(76, 110, 245, 0.12);
  color: var(--text);
  font-weight: 600;
  border-radius: 12px;
  padding: 6px 0;
}

.guardado_correcto {
  display: block;
  padding: 12px 16px;
  color: #0b8457;
  text-align: center;
  border-radius: var(--radius-sm);
  background: rgba(0, 184, 148, 0.08);
}

.mensaje-exito {
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: var(--radius-md);
  background: #e6f8ef;
  color: #0b5b3f;
  font-size: 15px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(11, 91, 63, 0.08);
}

.mensaje-error {
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: var(--radius-md);
  background: #fdecea;
  color: #b3261e;
  font-size: 15px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(179, 38, 30, 0.12);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.sidebar-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.ad-slot {
  background: linear-gradient(135deg, rgba(76, 110, 245, 0.08), rgba(0, 184, 148, 0.08));
  border: 1px dashed rgba(76, 110, 245, 0.25);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.pricing-highlight {
  border: 1px solid rgba(76, 110, 245, 0.4);
  border-radius: var(--radius-md);
  padding: 18px;
  background: rgba(76, 110, 245, 0.06);
}

.pricing-highlight ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.friend-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-alt);
  font-size: 14px;
  color: var(--text-muted);
}

.friend-card strong {
  color: var(--text);
}

.pistas-container {
  display: inline-block;
  width: 100%;
}

.panel-letras-card {
  position: sticky;
  top: 24px;
  z-index: 12;
}

.grid-header--compact {
  margin-bottom: 12px;
}

.panel-letras-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-letras-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #1f2933;
  font-weight: 600;
}

.panel-letras-meta-item strong {
  margin-left: 4px;
  color: #0b5b3f;
  font-size: 15px;
}

.panel-letras-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  color: #1f2933;
}

.panel-letras-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(48, 115, 187, 0.08);
  font-weight: 600;
}

.panel-letras-item-label {
  color: #0f1c2c;
}

.panel-letras-item-value {
  color: #23395d;
  font-variant-numeric: tabular-nums;
}

.menu-grillas {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.menu-grillas details {
  border: 1px solid rgba(42, 64, 138, 0.15);
  border-radius: 14px;
  background: #f8f9ff;
  box-shadow: inset 0 0 0 1px rgba(120, 148, 255, 0.04);
}

.menu-grillas summary {
  list-style: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  color: #1f2f5a;
  cursor: pointer;
  outline: none;
}

.menu-grillas summary::-webkit-details-marker {
  display: none;
}

.menu-grillas summary::after {
  content: "▾";
  font-size: 16px;
  color: #4f5d88;
  transition: transform 0.2s ease;
}

.menu-grillas details[open] > summary::after {
  transform: rotate(-180deg);
}

.menu-grillas-section > summary {
  font-size: 16px;
  background: linear-gradient(135deg, rgba(76, 110, 245, 0.12), rgba(41, 58, 139, 0.05));
  border-radius: 14px;
}

.menu-grillas-year {
  margin: 0 18px 16px;
  background: #ffffff;
  border: 1px solid rgba(60, 78, 140, 0.12);
}

.menu-grillas-year > summary {
  font-size: 15px;
  color: #22346d;
  background: rgba(219, 226, 255, 0.4);
  border-radius: 12px;
  padding-left: 32px;
  position: relative;
}

.menu-grillas-year > summary::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(76, 110, 245, 0.6);
}

.menu-grillas-month {
  margin: 0 18px 16px;
  border: 1px solid rgba(60, 78, 140, 0.08);
  background: #ffffff;
}

.menu-grillas-month > summary {
  font-size: 14px;
  font-weight: 600;
  color: #2c3c72;
  border-radius: 10px;
  padding-left: 44px;
  position: relative;
}

.menu-grillas-month > summary::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 1px;
  background: rgba(76, 110, 245, 0.4);
}

.menu-grillas-list {
  list-style: none;
  margin: 8px 0 18px;
  padding: 0 24px 0 56px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-grillas-list li {
  position: relative;
  padding-left: 16px;
}

.menu-grillas-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(76, 110, 245, 0.8);
  font-size: 18px;
  line-height: 1;
}

.menu-grillas-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  color: #243669;
}

.menu-grillas-item-index {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a5fa6;
}

.menu-grillas-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #152b56;
}

.menu-grillas-empty {
  margin: 0 18px 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(67, 86, 148, 0.4);
  color: #54618b;
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .menu-grillas {
    gap: 12px;
  }

  .menu-grillas details {
    border-radius: 10px;
  }

  .menu-grillas summary {
    padding: 12px 16px;
    font-size: 14px;
  }

  .menu-grillas-list {
    padding-left: 32px;
  }

  .menu-grillas-list li {
    padding-left: 12px;
  }
}

.pista-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.pista-row:last-child {
  border-bottom: none;
}

.pista-row-header {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pista-row-indice {
  font-weight: 700;
  font-size: 14px;
  color: #1f2933;
  min-width: 32px;
  text-align: right;
}

.pista-row-letras,
.pista-row-numeros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pista-row-numeros,
.pista-row-definicion {
  margin-left: 44px;
}

.pista-row-definicion input {
  width: 100%;
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }
}

@media (max-width: 720px) {
  .dashboard {
    padding: 24px 20px 60px;
  }

  .puzzle-card {
    padding: 24px;
  }

  table.casillero {
    width: 30px;
    height: 40px;
  }

  input.letra {
    width: 30px;
    height: 22px;
    font-size: 12px;
  }
}

/* Estilos para anuncios AdSense */
.ads-container {
  margin: 0 auto;
  text-align: center;
}

.ads-banner {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
}

.ads-sidebar {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.ads-in-article {
  width: 100%;
  margin: 0 auto;
}

.ads-footer {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
}

.ads-auto {
  width: 100%;
  margin: 0 auto;
}

/* Responsive para anuncios */
@media (max-width: 768px) {
  .ads-banner,
  .ads-footer {
    max-width: 100%;
  }
  
  .ads-sidebar {
    max-width: 100%;
  }
}
