:root {
  --green-dark: #2f4d2f;
  --green-mid: #4c7a42;
  --green-light: #8fc97a;
  --green-pale: #eaf6e4;
  --accent: #e8a33d;
  --accent-dark: #c97f1f;
  --text: #2b2b1f;
  --white: #ffffff;
  --radius: 18px;
}

#hdp-app-wrap, #hdp-app-wrap * { box-sizing: border-box; }

#hdp-app-wrap {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #cdeab8 0%, #e9f7df 100%);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  color: var(--text);
}

#hdp-app-root {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--green-pale);
  box-shadow: 0 0 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 0 24px 0;
  animation: fadeIn 0.35s ease;
}

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

.hero-image {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 55vh;
}

@media (orientation: landscape) and (max-height: 600px) {
  .hero-image {
    max-height: 70vh;
    object-fit: contain;
    background: var(--green-dark);
  }
}

.content {
  padding: 18px 22px 4px 22px;
}

h1 {
  font-size: 1.5rem;
  color: var(--green-dark);
  text-align: center;
  margin: 14px 0 4px 0;
}

h2 {
  font-size: 1.15rem;
  color: var(--green-dark);
  margin: 0 0 10px 0;
}

.subtitle {
  text-align: center;
  color: var(--green-mid);
  font-weight: 600;
  margin-bottom: 10px;
}

.speech {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 0;
  font-style: italic;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: relative;
}

.story-text {
  line-height: 1.55;
  margin: 10px 0;
}

.task-box, .riddle-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.task-box h3, .riddle-box h3 {
  margin: 0 0 6px 0;
  color: var(--accent-dark);
  font-size: 1rem;
}

.btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  margin: 10px 0;
  background: var(--green-mid);
  color: var(--white);
  border: none;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease, background 0.2s ease;
  box-shadow: 0 3px 0 var(--green-dark);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--green-dark);
}

.btn.secondary {
  background: var(--accent);
  box-shadow: 0 3px 0 var(--accent-dark);
}

.btn.secondary:active {
  box-shadow: 0 1px 0 var(--accent-dark);
}

.btn:disabled {
  background: #b7c9b2;
  box-shadow: 0 3px 0 #9aab95;
  cursor: not-allowed;
}

.link-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--green-mid);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
  margin: 2px 0 10px 0;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--white);
  border: 2px solid var(--green-mid);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.option-btn .letter-badge {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-mid);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.option-btn.correct {
  background: #d5f2c8;
  border-color: #4a9c2b;
}

.feedback {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
}

.feedback.correct {
  background: #d5f2c8;
  color: #2f6b18;
}

.feedback.wrong {
  background: #fbdada;
  color: #8f2b2b;
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 4px 22px 10px 22px;
}

.station-tile {
  aspect-ratio: 1 / 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: none;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px;
}

.station-tile .num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-dark);
}

.station-tile .label {
  font-size: 0.68rem;
  text-align: center;
  color: var(--green-mid);
  line-height: 1.2;
}

.station-tile.done {
  background: var(--green-mid);
}
.station-tile.done .num,
.station-tile.done .label {
  color: var(--white);
}

.station-tile .letter {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}

.progress-bar-wrap {
  padding: 0 22px;
  margin: 6px 0 10px 0;
}

.progress-bar-bg {
  background: #d7e8cd;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.letters-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.letter-slot {
  width: 40px;
  height: 48px;
  border-radius: 10px;
  background: var(--white);
  border: 2px solid var(--green-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--green-dark);
}

.letter-slot.empty {
  color: #c3c3c3;
  border-style: dashed;
}

.solution-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--green-mid);
  font-size: 1.2rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 12px 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--green-dark);
}

.top-bar button {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 10px;
}

.top-bar .title {
  color: var(--white);
  font-weight: 700;
  font-size: 0.95rem;
}

.small-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--green-mid);
  margin: 8px 0;
}

.credits {
  font-size: 0.75rem;
  color: var(--green-mid);
  text-align: center;
  line-height: 1.5;
  margin-top: 18px;
  padding: 0 12px;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 16px;
}

.social-links img {
  width: 32px;
  height: 32px;
}

.sponsor-logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}

.sponsor-logos a {
  display: block;
  line-height: 0;
}

.sponsor-logos img {
  height: 128px;
  width: auto;
  max-width: 220px;
}

footer.app-footer {
  text-align: center;
  font-size: 0.7rem;
  color: #7f9a76;
  padding: 10px 0 4px 0;
}

.success-screen {
  position: relative;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  overflow: hidden;
  background: linear-gradient(180deg, #cdeab8 0%, #e9f7df 100%);
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0.95;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(85vh) rotate(360deg); opacity: 0.3; }
}

.success-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
  text-align: center;
}

.success-badge {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 0 var(--accent-dark);
  animation: badge-pop 0.6s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes badge-pop {
  0% { transform: scale(0) rotate(-25deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.success-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0;
}

.success-letter {
  width: 42px;
  height: 52px;
  border-radius: 10px;
  background: var(--white);
  color: var(--green-dark);
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 var(--green-mid);
  opacity: 0;
  transform: translateY(18px) scale(0.5);
  animation: letter-in 0.45s ease both;
}

@keyframes letter-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
