: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;
}

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;
}

.input-group input {
  width: 100%;
  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;
}

.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);
  }
}

@media (max-width: 768px) {
  .input-group {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .helper-row {
    flex-direction: column;
    align-items: stretch;
  }

  .small-danger-btn {
    width: 100%;
  }

  .modal-content {
    margin: 8vh auto;
    width: 92vw;
  }
}

/* ===== 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;
}

@media (max-width: 768px) {
  .export-actions {
    justify-content: stretch;
  }

  .download-btn {
    width: 100%;
  }
}