:root {
  --bg-top: #1a6a9f;
  --bg-bottom: #0d4a75;
  --ink: #263547;
  --primary: #ff8c42;
  --primary-dark: #e26f2a;
  --mint: #39c0a7;
  --sky: #4da8ff;
  --danger: #ff5f79;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 14px 38px rgba(38, 53, 71, 0.18);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --ink-black: #1a1a1a;
  --sticker-shadow: 3px 3px 0 var(--ink-black);
  --font-hand: "Patrick Hand", "Trebuchet MS", "Comic Sans MS", cursive;
  --font-display: "Bangers", "Cooper Black", "Trebuchet MS", cursive;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-hand);
  color: var(--ink);
  min-height: 100vh;
  background-color: #1a6a9f;
  background-image:
    radial-gradient(circle 2px at 0 0, rgba(255,255,255,0.22) 1px, transparent 2px),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 59px,
      rgba(255, 255, 255, 0.15) 60px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 59px,
      rgba(255, 255, 255, 0.15) 60px
    ),
    radial-gradient(ellipse 140% 120% at 50% 40%, #2d8fc5 0%, #1a6a9f 40%, #0a3258 100%);
  background-size: 60px 60px, auto, auto, 100% 100%;
  background-position: 0 0, 0 0, 0 0, 0 0;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  font-size: 1.05rem;
}

.bg-blob {
  position: fixed;
  filter: blur(6px);
  opacity: 0.72;
  z-index: 0;
}

.blob-a {
  width: 380px;
  height: 300px;
  background: #c87941;
  border-radius: 42% 58% 38% 62% / 50% 44% 56% 50%;
  left: -90px;
  top: 30px;
}

.blob-b {
  width: 420px;
  height: 320px;
  background: #5a8f4e;
  border-radius: 58% 42% 62% 38% / 44% 56% 44% 56%;
  right: -120px;
  top: 150px;
}

.blob-c {
  width: 280px;
  height: 250px;
  background: #c89c32;
  border-radius: 48% 52% 55% 45% / 52% 48% 52% 48%;
  left: 18%;
  bottom: -80px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  padding: 22px 0 28px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: fade-in 0.35s ease;
}

.card {
  background: var(--card);
  border: 3px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.start-card,
.feedback-card,
.final-card {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  padding: 32px 28px;
}

.start-card h1,
.final-card h2 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  color: var(--ink-black);
  text-shadow: 2px 2px 0 rgba(255, 140, 66, 0.35);
  margin: 10px 0 14px;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.05;
}

.lead {
  max-width: 640px;
  margin: 0 auto 22px;
  font-size: 1.25rem;
  line-height: 1.5;
}

.difficulty-picker h2 {
  margin: 10px 0 12px;
  font-size: 1.3rem;
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.difficulty-option {
  cursor: pointer;
  position: relative;
  text-align: left;
  background: #fff8e7;
  border: 3px solid var(--ink-black);
  border-radius: var(--radius-lg);
  padding: 12px 12px 10px;
  box-shadow: var(--sticker-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    background 0.18s ease;
}

.difficulty-option:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--ink-black);
}

.difficulty-option.selected {
  background: #ffe1b3;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink-black);
}

.difficulty-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.difficulty-name {
  display: block;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 1.5rem;
  margin-bottom: 0;
  text-align: center;
  color: var(--ink-black);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--sticker-shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--ink-black);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink-black);
}

.btn-primary {
  background: var(--primary);
  color: var(--ink-black);
}

.btn-primary:hover {
  background: #ffa45c;
}

.btn-xl {
  padding: 14px 28px;
  font-size: 1.45rem;
}

.start-card #start-game-btn {
  margin-top: 10px;
}

.btn-ghost {
  background: #fff8e7;
  color: var(--ink-black);
  padding: 10px 16px;
  font-size: 1.05rem;
}

.game-card {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lives-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 12px;
  background: #ffd5dc;
  color: var(--ink-black);
  border: 3px solid var(--ink-black);
  box-shadow: var(--sticker-shadow);
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 12px;
  background: #c7f1e6;
  color: var(--ink-black);
  border: 3px solid var(--ink-black);
  box-shadow: var(--sticker-shadow);
  font-family: var(--font-hand);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.score-label {
  display: inline-block;
  background: #fdedb8;
  color: var(--ink-black);
  border: 3px solid var(--ink-black);
  box-shadow: var(--sticker-shadow);
  border-radius: 12px;
  padding: 8px 16px;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.meter-wrap {
  margin-top: 16px;
  margin-bottom: 8px;
}

.meter {
  height: 15px;
  border-radius: 999px;
  background: #e5eef7;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), #76d7ff);
  transition: width 0.32s ease;
}

.food-zone {
  margin: 18px auto 8px;
  text-align: center;
}

.food-image-wrap {
  width: min(370px, 84vw);
  aspect-ratio: 16 / 11;
  margin: 0 auto;
  border-radius: 18px;
  background: #ffffff;
  border: 3px solid var(--ink-black);
  box-shadow: var(--sticker-shadow);
  position: relative;
  overflow: hidden;
}

#food-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.food-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #f7fcff, #eef5ff);
}

.food-placeholder span {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cooper Black", "Trebuchet MS", "Comic Sans MS", cursive;
  font-size: 2rem;
  color: #38607f;
  background: #d7eaff;
}

.food-name {
  margin: 14px 0 4px;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: clamp(2.1rem, 5.6vw, 2.8rem);
  color: var(--ink-black);
  text-shadow: 2px 2px 0 rgba(255, 140, 66, 0.35);
}

.question-text {
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 6px 0 14px;
  color: var(--ink-black);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.option-btn {
  min-height: 68px;
  border-radius: 14px;
  border: 3px solid var(--ink-black);
  background: #fff8e7;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink-black);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: var(--sticker-shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease,
    background 0.16s ease;
}

.option-btn:hover:not(:disabled) {
  transform: translate(-1px, -2px);
  background: #ffeec8;
  box-shadow: 4px 5px 0 var(--ink-black);
}

.option-btn:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink-black);
}

