/* SignificadoPalabras Herramientas — estilos públicos.
   Todo cuelga de .sph para no chocar con el tema. Hereda la tipografía del tema. */

.sph, .sph-ac {
	--sph-c: #4f46e5;
	--sph-tinta: #1f2937;
	--sph-suave: #6b7280;
	--sph-linea: #e5e7eb;
	--sph-fondo: #ffffff;
	--sph-fondo2: #f6f6fb;
	--sph-ok: #16a34a;
	--sph-casi: #d97706;
	--sph-no: #9ca3af;
	--sph-radio: 14px;
	--sph-sombra: 0 8px 25px rgba(30, 30, 80, .06);
}

.sph { color: var(--sph-tinta); line-height: 1.55; }
.sph *, .sph *::before, .sph *::after { box-sizing: border-box; }
.sph a { color: var(--sph-c); }
.sph .sph-suave { color: var(--sph-suave); }

/* Formularios */
.sph-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.sph-form input[type="text"], .sph-form input[type="email"], .sph textarea {
	flex: 1 1 220px; min-width: 0; padding: 12px 16px; font: inherit; font-size: 1.05em;
	border: 1px solid var(--sph-linea); border-radius: 999px; background: var(--sph-fondo); color: inherit;
}
.sph textarea { border-radius: var(--sph-radio); width: 100%; min-height: 180px; resize: vertical; line-height: 1.6; }
.sph-form input:focus, .sph textarea:focus { outline: 2px solid var(--sph-c); outline-offset: 1px; border-color: transparent; }
.sph-boton {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	padding: 11px 20px; border: 0; border-radius: 999px; cursor: pointer;
	background: var(--sph-c); color: #fff !important; font: inherit; font-weight: 600; text-decoration: none !important;
	transition: filter .15s, transform .05s;
}
.sph-boton:hover { filter: brightness(1.08); }
.sph-boton:active { transform: translateY(1px); }
.sph-boton[disabled] { opacity: .5; cursor: default; }
.sph-boton--sec { background: transparent; color: var(--sph-c) !important; box-shadow: inset 0 0 0 1.5px var(--sph-c); }
.sph-check { display: flex; gap: 8px; align-items: flex-start; font-size: .92em; color: var(--sph-suave); margin: 6px 0; }
.sph-check input { margin-top: .3em; }
.sph-hp { position: absolute !important; left: -9999px !important; }
.sph-aviso { background: var(--sph-fondo2); border-left: 4px solid var(--sph-c); padding: 12px 16px; border-radius: 8px; }

/* Ficha y bloques */
.sph-ficha { background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); padding: 20px 22px; margin: 0 0 24px; }
.sph-ficha__titulo { margin: 0 0 10px; font-size: 1.5em; }
.sph-chip { display: inline-block; padding: 3px 11px; margin: 0 6px 6px 0; border-radius: 999px; background: var(--sph-fondo2); font-size: .88em; }
.sph-bloque { margin: 0 0 28px; }
.sph-bloque h3 { margin: 0 0 4px; }
.sph-grupo h4 { margin: 14px 0 6px; font-size: .85em; text-transform: uppercase; letter-spacing: .06em; color: var(--sph-suave); }
.sph-nube { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sph-nube li { margin: 0; }
.sph-nube a { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--sph-fondo2); text-decoration: none; color: var(--sph-tinta); }
.sph-nube a:hover { background: var(--sph-c); color: #fff; }
.sph-rimas.sph-sin-formas [data-forma] { display: none; }

/* Conjugador */
.sph-noper { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 10px 0; }
.sph-noper dt { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--sph-suave); }
.sph-noper dd { margin: 0; font-weight: 600; font-size: 1.1em; }
.sph-tiempos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; margin-top: 10px; }
.sph-tiempo { width: 100%; border-collapse: collapse; background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); overflow: hidden; margin: 0; font-size: .95em; }
.sph-tiempo caption { caption-side: top; text-align: left; font-weight: 700; padding: 0 2px 6px; }
.sph-tiempo th, .sph-tiempo td { padding: 6px 12px; border: 0; border-bottom: 1px solid var(--sph-linea); text-align: left; }
.sph-tiempo tr:last-child th, .sph-tiempo tr:last-child td { border-bottom: 0; }
.sph-tiempo th { font-weight: 400; color: var(--sph-suave); width: 36%; font-size: .88em; white-space: nowrap; }
.sph-tiempo th, .sph-tiempo td { padding: 6px 10px; }

