* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #070912;
  --card-dark: #101522;
  --card-light: #171d2d;
  --primary: #44d9ff;
  --primary-soft: rgba(68, 217, 255, 0.18);
  --secondary: #9b5cff;
  --secondary-soft: rgba(155, 92, 255, 0.18);
  --danger: #ff315a;
  --danger-soft: rgba(255, 49, 90, 0.2);
  --success: #51ff9d;
  --warning: #ffcc66;
  --text: #f4f7ff;
  --muted: #9ca6bd;
}

body {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(68, 217, 255, 0.16), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(155, 92, 255, 0.17), transparent 32%),
    linear-gradient(145deg, #050711, #0a0d18 45%, #070912);
  overflow-x: hidden;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  opacity: 0.28;
  animation: moveStars 16s linear infinite;
}

@keyframes moveStars {
  from { transform: translateY(0); }
  to { transform: translateY(38px); }
}

.page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 28px);
}

.safe-card {
  position: relative;
  width: min(100%, 430px);
  padding: clamp(24px, 5vw, 36px) clamp(18px, 5vw, 30px) clamp(24px, 5vw, 32px);
  border-radius: clamp(24px, 5vw, 34px);
  background:
    linear-gradient(145deg, rgba(23, 29, 45, 0.96), rgba(10, 14, 25, 0.98)),
    var(--card-dark);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 70px rgba(68, 217, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: 0.4s ease;
}

.safe-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background:
    linear-gradient(120deg, transparent, rgba(68, 217, 255, 0.22), transparent),
    linear-gradient(260deg, transparent, rgba(155, 92, 255, 0.18), transparent);
  opacity: 0.55;
  pointer-events: none;
}

.safe-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  top: -95px;
  right: -95px;
  background: var(--primary-soft);
  filter: blur(70px);
  pointer-events: none;
}

.safe-light {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 54px;
  height: 4px;
  border-radius: 999px;
  background: var(--primary);
  transform: translateX(-50%);
  box-shadow: 0 0 18px var(--primary);
  opacity: 0.85;
}

.sound-button {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 8;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(68, 217, 255, 0.3);
  border-radius: 50%;
  color: var(--primary);
  background: rgba(8, 12, 22, 0.78);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 17px;
  box-shadow: 0 0 22px rgba(68, 217, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: 0.2s ease;
}

.sound-button:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 0 26px rgba(68, 217, 255, 0.22);
}

.sound-button.muted {
  color: var(--danger);
  border-color: rgba(255, 49, 90, 0.45);
  box-shadow: 0 0 22px rgba(255, 49, 90, 0.16);
}

.header,
.display-area,
.keyboard,
.open-button,
.reset-button,
.hint-button {
  position: relative;
  z-index: 2;
}

.header { text-align: center; }

.vault {
  position: relative;
  width: clamp(92px, 24vw, 116px);
  height: clamp(92px, 24vw, 116px);
  margin: 0 auto 18px;
  perspective: 900px;
}

.vault-back {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--success);
  font-size: clamp(28px, 7vw, 40px);
  background:
    radial-gradient(circle at center, rgba(81, 255, 157, 0.24), rgba(7, 15, 14, 0.95) 62%),
    linear-gradient(145deg, #0d241d, #06100f);
  border: 1px solid rgba(81, 255, 157, 0.4);
  box-shadow: inset 0 0 26px rgba(81, 255, 157, 0.16), 0 0 28px rgba(81, 255, 157, 0.08);
}

.vault-door {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle at center, rgba(68, 217, 255, 0.08), transparent 55%),
    linear-gradient(145deg, #263149, #090c14);
  border: 1px solid rgba(68, 217, 255, 0.45);
  box-shadow: 0 0 35px rgba(68, 217, 255, 0.2), inset 0 0 30px rgba(0, 0, 0, 0.6);
  transform-origin: left center;
  transition: transform 1.05s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}

.vault-door::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  border: 2px solid rgba(68, 217, 255, 0.28);
}

.vault-door::after {
  content: "";
  position: absolute;
  inset: 27px;
  border-radius: 50%;
  border: 1px dashed rgba(244, 247, 255, 0.24);
}

