:root {
  --fox: #e67e22;
  --fox-deep: #d35400;
  --ink: #2c3e50;
  --paper: #faf8f5;
  --surface: #ffffff;
  --line: #eadfd4;
  --success: #2ecc71;
  --error: #e74c3c;
  --sky: #348aa7;
  --violet: #6c63ff;
  --shadow: 0 18px 45px rgba(44, 62, 80, 0.14);
  --radius: 16px;
  --fast: 160ms ease;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(230, 126, 34, 0.16), transparent 32rem),
    linear-gradient(135deg, var(--paper), #f2fbf6);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  place-items: center;
}

.screen {
  width: 100%;
  animation: rise 320ms ease both;
}

.hidden {
  display: none !important;
}

.screen--login,
.screen--result {
  max-width: 720px;
  padding: clamp(24px, 5vw, 48px);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(234, 223, 212, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.brand-mark,
.result-fox {
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe0bd, #ffffff);
  box-shadow: inset 0 -8px 0 rgba(211, 84, 0, 0.12), 0 12px 24px rgba(211, 84, 0, 0.16);
}

.fox-face,
.result-fox,
.fox-avatar {
  font-size: 58px;
  animation: bob 2.4s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--fox-deep);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 7vw, 4.6rem);
  line-height: 0.98;
}

.intro-copy p:last-child {
  max-width: 560px;
  margin: 0 auto 28px;
  color: #566978;
  font-size: 1.1rem;
}

.login-form {
  max-width: 430px;
  margin: 0 auto;
  display: grid;
  gap: 10px;
  text-align: left;
}

.login-form label {
  font-weight: 900;
}

.login-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  outline: 0;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.login-form input:focus {
  border-color: var(--fox);
  box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.18);
}

.primary-action,
.secondary-action,
.joker-button,
.icon-button {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 900;
  transition: transform var(--fast), filter var(--fast), box-shadow var(--fast), background var(--fast);
}

.primary-action {
  margin-top: 12px;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(180deg, var(--fox), var(--fox-deep));
  box-shadow: 0 8px 0 #a94000;
}

.secondary-action {
  padding: 0 20px;
  color: var(--ink);
  background: #edf5f7;
  box-shadow: 0 6px 0 #c8dce2;
}

.primary-action:hover,
.secondary-action:hover,
.joker-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.primary-action:active,
.secondary-action:active,
.joker-button:active,
.icon-button:active {
  transform: translateY(3px);
  box-shadow: none;
}

.menu-header,
.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-header {
  margin-bottom: 24px;
  justify-content: space-between;
}

.menu-header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.icon-button {
  width: 48px;
  flex: 0 0 48px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.module-card {
  min-height: 280px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: rgba(230, 126, 34, 0.45);
}

.module-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff4e8;
  font-size: 34px;
}

.module-card h3 {
  margin: 0 0 10px;
  font-size: 1.45rem;
}

.module-card p {
  margin: 0;
  color: #5b6d7a;
}

.module-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--fox-deep);
  font-weight: 900;
}

.screen--game {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 24px;
}

.status-bar {
  padding: 12px;
  border: 1px solid rgba(234, 223, 212, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(44, 62, 80, 0.08);
}

.progress-wrap {
  min-width: 120px;
  height: 16px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #ecede9;
}

.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #9be15d);
  transition: width 0.4s ease;
}

.stat,
.life-bar {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 14px;
  background: #fff7ec;
  font-weight: 900;
  white-space: nowrap;
}

.life-bar {
  min-width: 94px;
}

.joker-button {
  width: 52px;
  flex: 0 0 52px;
  background: #eef1ff;
  box-shadow: 0 6px 0 #c3c8f6;
  font-size: 1.25rem;
}

.joker-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.55;
  transform: none;
}

