:root {
  --bg: #0b1220;
  --bg2: #101827;
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #334155;
  --secondary-hover: #475569;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --accent: #38bdf8;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  --radius: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 30%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.15), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.hero-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #93c5fd;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  margin-bottom: 10px;
  color: white;
  line-height: 1.05;
}

.hero p {
  color: var(--muted);
  max-width: 700px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.5;
}

.glass-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.translator-card,
.credits-card {
  padding: 20px;
  margin-bottom: 24px;
}

.input-group {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: stretch;
}

.input-group input {
  width: 100%;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.25s ease;
}

.input-group input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.input-group input::placeholder {
  color: #94a3b8;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: 0.25s ease;
}

button:hover {
  transform: translateY(-1px);
}

#translateBtn {
  background: var(--primary);
  color: white;
}

#translateBtn:hover {
  background: var(--primary-hover);
}

button.secondary {
  background: var(--secondary);
  color: white;
}

button.secondary:hover {
  background: var(--secondary-hover);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cfe8ff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.small-danger-btn {
  background: rgba(220, 38, 38, 0.12);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 10px 14px;
  font-size: 0.85rem;
  border-radius: 14px;
}

.small-danger-btn:hover {
  background: rgba(220, 38, 38, 0.2);
}

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.helper-text {
  color: var(--muted);
  font-size: 0.9rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.section-title h2 {
  font-size: 1.25rem;
}

.section-title span {
  color: #93c5fd;
  font-size: 0.95rem;
}

.action-title {
  flex-wrap: wrap;
}

.quick-words-section,
.keyboard-section,
.result-section,
.panel-section {
  margin-bottom: 24px;
  scroll-margin-top: 18px;
}

.chips-container,
.panel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.panel-item,
.key-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: white;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.chip:hover,
.panel-item:hover,
.key-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 10px;
}

.key-btn {
  text-align: center;
  font-weight: 800;
  padding: 14px 8px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.sign-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: 0.25s ease;
}

.sign-card:hover {
  transform: translateY(-4px);
}

.sign-card .card-top {
  padding: 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(56, 189, 248, 0.12));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sign-card .card-letter {
  font-size: 2rem;
  font-weight: 900;
  color: white;
}

.sign-card .card-type {
  font-size: 0.9rem;
  color: #93c5fd;
  margin-top: 4px;
}

.sign-card .card-body {
  padding: 16px;
}

.sign-card .card-body p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 14px;
}