.vault-hinge {
  position: absolute;
  left: 7px;
  top: 50%;
  width: 8px;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(to bottom, #44d9ff, #9b5cff);
  transform: translateY(-50%);
  box-shadow: 0 0 14px rgba(68, 217, 255, 0.4);
}

.vault-wheel {
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: clamp(16px, 5vw, 22px);
  background: radial-gradient(circle, rgba(68, 217, 255, 0.16), transparent 62%), #0c111e;
  border: 2px solid rgba(68, 217, 255, 0.55);
  box-shadow: inset 0 0 22px rgba(68, 217, 255, 0.13);
  transition: transform 1s ease, color 0.3s ease;
}

h1 {
  font-size: clamp(27px, 7vw, 34px);
  letter-spacing: -0.8px;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--muted);
  font-size: clamp(13px, 3.3vw, 14px);
  line-height: 1.5;
  margin-bottom: 22px;
}

.code-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2.5vw, 11px);
  padding: clamp(11px, 3vw, 15px);
  margin-bottom: 13px;
  border-radius: 20px;
  background: rgba(5, 8, 15, 0.72);
  border: 1px solid rgba(68, 217, 255, 0.22);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 0 26px rgba(68, 217, 255, 0.07);
  transition: 0.2s ease;
}

.code-display.display-error {
  border-color: rgba(255, 49, 90, 0.7);
  box-shadow: inset 0 0 24px rgba(255, 49, 90, 0.14), 0 0 28px rgba(255, 49, 90, 0.2);
}

.code-display.display-success {
  border-color: rgba(81, 255, 157, 0.8);
  box-shadow: inset 0 0 24px rgba(81, 255, 157, 0.15), 0 0 30px rgba(81, 255, 157, 0.22);
}

.code-slot {
  height: clamp(40px, 11vw, 48px);
  border-radius: 15px;
  border: 1px solid rgba(68, 217, 255, 0.32);
  background: linear-gradient(145deg, rgba(22, 29, 45, 0.9), rgba(9, 12, 22, 0.95));
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: clamp(22px, 6vw, 27px);
  font-weight: 900;
  transition: 0.22s ease;
}

.code-slot.filled {
  border-color: rgba(81, 255, 157, 0.7);
  color: var(--success);
  background: rgba(81, 255, 157, 0.08);
  box-shadow: 0 0 18px rgba(81, 255, 157, 0.18);
  transform: translateY(-3px) scale(1.03);
}

.message {
  min-height: 23px;
  text-align: center;
  font-size: clamp(13px, 3.3vw, 14px);
  color: var(--muted);
  margin-bottom: 8px;
}

.message.success { color: var(--success); }
.message.error { color: var(--danger); }
.message.warning { color: var(--warning); }

.attempt-panel {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-bottom: 18px;
}

.attempts {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.attempts strong { color: var(--primary); }

.attempt-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.attempt-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(156, 166, 189, 0.75);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(156, 166, 189, 0.28);
  font-size: 13px;
  font-weight: 900;
  transition: 0.25s ease;
}

.attempt-dot.failed {
  color: #fff;
  background: rgba(255, 49, 90, 0.95);
  border-color: rgba(255, 49, 90, 1);
  box-shadow: 0 0 16px rgba(255, 49, 90, 0.55), 0 0 34px rgba(255, 49, 90, 0.18);
  transform: scale(1.08);
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(9px, 2.6vw, 13px);
  margin-bottom: 20px;
}

.key {
  position: relative;
  height: clamp(54px, 14vw, 65px);
  border: 0;
  border-radius: 18px;
  color: var(--text);
  font-size: clamp(21px, 6vw, 25px);
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(145deg, rgba(38, 48, 72, 0.98), rgba(16, 21, 34, 0.98));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  overflow: hidden;
  transition: 0.18s ease;
}

.key::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(68, 217, 255, 0.35), transparent 60%);
  transform: scale(0);
  opacity: 0;
  transition: 0.3s ease;
}

.key:hover {
  transform: translateY(-4px);
  color: var(--primary);
  box-shadow: 0 15px 28px rgba(0, 0, 0, 0.42), 0 0 22px rgba(68, 217, 255, 0.11);
}

.key:hover::before {
  transform: scale(1.5);
  opacity: 1;
}

.key:active { transform: translateY(0) scale(0.95); }
.key.clicked { animation: keyPulse 0.28s ease; }

@keyframes keyPulse {
  0% { box-shadow: 0 0 0 rgba(68, 217, 255, 0); }
  50% { box-shadow: 0 0 30px rgba(68, 217, 255, 0.45); }
  100% { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34); }
}

.key.zero { grid-column: 2; }

.open-button,
.reset-button {
  width: 100%;
  height: clamp(58px, 14vw, 66px);
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 900;
  letter-spacing: 0.2px;
  transition: 0.2s ease;
}