.game-stage {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.fox-guide,
.challenge-area {
  border: 1px solid rgba(234, 223, 212, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.fox-guide {
  position: sticky;
  top: 24px;
  padding: 22px;
  text-align: center;
}

.fox-guide.happy .fox-avatar {
  animation: celebrate 520ms ease both;
}

.fox-guide.sad .fox-avatar {
  animation: shake 420ms ease both;
}

.speech {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: #fff6eb;
  color: #574536;
  font-weight: 800;
}

.challenge-area {
  min-height: 560px;
  padding: clamp(20px, 4vw, 34px);
}

.challenge-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.question-counter {
  margin: 0 0 8px;
  color: #6a7b86;
  font-weight: 900;
}

.question-title {
  margin-bottom: 22px;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  line-height: 1.1;
}

.question-body {
  min-height: 260px;
}

.options-grid,
.word-bank {
  display: grid;
  gap: 12px;
}

.options-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-button,
.match-button,
.word-chip,
.blank-slot {
  min-height: 54px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.option-button:hover,
.match-button:hover,
.word-chip:hover {
  transform: translateY(-2px);
  border-color: var(--fox);
  box-shadow: 0 8px 20px rgba(44, 62, 80, 0.1);
}

.selected {
  border-color: var(--fox);
  background: #fff1df;
}

.correct {
  border-color: var(--success) !important;
  background: rgba(46, 204, 113, 0.16) !important;
}

.wrong {
  border-color: var(--error) !important;
  background: rgba(231, 76, 60, 0.12) !important;
}

.disabled {
  pointer-events: none;
  opacity: 0.42;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.match-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.match-heading {
  margin: 0;
  color: #6a7b86;
  font-weight: 900;
}

.cloze-sentence {
  margin-bottom: 24px;
  padding: 18px;
  border-radius: var(--radius);
  background: #f7fbfc;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.7;
}

.blank-slot {
  min-width: 118px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 4px;
  vertical-align: middle;
  color: #6a7b86;
  background: #fff;
}

.blank-slot.filled {
  color: var(--ink);
  border-color: var(--sky);
}

.word-bank {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.challenge-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.feedback-text {
  min-height: 28px;
  margin: 14px 0 0;
  font-weight: 900;
}

.feedback-text.good {
  color: #1f9f58;
}

.feedback-text.bad {
  color: var(--error);
}

.screen--result {
  position: relative;
  overflow: hidden;
}

.result-burst {
  position: absolute;
  inset: -20px;
  color: rgba(230, 126, 34, 0.18);
  font-size: 16rem;
  animation: spin 14s linear infinite;
}

.result-fox,
.screen--result .eyebrow,
.screen--result h2,
.screen--result p,
.result-actions {
  position: relative;
}

.screen--result h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 7vw, 4rem);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.is-shaking {
  animation: shake 380ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

@keyframes celebrate {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-18px) scale(1.12) rotate(8deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 16px 0;
  }

  .module-grid,
  .game-stage,
  .options-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .fox-guide {
    position: static;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    text-align: left;
  }

  .speech {
    margin: 0;
  }

  .status-bar {
    flex-wrap: wrap;
  }

  .progress-wrap {
    order: 5;
    flex-basis: 100%;
  }
}

@media (max-width: 560px) {
  .screen--login,
  .screen--result,
  .challenge-area,
  .fox-guide {
    padding: 18px;
  }

  .menu-header {
    align-items: flex-start;
  }

  .module-card {
    min-height: 230px;
  }

  .stat {
    flex: 1 1 84px;
  }

  .life-bar {
    flex: 1 1 110px;
  }

  .challenge-actions {
    flex-direction: column;
  }
}


.game-footer {
    background-color: #2C3E50;
    color: #FAF8F5;
    text-align: center;
    padding: 25px 15px; /* Aumentamos ligeramente el espacio interno */
    font-family: sans-serif;
    font-size: 15px; /* 👈 Antes estaba en 13px, al subir a 15px se lee mucho mejor */
    border-top: 4px solid #E67E22;
    margin-top: auto;
}

.footer-content p {
    margin: 6px 0;
    opacity: 0.9;
}

.footer-content span {
    color: #E67E22;
    font-weight: bold;
}

/* Ajustamos el botón de contrato para que vaya acorde al nuevo tamaño de letra */
.footer-contact {
    display: inline-block;
    margin-top: 10px;
    color: #FAF8F5;
    text-decoration: none;
    background-color: rgba(230, 126, 34, 0.2);
    padding: 8px 16px; /* 👈 Un poco más de padding para que se vea imponente */
    font-size: 14px;  /* 👈 Letra del botón más legible */
    border-radius: 20px;
    transition: background 0.3s ease, transform 0.2s ease;
    border: 1px solid rgba(230, 126, 34, 0.4);
}

.footer-contact:hover {
    background-color: #E67E22;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(230, 126, 34, 0.3);
}