.option-btn:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.game-footer {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}


.feedback-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  border: 3px solid var(--ink-black);
  padding: 12px 22px 12px 18px;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  font-weight: 400;
  margin: 0 auto 16px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  box-shadow: var(--sticker-shadow);
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}

.feedback-badge::before {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  border: 3px solid var(--ink-black);
  font-family: var(--font-hand);
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1;
  background: #fff;
}

.feedback-badge.good {
  color: var(--ink-black);
  background: #b8f5d6;
}

.feedback-badge.good::before {
  content: "✓";
  background: #2bbf6f;
  color: #fff;
}

.feedback-badge.bad {
  color: var(--ink-black);
  background: #ffc7d2;
}

.feedback-badge.bad::before {
  content: "✗";
  background: #e63950;
  color: #fff;
}

.feedback-answer,
.feedback-fun-fact,
.feedback-level-up,
.final-summary,
.final-details {
  font-size: 1.05rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.feedback-answer {
  font-size: clamp(1.2rem, 2.6vw, 1.55rem);
  font-weight: 800;
  margin-top: 4px;
  margin-bottom: 12px;
  color: #1c3f5e;
}

.feedback-fun-fact {
  font-size: 1.2rem;
  line-height: 1.55;
  color: #2b4f70;
  margin-bottom: 0;
  background: #f0f8ff;
  border: 2px solid #d6e9ff;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
}

.feedback-body {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 12px 0;
  text-align: left;
}

.feedback-left {
  flex: 0 0 42%;
}

.feedback-right {
  flex: 1;
  min-width: 0;
}

.feedback-map-wrap {
  padding: 10px;
  border-radius: 16px;
  border: 2px solid #d7e8f8;
  background: #fbfdff;
}

.country-map {
  width: 100%;
  min-height: 230px;
  border-radius: 12px;
  background: #eff7ff;
  overflow: hidden;
}

.feedback-level-up {
  background: #e4f9ff;
  color: #1f5273;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
}

/* ── Twemoji emoji images ── */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 0.05em 0 0.05em;
  vertical-align: -0.15em;
  display: inline;
}

/* ── Country picker ── */
.country-picker {
  margin: 16px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.country-picker-label {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--ink-black);
}

.country-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff8e7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231a1a1a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  box-shadow: var(--sticker-shadow);
  padding: 10px 40px 10px 16px;
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--ink-black);
  cursor: pointer;
  min-width: 220px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.country-select:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--ink-black);
}

.country-select:focus {
  outline: none;
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--ink-black);
}

/* ── Level-up screen ── */
.levelup-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 40px 28px;
}

.levelup-stars {
  font-size: 2rem;
  letter-spacing: 0.2em;
  margin-bottom: 12px;
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.levelup-headline {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 5rem);
  color: var(--ink-black);
  text-shadow: 3px 3px 0 rgba(255, 140, 66, 0.5);
  margin: 0 0 10px;
  letter-spacing: 0.04em;
  animation: levelup-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.levelup-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: #1f5273;
  background: #e4f9ff;
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  padding: 12px 20px;
  box-shadow: var(--sticker-shadow);
  margin: 0 auto 14px;
  max-width: 400px;
  letter-spacing: 0.03em;
}

.levelup-subtitle {
  font-size: 1.2rem;
  color: #2b4f70;
  margin: 0 0 24px;
}

/* ── Wildcard screen ── */
.wildcard-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 32px 28px;
}

.wildcard-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  padding: 10px 22px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.05em;
  background: #ffe1b3;
  box-shadow: var(--sticker-shadow);
  margin: 0 auto 10px;
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wildcard-badge::before {
  content: "⭐";
  font-size: 0.85em;
}

.wildcard-subtitle {
  font-size: 1.15rem;
  color: var(--ink-black);
  margin: 0 0 20px;
}

.wildcard-question {
  margin-bottom: 18px;
}

.wildcard-fact-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1c3f5e;
  margin: 0 0 10px;
}