.sign-card .card-body img {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: block;
  background: white;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sign-card .card-body img:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.empty-state {
  width: 100%;
  text-align: center;
  padding: 20px;
  background: var(--card);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 18px;
}

.result-section .empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  border-radius: 22px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.empty-state p {
  color: var(--muted);
  font-size: 1rem;
}

.credits-card p {
  color: var(--muted);
  line-height: 1.6;
}

.credits-block {
  margin-bottom: 14px;
}

.credits-block:last-child {
  margin-bottom: 0;
}

.credits-block strong {
  color: #93c5fd;
}

.credits-block p {
  margin-bottom: 6px;
}

.signature-line {
  margin-top: 16px;
  text-align: center;
  font-weight: 700;
  color: #cfe8ff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.app-footer {
  margin-top: 28px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-footer p:first-child {
  color: #cfe8ff;
  font-size: 1rem;
  margin-bottom: 6px;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 2;
  width: min(90vw, 700px);
  margin: 5vh auto;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
  animation: modalPop 0.25s ease;
}

.modal-content img {
  width: 100%;
  border-radius: 18px;
  background: white;
  display: block;
}

.modal-content p {
  margin-top: 14px;
  text-align: center;
  color: #cfe8ff;
  font-weight: 700;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.1rem;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ===== VERSION 4: DESCARGA DE RESULTADO ===== */

#exportArea {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 30%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.08), transparent 30%);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 8px;
}

.export-actions-section {
  margin-bottom: 24px;
}

.export-actions {
  display: flex;
  justify-content: flex-end;
}

.download-btn {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  box-shadow: 0 12px 24px rgba(22, 163, 74, 0.2);
}

.download-btn:hover {
  filter: brightness(1.05);
}

.download-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.export-header {
  grid-column: 1 / -1;
  text-align: center;
  padding: 10px 8px 18px;
}

.export-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #93c5fd;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.export-header h3 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  color: white;
  margin-bottom: 8px;
}

.export-header p {
  color: #cbd5e1;
  font-size: 0.95rem;
}

.export-footer {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 8px;
  padding-top: 10px;
}

.export-footer p {
  color: #cfe8ff;
  font-weight: 700;
  font-size: 0.92rem;
}

/* =========================
   BOTÓN A LESHO PLAY
========================= */
.hub-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.hub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 16px;
  font-weight: 800;
  transition: all 0.25s ease;
  padding: 14px 22px;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.play-link-btn {
  color: white;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

.play-link-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

/* =========================
   RESPONSIVE PRO (TABLET)
========================= */
@media (max-width: 900px) {
  body {
    padding: 18px;
  }

  .hero {
    margin-bottom: 22px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 9vw, 4rem);
  }

  .hero p {
    font-size: 0.98rem;
    padding: 0 6px;
  }

  .translator-card,
  .credits-card {
    padding: 18px;
  }

  .input-group {
    grid-template-columns: 1fr;
  }

  .input-group button {
    width: 100%;
  }

  .helper-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost-btn {
    width: 100%;
  }

  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .small-danger-btn {
    width: 100%;
  }

  .export-actions {
    justify-content: stretch;
  }

  .download-btn {
    width: 100%;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .modal-content {
    margin: 8vh auto;
    width: 92vw;
  }
}

/* =========================
   RESPONSIVE PRO (MÓVIL)
========================= */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .app-container {
    max-width: 100%;
  }

  .hero {
    margin-bottom: 18px;
  }

  .hero-badge {
    font-size: 0.82rem;
    padding: 8px 12px;
    margin-bottom: 12px;
  }

  .hero h1 {
    font-size: clamp(2rem, 12vw, 3rem);
    margin-bottom: 10px;
  }

  .hero p {
    font-size: 0.94rem;
    line-height: 1.45;
  }

  .hub-actions {
    margin-top: 14px;
  }

  .hub-btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 18px;
  }

  .glass-card {
    border-radius: 20px;
  }

  .translator-card,
  .credits-card {
    padding: 14px;
    margin-bottom: 18px;
  }

  .input-group {
    gap: 10px;
  }

  .input-group input {
    font-size: 16px; /* evita zoom raro en iPhone */
    padding: 14px 14px;
    border-radius: 14px;
  }

  button {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
  }

  .helper-row {
    gap: 10px;
    margin-top: 10px;
  }

  .helper-text {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .section-title {
    margin-bottom: 12px;
    gap: 8px;
  }

  .section-title h2 {
    font-size: 1.12rem;
  }

  .section-title span {
    font-size: 0.9rem;
  }

  .quick-words-section,
  .keyboard-section,
  .result-section,
  .panel-section {
    margin-bottom: 18px;
  }

  .chips-container,
  .panel-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .chip,
  .panel-item {
    width: 100%;
    text-align: center;
    padding: 12px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .keyboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .key-btn {
    padding: 12px 6px;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  #exportArea {
    padding: 12px;
    border-radius: 20px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sign-card {
    border-radius: 18px;
  }

  .sign-card .card-top {
    padding: 14px;
  }

  .sign-card .card-letter {
    font-size: 1.7rem;
  }

  .sign-card .card-type {
    font-size: 0.85rem;
  }

  .sign-card .card-body {
    padding: 14px;
  }

  .sign-card .card-body p {
    font-size: 0.9rem;
    margin-bottom: 12px;
  }

  .sign-card .card-body img {
    border-radius: 14px;
  }

  .empty-state {
    padding: 16px;
    border-radius: 16px;
  }

  .result-section .empty-state {
    padding: 28px 16px;
    border-radius: 18px;
  }

  .empty-icon {
    font-size: 2.3rem;
    margin-bottom: 8px;
  }

  .export-header {
    padding: 4px 4px 14px;
  }

  .export-badge {
    font-size: 0.76rem;
    padding: 5px 10px;
    margin-bottom: 10px;
  }

  .export-header h3 {
    font-size: clamp(1.3rem, 7vw, 1.8rem);
  }

  .export-header p {
    font-size: 0.88rem;
  }

  .export-footer p {
    font-size: 0.85rem;
  }

  .credits-card p {
    font-size: 0.92rem;
  }

  .signature-line {
    font-size: 0.92rem;
  }

  .app-footer {
    margin-top: 20px;
    padding: 16px 10px;
  }

  .app-footer p {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .app-footer p:first-child {
    font-size: 0.95rem;
  }

  .modal-content {
    padding: 14px;
    border-radius: 18px;
    margin: 6vh auto;
  }

  .modal-content img {
    border-radius: 14px;
  }

  .modal-content p {
    font-size: 0.9rem;
  }

  .modal-close {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}

/* =========================
   MÓVIL PEQUEÑITO
========================= */
@media (max-width: 420px) {
  .keyboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chips-container,
  .panel-list {
    grid-template-columns: 1fr 1fr;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 11vw, 2.5rem);
  }
}
/* =========================
   RETOQUE PREMIUM FINAL MÓVIL
========================= */
@media (max-width: 600px) {
  /* HERO más compacto */
  .hero {
    margin-bottom: 14px;
  }

  .hero-badge {
    font-size: 0.78rem;
    padding: 7px 11px;
    margin-bottom: 10px;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
    line-height: 1.05;
    margin-bottom: 8px;
  }

  .hero p {
    font-size: 0.9rem;
    line-height: 1.35;
    max-width: 92%;
    margin: 0 auto;
  }

  .hub-actions {
    margin-top: 12px;
    margin-bottom: 4px;
  }

  .hub-btn {
    max-width: 260px;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 14px;
  }

  /* Card principal más tipo app */
  .translator-card {
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 18px;
  }

  .input-group {
    gap: 8px;
  }

  .input-group input {
    padding: 13px 14px;
    border-radius: 13px;
    font-size: 15px;
  }

  #translateBtn,
  #clearBtn {
    padding: 13px 14px;
    font-size: 0.95rem;
    border-radius: 13px;
  }

  .helper-row {
    gap: 8px;
    margin-top: 8px;
  }

  .helper-text {
    font-size: 0.82rem;
    line-height: 1.35;
    color: #b9c8dc;
  }

  #favoriteBtn {
    padding: 12px 14px;
    font-size: 0.9rem;
    border-radius: 13px;
  }

  /* Títulos de sección un poco más finos */
  .section-title h2 {
    font-size: 1.05rem;
  }

  .section-title span {
    font-size: 0.85rem;
  }

  /* Palabras rápidas más bonitas */
  .chips-container {
    gap: 8px;
  }

  .chip {
    padding: 11px 8px;
    font-size: 0.88rem;
    font-weight: 800;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.05));
  }

  /* Teclado visual más compacto */
  .keyboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .key-btn {
    padding: 11px 4px;
    min-height: 46px;
    font-size: 0.9rem;
    border-radius: 11px;
  }

  /* Resultados más limpios */
  #exportArea {
    padding: 10px;
    border-radius: 18px;
  }

  .cards-grid {
    gap: 10px;
  }

  .sign-card {
    border-radius: 16px;
  }

  .sign-card .card-top {
    padding: 12px;
  }

  .sign-card .card-letter {
    font-size: 1.5rem;
  }

  .sign-card .card-type {
    font-size: 0.8rem;
  }

  .sign-card .card-body {
    padding: 12px;
  }

  .sign-card .card-body p {
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 10px;
  }

  .sign-card .card-body img {
    border-radius: 12px;
  }

  /* Favoritos / historial más ordenados */
  .panel-list {
    gap: 8px;
  }

  .panel-item {
    padding: 11px 8px;
    font-size: 0.88rem;
    border-radius: 12px;
  }

  .small-danger-btn {
    padding: 11px 12px;
    font-size: 0.82rem;
    border-radius: 12px;
  }

  /* Footer más compacto */
  .app-footer {
    margin-top: 16px;
    padding: 14px 8px;
  }

  .app-footer p {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .app-footer p:first-child {
    font-size: 0.9rem;
  }
}
/* =========================
   STICKY HEADER MÓVIL GOD MODE
========================= */
@media (max-width: 600px) {
  .sticky-translator {
    position: sticky;
    top: 10px;
    z-index: 80;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow:
      0 12px 28px rgba(0, 0, 0, 0.35),
      0 0 0 1px rgba(56, 189, 248, 0.04);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
  }

  /* separa mejor del contenido cuando se queda pegado */
  .sticky-translator + .quick-words-section {
    margin-top: 18px;
  }

  /* compactar un poquito más para sticky */
  .sticky-translator .input-group {
    gap: 8px;
  }

  .sticky-translator .input-group input {
    min-height: 48px;
  }

  .sticky-translator #translateBtn,
  .sticky-translator #clearBtn,
  .sticky-translator #favoriteBtn {
    min-height: 46px;
  }

  /* cuando haces scroll, que las secciones no queden escondidas detrás */
  .quick-words-section,
  .keyboard-section,
  .result-section,
  .panel-section {
    scroll-margin-top: 190px;
  }

  /* mejora visual de stacking en móviles */
  .sticky-translator::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -10px;
    height: 14px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(11,18,32,0.18), rgba(11,18,32,0));
    border-radius: 0 0 18px 18px;
  }
}

/* tablet pequeña también se beneficia */
@media (min-width: 601px) and (max-width: 900px) {
  .sticky-translator {
    position: sticky;
    top: 12px;
    z-index: 60;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  }

  .quick-words-section,
  .keyboard-section,
  .result-section,
  .panel-section {
    scroll-margin-top: 170px;
  }
}