.open-button {
  color: #041018;
  background: linear-gradient(135deg, #64e6ff, #44d9ff 45%, #9b5cff);
  box-shadow: 0 14px 34px rgba(68, 217, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.reset-button {
  display: none;
  margin-top: 12px;
  color: #05110c;
  background: linear-gradient(135deg, #51ff9d, #44d9ff);
  box-shadow: 0 14px 34px rgba(81, 255, 157, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.reset-button.visible { display: flex; }

.open-button:hover,
.reset-button:hover {
  transform: translateY(-4px);
  filter: brightness(1.08);
}

.open-button:active,
.reset-button:active { transform: scale(0.97); }

.open-button:disabled,
.key:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.hint-button {
  width: 100%;
  margin-top: 13px;
  border: 0;
  background: transparent;
  color: rgba(156, 166, 189, 0.88);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: 0.2s ease;
}

.hint-button:hover {
  color: var(--primary);
  transform: translateY(-2px);
}

.hint-button i { color: var(--primary); }
.safe-card.opened .hint-button { display: none; }

.key:focus-visible,
.open-button:focus-visible,
.reset-button:focus-visible,
.sound-button:focus-visible,
.hint-button:focus-visible,
.riddle-content button:focus-visible,
.riddle-content input:focus-visible {
  outline: 3px solid rgba(68, 217, 255, 0.85);
  outline-offset: 4px;
}

.shake { animation: shake 0.35s ease; }

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

.safe-card.opened {
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.75), 0 0 90px rgba(81, 255, 157, 0.28);
}

.safe-card.opened .safe-light {
  background: var(--success);
  box-shadow: 0 0 24px var(--success);
}

.safe-card.opened .vault-door {
  transform: rotateY(-118deg) translateX(-8px);
  filter: brightness(1.12);
}

.safe-card.opened .vault-wheel {
  color: var(--success);
  transform: rotate(220deg);
}

.safe-card.opened .open-button { display: none; }

.money-box,
.piggy-box {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.money-box { z-index: 5; }
.piggy-box { z-index: 6; }

.money {
  position: absolute;
  left: 50%;
  bottom: 120px;
  font-size: 32px;
  animation: moneyFly 1.8s ease-out forwards;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
}

@keyframes moneyFly {
  0% { transform: translate(-50%, 0) rotate(0deg) scale(0.4); opacity: 0; }
  20% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--money-x)), var(--money-y)) rotate(var(--money-r)) scale(1.15);
    opacity: 0;
  }
}

.piggy {
  position: absolute;
  left: 50%;
  bottom: 110px;
  font-size: 34px;
  opacity: 0;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
  animation: piggyRise 2.2s ease-out forwards;
}

.hero-piggy {
  position: absolute;
  left: 50%;
  bottom: 105px;
  transform: translateX(-50%) scale(0.4);
  font-size: 82px;
  opacity: 0;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
  animation: heroPiggyPop 1.8s ease forwards;
}

@keyframes piggyRise {
  0% { transform: translate(-50%, 0) rotate(0deg) scale(0.4); opacity: 0; }
  18% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--piggy-x)), var(--piggy-y)) rotate(var(--piggy-r)) scale(1.05);
    opacity: 0;
  }
}

@keyframes heroPiggyPop {
  0% { transform: translateX(-50%) scale(0.25) rotate(-12deg); opacity: 0; }
  35% { transform: translateX(-50%) scale(1.08) rotate(6deg); opacity: 1; }
  60% { transform: translateX(-50%) scale(0.98) rotate(-4deg); opacity: 1; }
  100% { transform: translateX(-50%) scale(1) rotate(0deg); opacity: 0; }
}

