/* ------------------------------------------------------
   Layout
------------------------------------------------------ */
.game-wrap {
  padding-top: calc(var(--header-h) + var(--safe-top) + 14px);
  padding-right: max(12px, var(--safe-right));
  padding-left: max(12px, var(--safe-left));
  padding-bottom: max(16px, var(--safe-bottom));
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-container {
  width: min(760px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.hidden {
  display: none !important;
}

.game-title {
  font-weight: 800;
  font-size: clamp(1.2rem, 2.4vw + 0.8rem, 2rem);
}

/* HUD */
.hud {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.pill {
  background: rgba(1, 54, 74, 0.55);
  border: 1px solid rgba(241, 246, 245, 0.14);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: clamp(0.95rem, 2vw + 0.4rem, 1rem);
}

/* ------------------------------------------------------
   Email card (gradient border + chrome + ribbon)
------------------------------------------------------ */
.email-card {
  position: relative;
  text-align: right;
  overflow: hidden;
  border-radius: var(--radius);
  /* gradient border like the mock */
  background: linear-gradient(#f6fbfa, #ffffff) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-warm))
      border-box;
  border: 3px solid transparent;
  box-shadow: var(--shadow);
  color: #0a1f24;
  padding: clamp(12px, 2.6vw, 22px);
}

/* top “window” chrome */
.email-chrome {
  position: relative;
  height: 36px;
  background: linear-gradient(90deg, #f3faf7 0, #e8f5f1 100%),
    repeating-linear-gradient(90deg, rgba(0, 157, 79, 0.18) 0 12px,
      rgba(254, 200, 36, 0.18) 12px 24px);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid #eee;
}
.email-chrome .dots {
  position: absolute;
  top: 8px;
  left: 10px;
  display: flex;
  gap: 6px;
}
.email-chrome .dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 16px 0 0 var(--accent-2), 32px 0 0 var(--accent-warm);
}

/* ribbon (neutral text so it doesn’t reveal status) */
.email-card[data-badge]::before {
  content: attr(data-badge);
  position: absolute;
  top: -14px;
  left: -14px;
  transform: rotate(-6deg);
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px,
      var(--accent-2) 8px 16px);
  color: var(--bg);
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.email-subject {
  font-size: clamp(1.05rem, 2.2vw + 0.6rem, 1.35rem);
  margin-bottom: 6px;
}
.email-meta {
  opacity: 0.75;
  margin-bottom: 10px;
  font-size: clamp(0.92rem, 2vw + 0.4rem, 1rem);
}
.email-content {
  line-height: 1.8;
  font-size: clamp(0.98rem, 2vw + 0.45rem, 1.06rem);
  word-break: break-word;
}
.email-content a {
  color: var(--accent);
  text-decoration: underline;
  pointer-events: none;
}

/* tag pills (neutral) */
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #0a1f24;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, rgba(124, 186, 88, 0.85),
      rgba(0, 157, 79, 0.95));
}

/* review card keeps the same styling + scroll */
.email-card.small {
  max-height: 56dvh;
  overflow: auto;
  background: linear-gradient(#f6fbfa, #ffffff) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-warm))
      border-box;
  border: 3px solid transparent;
}

/* ------------------------------------------------------
   Buttons (unified system)
------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: clamp(1rem, 2.6vw + 0.4rem, 1.05rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
  box-shadow: var(--shadow);
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}
.btn.primary {
  background: var(--accent);
  color: #f5fdf9;
}
.btn.secondary {
  background: rgba(1, 54, 74, 0.75);
  color: var(--ink);
  border: 1px solid rgba(241, 246, 245, 0.12);
}
.btn.ghost {
  background: rgba(241, 246, 245, 0.08);
  color: var(--ink-strong);
  border: 1px solid rgba(241, 246, 245, 0.18);
}
.btn.danger {
  background: var(--accent-warm);
  color: #0a1f24;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}
.end-actions {
  margin-top: 16px;
}

/* ------------------------------------------------------
   Modals
------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 43, 60, 0.68);
  z-index: 100;
}
.modal.hidden {
  display: none;
}
.modal-content {
  width: min(720px, 94vw);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.6vw, 28px);
  text-align: right;
  position: relative;
  border: 1px solid rgba(241, 246, 245, 0.08);
}
.modal-content.center {
  text-align: center;
}
.modal-content h2 {
  font-size: clamp(1.1rem, 2.2vw + 0.7rem, 1.4rem);
  margin-bottom: 8px;
}
.modal-content p {
  line-height: 1.8;
}
.close {
  position: absolute;
  left: 12px;
  top: 8px;
  font-size: 28px;
  font-weight: 900;
  color: var(--accent-warm);
  cursor: pointer;
}

/* Responsive */
@media (max-width: 420px) {
  .action-buttons {
    grid-template-columns: 1fr;
  }
}
/* Review explanation — red like the original */
.explanation {
  color: var(--accent);
  font-weight: 800;    /* bold */
  white-space: pre-wrap; /* keep line breaks from JS */
  margin-top: 10px;
}

/* ------------------------------------------------------
   Win/Lose Result Screen
------------------------------------------------------ */
.result-modal {
  text-align: center;
  padding: clamp(24px, 3vw, 36px) !important;
}

.result-icon {
  font-size: clamp(4rem, 10vw, 7rem);
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease;
}

.result-title {
  font-size: clamp(1.5rem, 3vw + 1rem, 2.2rem) !important;
  font-weight: 900;
  margin-bottom: 12px !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-summary {
  font-size: clamp(1rem, 2vw + 0.5rem, 1.2rem);
  line-height: 1.6;
  margin-bottom: 16px;
  opacity: 0.95;
}

.result-score {
  background: rgba(0, 157, 79, 0.12);
  border: 2px solid rgba(0, 157, 79, 0.25);
  border-radius: 16px;
  padding: 16px 24px;
  margin: 20px auto;
  display: inline-block;
}

.final-score-text {
  font-size: clamp(1.2rem, 2.5vw + 0.8rem, 1.8rem);
  font-weight: 900;
  color: var(--accent-warm);
}

/* Win state */
.result-modal.win .result-title {
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(0, 157, 79, 0.35);
}

.result-modal.win .result-icon {
  filter: drop-shadow(0 4px 12px rgba(0, 157, 79, 0.45));
}

/* Lose state */
.result-modal.lose .result-title {
  color: #1f8a99;
  text-shadow: 0 2px 8px rgba(31, 138, 153, 0.35);
}

.result-modal.lose .result-icon {
  filter: drop-shadow(0 4px 12px rgba(31, 138, 153, 0.4));
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ------------------------------------------------------
   Instant Feedback Modal
------------------------------------------------------ */
.feedback-modal {
  text-align: center;
  padding: clamp(28px, 4vw, 40px) !important;
}

.feedback-result-icon {
  font-size: clamp(4rem, 12vw, 7rem);
  margin-bottom: 20px;
  animation: bounceIn 0.6s ease;
}

.feedback-result-title {
  font-size: clamp(1.8rem, 4vw + 1rem, 2.5rem) !important;
  font-weight: 900;
  margin-bottom: 20px !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.feedback-explanation {
  font-size: clamp(1.1rem, 2.5vw + 0.5rem, 1.4rem);
  line-height: 1.8;
  margin: 20px 0;
  padding: 20px;
  background: rgba(241, 246, 245, 0.06);
  border-radius: 12px;
  border-right: 4px solid var(--accent);
}