/* Cajas en la palabra */
.sph-caja { margin: 28px 0 0; padding: 18px 20px; background: var(--sph-fondo2); border-radius: var(--sph-radio); }
.sph-caja p { margin: 0 0 10px; }
.sph-caja > :last-child { margin-bottom: 0; }
.sph-caja__forma, .sph-caja__verbo { margin: 0 0 14px; }
.sph-caja__forma ul { margin: 0 0 10px 1.2em; }
.sph-atribucion { margin-top: 20px; font-size: .85em; color: #6b7280; }

/* Palabra del día */
.sph-pdd { background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); padding: 22px 24px; }
.sph-pdd__etiqueta { font-size: .78em; text-transform: uppercase; letter-spacing: .1em; color: var(--sph-c); font-weight: 700; }
.sph-pdd__palabra { display: block; font-size: 2.2em; line-height: 1.15; margin: 6px 0 2px; color: var(--sph-tinta) !important; text-decoration: none; font-weight: 700; }
.sph-pdd__cat { font-style: italic; color: var(--sph-suave); }
.sph-pdd__def { margin: 12px 0 16px; font-size: 1.08em; }

/* Suscripción / registro API */
.sph-susc, .sph-apireg { background: var(--sph-fondo2); border-radius: var(--sph-radio); padding: 20px 22px; margin: 20px 0; position: relative; }
.sph-susc__titulo { margin: 0 0 10px; }
.sph-susc__msg, .sph-apireg__res { margin: 8px 0 0; font-weight: 600; }
.sph-apireg__res code { display: block; padding: 10px 12px; margin-top: 6px; background: #fff; border-radius: 8px; word-break: break-all; user-select: all; }
.sph-tabla { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.sph-tabla th, .sph-tabla td { padding: 8px 10px; border-bottom: 1px solid var(--sph-linea); text-align: left; vertical-align: top; }
.sph-apidocs pre { background: #111827; color: #e5e7eb; padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.sph-apidocs pre code { background: none; color: inherit; }

/* ---------- Wordle ---------- */
.sph-wordle { max-width: 520px; margin: 0 auto; text-align: center; user-select: none; }
.sph-w__cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sph-w__cab h3 { margin: 0; font-size: 1.15em; }
.sph-w__icono { background: none; border: 0; cursor: pointer; font-size: 1.3em; padding: 4px 8px; color: inherit; }
.sph-w__tablero { display: grid; gap: 6px; margin: 0 auto 16px; max-width: 330px; }
.sph-w__fila { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sph-w__fila.sph-temblor { animation: sph-temblor .4s; }
.sph-w__celda {
	aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
	border: 2px solid var(--sph-linea); border-radius: 8px; font-size: 1.9em; font-weight: 800; text-transform: uppercase;
	background: var(--sph-fondo);
}
.sph-w__celda.llena { border-color: #9ca3af; animation: sph-pop .1s; }
.sph-w__celda.e2, .sph-w__celda.e1, .sph-w__celda.e0 { color: #fff; border-color: transparent; animation: sph-giro .45s both; }
.sph-w__celda.e2 { background: var(--sph-ok); }
.sph-w__celda.e1 { background: var(--sph-casi); }
.sph-w__celda.e0 { background: var(--sph-no); }
.sph-w__teclado { display: grid; gap: 6px; }
.sph-w__tfila { display: flex; gap: 5px; justify-content: center; }
.sph-w__tecla {
	flex: 1 1 0; max-width: 44px; height: 52px; border: 0; border-radius: 6px; cursor: pointer;
	background: #e5e7eb; color: var(--sph-tinta); font: inherit; font-weight: 700; text-transform: uppercase; padding: 0;
}
.sph-w__tecla--ancha { max-width: 70px; flex-grow: 1.6; font-size: .78em; }
.sph-w__tecla.e2 { background: var(--sph-ok); color: #fff; }
.sph-w__tecla.e1 { background: var(--sph-casi); color: #fff; }
.sph-w__tecla.e0 { background: #6b7280; color: #fff; }
.sph-w__msg { min-height: 1.6em; font-weight: 700; margin: 0 0 10px; }
.sph-w__final { background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); padding: 18px; margin: 0 0 16px; text-align: left; }
.sph-w__final h4 { margin: 0 0 6px; font-size: 1.4em; }
.sph-w__stats { display: flex; justify-content: space-around; margin: 12px 0; text-align: center; }
.sph-w__stats b { display: block; font-size: 1.6em; }
.sph-w__stats span { font-size: .78em; color: var(--sph-suave); }
.sph-w__ayuda { text-align: left; font-size: .95em; background: var(--sph-fondo2); border-radius: var(--sph-radio); padding: 14px 16px; margin-bottom: 14px; }
.sph-w__ayuda .sph-w__fila { max-width: 200px; margin: 6px 0; }
.sph-w__ayuda .sph-w__celda { font-size: 1.1em; }

@keyframes sph-temblor { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
@keyframes sph-pop { from { transform: scale(.9); } to { transform: scale(1); } }
@keyframes sph-giro { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@media (prefers-reduced-motion: reduce) { .sph * { animation: none !important; transition: none !important; } }

/* ---------- Adivina ---------- */
.sph-adivina { max-width: 620px; margin: 0 auto; }
.sph-ad__tarjeta { background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); padding: 22px 24px; margin-bottom: 14px; }
.sph-ad__meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .9em; color: var(--sph-suave); margin-bottom: 8px; }
.sph-ad__def { font-size: 1.25em; line-height: 1.5; margin: 0 0 14px; }
.sph-ad__pistas { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.sph-ad__huecos { letter-spacing: .35em; font-family: ui-monospace, monospace; font-size: 1.2em; margin: 4px 0 12px; }
.sph-ad__res { font-weight: 700; min-height: 1.5em; }
.sph-ad__res.ok { color: var(--sph-ok); }
.sph-ad__res.mal { color: #dc2626; }
.sph-ad__nivel { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sph-ad__nivel button { border: 0; border-radius: 999px; padding: 6px 14px; background: var(--sph-fondo2); cursor: pointer; font: inherit; color: inherit; }
.sph-ad__nivel button[aria-pressed="true"] { background: var(--sph-c); color: #fff; }

/* ---------- Corrector ---------- */
.sph-co__barra { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }
.sph-co__cuenta { font-size: .88em; color: var(--sph-suave); }
.sph-co__salida { background: var(--sph-fondo); border-radius: var(--sph-radio); box-shadow: var(--sph-sombra); padding: 18px 20px; white-space: pre-wrap; line-height: 1.9; font-size: 1.05em; }
.sph-co__err { border-bottom: 2.5px solid #dc2626; cursor: pointer; background: rgba(220, 38, 38, .07); border-radius: 2px; position: relative; padding: 0 1px; }
.sph-co__err.estilo { border-color: var(--sph-c); background: rgba(79, 70, 229, .07); }
.sph-co__err.hecho { border: 0; background: rgba(22, 163, 74, .12); }
.sph-co__pop { position: absolute; z-index: 50; background: #fff; border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .18); padding: 12px 14px; width: max-content; max-width: 300px; font-size: .9em; line-height: 1.45; white-space: normal; text-align: left; color: var(--sph-tinta); }
.sph-co__pop p { margin: 0 0 8px; }
.sph-co__pop button { margin: 0 6px 6px 0; padding: 4px 10px; border-radius: 999px; border: 0; background: var(--sph-c); color: #fff; cursor: pointer; font: inherit; }
.sph-co__vacio { color: var(--sph-ok); font-weight: 700; }
.sph-co__creditos { font-size: .8em; color: var(--sph-suave); margin-top: 10px; }

/* ---------- Autocompletado ---------- */
.sph-ac { position: absolute; z-index: 99999; background: #fff; border-radius: 12px; box-shadow: 0 14px 34px rgba(30, 30, 80, .16); padding: 6px; margin: 4px 0 0; list-style: none; max-height: 360px; overflow-y: auto; font-size: 15px; text-align: left; }
.sph-ac li { margin: 0; }
.sph-ac a { display: flex; justify-content: space-between; gap: 14px; padding: 9px 12px; border-radius: 8px; color: #1f2937; text-decoration: none; }
.sph-ac a span { color: #9ca3af; font-size: .85em; font-style: italic; }
.sph-ac a.activa, .sph-ac a:hover { background: #f3f3fb; }
.sph-ac mark { background: none; color: var(--sph-c); font-weight: 700; padding: 0; }

@media (max-width: 480px) {
	.sph-w__tecla { height: 48px; font-size: .9em; }
	.sph-w__celda { font-size: 1.6em; }
	.sph-ficha, .sph-pdd, .sph-ad__tarjeta { padding: 16px; }
	.sph-boton { width: 100%; }
	.sph-form .sph-boton { width: auto; flex: 1 1 100%; }
}