.money-rain-box {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.money-rain {
  position: absolute;
  top: -70px;
  font-size: clamp(24px, 5vw, 42px);
  opacity: 0.95;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
  animation: moneyRainFall var(--rain-duration) linear forwards;
}

@keyframes moneyRainFall {
  0% { transform: translateY(-80px) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translateY(calc(100vh + 120px)) rotate(var(--rain-rotation)); opacity: 0.95; }
}

.lock-screen,
.riddle-modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.lock-screen {
  z-index: 50;
  background: radial-gradient(circle at center, rgba(255, 49, 90, 0.22), transparent 35%), rgba(5, 5, 10, 0.92);
}

.lock-screen.active {
  display: grid;
  animation: dangerFlash 0.8s linear infinite;
}

@keyframes dangerFlash {
  0%, 100% { background-color: rgba(5, 5, 10, 0.92); }
  50% { background-color: rgba(90, 0, 18, 0.82); }
}

.lock-content {
  width: min(86vw, 380px);
  padding: 34px 26px;
  text-align: center;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(55, 8, 20, 0.96), rgba(13, 8, 14, 0.98));
  border: 1px solid rgba(255, 49, 90, 0.55);
  box-shadow: 0 0 70px rgba(255, 49, 90, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: lockPop 0.35s ease;
}

@keyframes lockPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.big-lock {
  font-size: 68px;
  margin-bottom: 14px;
  color: var(--danger);
  animation: lockPulse 0.7s ease infinite alternate;
}

@keyframes lockPulse {
  from { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 49, 90, 0.6)); }
  to { transform: scale(1.12); filter: drop-shadow(0 0 24px rgba(255, 49, 90, 0.9)); }
}

.lock-content h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: #fff;
}

.lock-content p {
  color: #ffc2cc;
  line-height: 1.5;
  margin-bottom: 20px;
}

.countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 49, 90, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 49, 90, 0.45);
  font-size: 16px;
}

.countdown strong {
  color: #fff;
  font-size: 24px;
  margin: 0 5px;
}

.siren {
  position: absolute;
  top: 40px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 49, 90, 0.22);
  box-shadow: 0 0 20px rgba(255, 49, 90, 0.9), 0 0 70px rgba(255, 49, 90, 0.55);
  animation: sirenSpin 0.55s linear infinite;
}

.siren::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: var(--danger);
}

.siren-left { left: 10%; }
.siren-right { right: 10%; }

@keyframes sirenSpin {
  0% { opacity: 0.35; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.35; transform: scale(0.95); }
}

/* Modal de enigmas em etapas */
.riddle-modal {
  z-index: 80;
  background: radial-gradient(circle at center, rgba(68, 217, 255, 0.14), transparent 34%), rgba(5, 7, 14, 0.88);
}

.riddle-modal.active { display: grid; }

.riddle-content {
  position: relative;
  width: min(100%, 560px);
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 30px;
  padding: clamp(22px, 5vw, 32px);
  background: linear-gradient(145deg, rgba(23, 29, 45, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(68, 217, 255, 0.22);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62), 0 0 70px rgba(68, 217, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: riddleOpen 0.28s ease;
}

@keyframes riddleOpen {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.close-riddle {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(156, 166, 189, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s ease;
}

.close-riddle:hover {
  color: var(--danger);
  border-color: rgba(255, 49, 90, 0.4);
  transform: rotate(90deg);
}

.riddle-header {
  text-align: center;
  margin-bottom: 22px;
}

.riddle-icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 14px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 28px;
  background: radial-gradient(circle, rgba(68, 217, 255, 0.18), transparent 64%), rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(68, 217, 255, 0.25);
  box-shadow: 0 0 28px rgba(68, 217, 255, 0.12);
}

.riddle-header h2 {
  font-size: clamp(24px, 6vw, 30px);
  margin-bottom: 8px;
}

.riddle-header p {
  color: var(--muted);
  line-height: 1.5;
}

.riddle-progress {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 22px;
}

.progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(156, 166, 189, 0.82);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(156, 166, 189, 0.24);
  font-size: 12px;
  font-weight: 900;
  transition: 0.25s ease;
}

.progress-step.active {
  color: #041018;
  background: linear-gradient(135deg, #64e6ff, #9b5cff);
  border-color: rgba(68, 217, 255, 0.65);
  box-shadow: 0 0 18px rgba(68, 217, 255, 0.22);
}

.progress-step.done {
  color: #05110c;
  background: linear-gradient(135deg, #51ff9d, #44d9ff);
  border-color: rgba(81, 255, 157, 0.65);
}

.progress-line {
  height: 2px;
  border-radius: 999px;
  background: rgba(156, 166, 189, 0.22);
}

.progress-line.done {
  background: linear-gradient(90deg, #51ff9d, #44d9ff);
  box-shadow: 0 0 12px rgba(81, 255, 157, 0.16);
}

.riddle-step {
  display: none;
  padding: clamp(18px, 4vw, 24px);
  border-radius: 24px;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(68, 217, 255, 0.08), transparent 62%),
    rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.075);
  animation: stepIn 0.25s ease;
}

.riddle-step.active { display: block; }

@keyframes stepIn {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

.riddle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #041018;
  background: linear-gradient(135deg, #64e6ff, #9b5cff);
  font-size: 12px;
  font-weight: 900;
}

.riddle-badge.final {
  color: #05110c;
  background: linear-gradient(135deg, #51ff9d, #44d9ff);
}

.riddle-step h3 {
  font-size: clamp(20px, 5vw, 25px);
  margin-bottom: 10px;
}

.riddle-question {
  margin: 12px auto;
  padding: 15px;
  border-radius: 18px;
  color: var(--primary);
  background: rgba(5, 8, 15, 0.72);
  border: 1px solid rgba(68, 217, 255, 0.24);
  font-size: clamp(25px, 8vw, 35px);
  font-weight: 900;
  letter-spacing: 0.4px;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28);
}

.riddle-description,
.final-riddle-text {
  color: rgba(244, 247, 255, 0.84);
  line-height: 1.55;
  margin-top: 8px;
}

.answer-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(5, 8, 15, 0.58);
  border: 1px solid rgba(68, 217, 255, 0.16);
}

.answer-card label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.answer-input-wrap {
  position: relative;
}

.answer-input-wrap i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
}

#riddleAnswerInput {
  width: 100%;
  height: 54px;
  border: 1px solid rgba(68, 217, 255, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 0 16px 0 46px;
  font-size: 19px;
  font-weight: 900;
  outline: none;
  transition: 0.2s ease;
}

#riddleAnswerInput::placeholder {
  color: rgba(156, 166, 189, 0.58);
  font-weight: 700;
}

#riddleAnswerInput:focus {
  border-color: rgba(68, 217, 255, 0.75);
  box-shadow: 0 0 22px rgba(68, 217, 255, 0.16);
  background: rgba(68, 217, 255, 0.055);
}

