*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: system-ui, sans-serif;
}

.card-stack {
  position: relative;
  width: min(320px, 90vw);
  aspect-ratio: 9 / 16;
}

.card-scene {
  position: absolute;
  inset: 0;
  perspective: 1000px;
  cursor: pointer;
}

.card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.card.is-flipped {
  transform: rotateY(180deg);
}

.card-scene.enter {
  animation: enterCard 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card-scene.exit {
  animation: exitCard 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes enterCard {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes exitCard {
  to { transform: scale(0.85); opacity: 0; }
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-front {
  /* background: linear-gradient(135deg, #16213e, #0f3460); */
  background: url('card-front.jpg') center / cover no-repeat;
  border: 1px solid rgba(255,255,255,0.1);
  color: #e0e0e0;
}

.card-back {
  /* background: linear-gradient(135deg, #e94560, #0f3460); */
  background: url('card-back.jpg') center / cover no-repeat;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  transform: rotateY(180deg);
  cursor: pointer;
}

.card-back .tap-hint {
  animation: pulseHint 2s ease-in-out infinite;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

.card-face h2 {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 700;
}

.card-face p {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  opacity: 0.8;
  line-height: 1.6;
}

.card-label {
  font-size: 0.7rem;
  opacity: 0.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tap-hint {
  margin-top: auto;
  font-size: 0.75rem;
  opacity: 0.4;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---- End Screen ---- */
.end-screen {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  /* background: linear-gradient(135deg, #0f3460, #533483); */
  background: url('card-last.jpg') center / cover no-repeat;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  text-align: center;
  color: #fff;
  animation: enterCard 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.end-screen .trophy {
  font-size: 4rem;
  animation: bounce 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

@keyframes bounce {
  0%   { transform: scale(0);   opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

.end-screen h2 {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  font-weight: 800;
}

.end-screen p {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  opacity: 0.75;
  line-height: 1.6;
}

.restart-btn {
  margin-top: 12px;
  padding: 12px 28px;
  border-radius: 999px;
  border: none;
  background: #e94560;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.restart-btn:hover {
  background: #ff6b81;
  transform: scale(1.05);
}

.progress-bar-wrap {
  position: absolute;
  bottom: -18px;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #e94560;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  width: 100%;
}

/* ---- Read More Link ---- */
.card-back .card-text a {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;

  /* Cyan text on dark — pulled from the teal graffiti tags */
  color: #00f5ff;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #00f5ff;

  /* Cyan neon glow to punch through the dark overlay */
  box-shadow:
    0 0 6px #00f5ff,
    0 0 16px #00f5ff80,
    inset 0 0 6px #00f5ff20;

  transform: skewX(-4deg);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card-back .card-text a:hover {
  /* Flip to hot magenta on hover — the dominant spray paint colour */
  color: #000;
  background: #ff2d9b;
  border-color: #ff2d9b;
  box-shadow:
    0 0 8px #ff2d9b,
    0 0 24px #ff2d9baa,
    inset 0 0 4px #ff006680;
  transform: skewX(-4deg) scale(1.06);
}

/* ---- Footer ---- */
.built-by {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.3);
}

.built-by a {
  color: #00f5ff;
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.built-by a:hover {
  color: #ff2d9b;
  text-shadow: 0 0 8px #ff2d9b;
}