.wildcard-fact {
  background: #f0f8ff;
  border: 2px solid #d6e9ff;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1.05rem;
  color: #2b4f70;
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

.wildcard-big-flag {
  font-size: 5rem;
  line-height: 1;
  margin: 10px 0;
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wildcard-result {
  margin: 16px auto 12px;
  font-size: 1.2rem;
  font-weight: 700;
  max-width: 560px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 3px solid var(--ink-black);
  box-shadow: var(--sticker-shadow);
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wildcard-result--win {
  background: #b8f5d6;
  color: var(--ink-black);
}

.wildcard-result--lose {
  background: #ffc7d2;
  color: var(--ink-black);
}

/* ── Creative writing (pantalla final) ── */
.creative-writing {
  margin: 16px auto 24px;
  max-width: 620px;
  text-align: left;
}

.creative-label {
  display: block;
  font-size: 1.05rem;
  color: var(--ink-black);
  margin-bottom: 10px;
  line-height: 1.5;
}

.creative-textarea {
  width: 100%;
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  box-shadow: var(--sticker-shadow);
  padding: 12px 14px;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--ink-black);
  background: #fff8e7;
  resize: vertical;
  min-height: 90px;
  transition: box-shadow 0.16s ease;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.creative-textarea:focus {
  outline: none;
  box-shadow: 4px 5px 0 var(--ink-black);
}

.creative-textarea.shake {
  animation: shake 0.35s ease;
}

.writeup-status {
  margin: 10px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f6b3a;
  background: #b8f5d6;
  border: 3px solid var(--ink-black);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--sticker-shadow);
  animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[hidden] {
  display: none !important;
}

@keyframes levelup-bounce {
  0%   { transform: scale(0.5) rotate(-6deg); opacity: 0; }
  60%  { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    transform: scale(0.75);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px 0 14px;
  }

  .start-card,
  .feedback-card,
  .final-card {
    padding: 18px 14px;
  }

  .game-card {
    padding: 10px 12px 12px;
  }

  .start-card h1,
  .final-card h2 {
    font-size: clamp(2rem, 7.5vw, 2.4rem);
    margin: 4px 0 8px;
  }

  .lead {
    font-size: 1.1rem;
    margin-bottom: 14px;
  }

  .difficulty-options {
    gap: 8px;
    margin-bottom: 10px;
  }

  .difficulty-option {
    padding: 8px 10px;
  }

  .difficulty-name {
    font-size: 1.25rem;
  }

  .btn-xl {
    padding: 11px 22px;
    font-size: 1.2rem;
  }

  .game-header {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }

  .lives-label,
  .level-pill {
    padding: 4px 10px;
    font-size: 0.95rem;
    border-width: 2px;
  }

  .btn-ghost {
    padding: 5px 10px;
    font-size: 0.9rem;
    border-width: 2px;
  }

  .meter-wrap {
    margin-top: 10px;
    margin-bottom: 4px;
  }

  .meter {
    height: 10px;
  }

  .food-zone {
    margin: 8px auto 4px;
  }

  .food-image-wrap {
    width: min(260px, 70vw);
    border-width: 2px;
    box-shadow: 2px 2px 0 var(--ink-black);
  }

  .food-name {
    font-size: clamp(1.6rem, 6vw, 2rem);
    margin: 6px 0 0;
  }

  .question-text {
    font-size: 1.05rem;
    margin: 4px 0 8px;
  }

  .options-grid {
    gap: 7px;
  }

  .option-btn {
    min-height: 50px;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-width: 2px;
    box-shadow: 2px 2px 0 var(--ink-black);
  }

  .game-footer {
    margin-top: 8px;
  }

  .score-label {
    padding: 4px 12px;
    font-size: 0.95rem;
    border-width: 2px;
  }

  .feedback-badge {
    padding: 8px 16px 8px 12px;
    margin-bottom: 10px;
    font-size: clamp(1.3rem, 5vw, 1.7rem);
    border-width: 2px;
  }

  .feedback-answer {
    font-size: 1.05rem;
    margin-bottom: 8px;
  }

  .feedback-fun-fact {
    font-size: 1.05rem;
    padding: 9px 11px;
  }

  .feedback-body {
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
  }

  .feedback-left {
    flex: none;
    width: 100%;
  }

  .feedback-map-wrap {
    padding: 6px;
  }

  .country-map {
    min-height: 150px;
  }

  .map-flag {
    font-size: 1.8rem;
  }

  .country-select {
    font-size: 1.05rem;
    padding: 8px 36px 8px 12px;
    min-width: 180px;
  }

  .levelup-card,
  .wildcard-card {
    padding: 20px 14px;
  }

  .levelup-headline {
    font-size: clamp(2.4rem, 8vw, 3.2rem);
  }

  .levelup-title {
    font-size: 1.3rem;
    padding: 8px 14px;
    border-width: 2px;
  }

  .levelup-stars {
    font-size: 1.5rem;
  }

  .wildcard-badge {
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    padding: 7px 14px;
    border-width: 2px;
  }

  .wildcard-big-flag {
    font-size: 3.5rem;
  }

  .wildcard-result {
    font-size: 1rem;
    padding: 8px 12px;
    border-width: 2px;
  }

  .creative-textarea {
    font-size: 0.95rem;
    padding: 9px 10px;
    border-width: 2px;
  }
}