#riddleAnswerInput.correct {
  border-color: rgba(81, 255, 157, 0.75);
  box-shadow: 0 0 22px rgba(81, 255, 157, 0.16);
}

#riddleAnswerInput.wrong {
  border-color: rgba(255, 49, 90, 0.75);
  box-shadow: 0 0 22px rgba(255, 49, 90, 0.16);
}

.riddle-feedback {
  min-height: 22px;
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.riddle-feedback.success { color: var(--success); }
.riddle-feedback.error { color: var(--danger); }
.riddle-feedback.warning { color: var(--warning); }

.riddle-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.riddle-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 0.2s ease;
}

.secondary-riddle-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(156, 166, 189, 0.2);
}

.check-riddle-button {
  color: #041018;
  background: linear-gradient(135deg, #64e6ff, #44d9ff 45%, #9b5cff);
}

.next-riddle-button {
  color: #05110c;
  background: linear-gradient(135deg, #51ff9d, #44d9ff);
}

.riddle-actions button:hover:not(:disabled) {
  transform: translateY(-3px);
  filter: brightness(1.08);
}

.riddle-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.final-step {
  background:
    radial-gradient(circle at top, rgba(81, 255, 157, 0.12), transparent 62%),
    rgba(81, 255, 157, 0.055);
  border-color: rgba(81, 255, 157, 0.28);
  box-shadow: 0 0 34px rgba(81, 255, 157, 0.08);
}

@media (max-width: 520px) {
  .sound-button {
    width: 38px;
    height: 38px;
    top: 16px;
    right: 16px;
    font-size: 15px;
  }

  .siren {
    width: 64px;
    height: 64px;
    top: 24px;
  }

  .hero-piggy { font-size: 68px; }

  .riddle-content {
    border-radius: 24px;
    padding: 24px 18px;
  }

  .riddle-progress {
    gap: 5px;
  }

  .progress-step {
    width: 27px;
    height: 27px;
    font-size: 11px;
  }

  .riddle-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .safe-card { padding-inline: 15px; }
  .sound-button { top: 14px; right: 14px; }
  .vault { width: 82px; height: 82px; }
  .vault-wheel { inset: 26px; }
  .key { height: 51px; }
  .money { font-size: 26px; }
  .piggy { font-size: 28px; }
  .hero-piggy { font-size: 58px; }
}

@media (max-height: 760px) and (min-width: 521px) {
  .page {
    align-items: start;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .safe-card {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .vault {
    width: 82px;
    height: 82px;
    margin-bottom: 12px;
  }

  .vault-wheel { inset: 27px; }
  .subtitle { margin-bottom: 15px; }
  .keyboard { margin-bottom: 14px; }
}

@media (min-width: 900px) {
  .safe-card { transform: scale(1.02); }
}
