/* moved from index.html - tombstone: removed inline styles in index.html */

/* Reset and base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: "Georgia", "Times New Roman", serif; color: #2e2418; position: relative;
  /* Vintage paper base: warm tan with subtle gradients */
  background-color: #f3e7d6;
  background-image:
    /* large soft vignetting */
    radial-gradient(1200px 800px at 10% 10%, rgba(0,0,0,0.04), transparent 12%),
    radial-gradient(1000px 700px at 90% 90%, rgba(0,0,0,0.045), transparent 14%),
    /* gentle vertical tone */
    linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.02) 100%),
    /* paper tint */
    linear-gradient(180deg, #f8efdd 0%, #eadfc2 35%, #e6d6ba 100%);
  /* subtle texture using multiple small radial-gradients to simulate fibre flecks */
  --texture: 
    radial-gradient(circle at 5% 10%, rgba(0,0,0,0.02) 0.5px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(0,0,0,0.015) 0.6px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(0,0,0,0.02) 0.5px, transparent 1px),
    radial-gradient(circle at 70% 40%, rgba(0,0,0,0.014) 0.6px, transparent 1px),
    radial-gradient(circle at 85% 75%, rgba(0,0,0,0.018) 0.5px, transparent 1px);
  background-blend-mode: normal, normal, normal, normal;
}

/* subtle noise overlay using a semi-transparent SVG data URL (keeps file light and not base64 image) */
body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
  opacity: 0.06;
  background-image:
    var(--texture),
    /* faint paper creases */
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.02) 100%);
  background-size: 180px 180px, cover;
  filter: contrast(0.98) saturate(0.95);
}

/* subtle entrance animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Images */
.fullscreen-image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform-origin: center center;
  transition: transform 450ms cubic-bezier(.2,.9,.2,1), filter 450ms ease, box-shadow 450ms ease;
  transform: translate(-50%, -50%) scale(1.25);
  filter: saturate(0.98) contrast(0.99);
  z-index: 1;
  will-change: transform;
  backface-visibility: hidden;
}
.fullscreen-image:first-of-type { z-index: 1; filter: sepia(0.12) contrast(0.94) brightness(0.98) saturate(0.9); box-shadow: inset 0 40px 120px rgba(0,0,0,0.08); }
.fullscreen-image:nth-of-type(2) {
  z-index: 2;
  pointer-events: none;
  /* move the overlay image slightly downwards by reducing the upward translation */
  transform: translate(-50%, -30%) scale(var(--overlay-scale, 1.25));
  /* ensure fully opaque */
  filter: saturate(0.95) contrast(0.92);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  transition: transform 520ms cubic-bezier(.18,.9,.4,1), filter 420ms ease, box-shadow 420ms ease;
}

/* gentle parallax on hover to add depth for desktop */
@media (hover: hover) {
  body:hover .fullscreen-image:first-of-type { transform: translate(-50%, -52%) scale(1.18); filter: saturate(0.9) contrast(0.95) blur(0.2px); }
  body:hover .fullscreen-image:nth-of-type(2) { transform: translate(-50%, -28%) scale(var(--overlay-scale,1.25)); box-shadow: 0 26px 60px rgba(0,0,0,0.22); }
}

/* Top sentence - vintage label */
.top-sentence {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  color: #2b1f12;
  background: linear-gradient(180deg,#f6eddc 0%, #efe2c8 100%);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 15px;
  max-width: 95%;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  border: 1px solid rgba(60,40,18,0.12);
  font-weight: 700;
  letter-spacing: 0.6px;
  font-family: "Courier New", Courier, monospace;
  animation: fadeInUp 600ms ease both;
}

/* Score badge on top center (enlarged for prominence) */
.score {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 6;
  background: linear-gradient(180deg,#efe0c7 0%, #e7d2b0 100%);
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 900;
  color: #3a2b20;
  border: 1px solid rgba(60,40,20,0.08);
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  font-family: "Georgia", serif;
  font-size: 18px;
  letter-spacing: 0.6px;
  min-width: 120px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap:8px;
  transform-origin: center;
  transition: transform 320ms cubic-bezier(.2,.9,.2,1), box-shadow 320ms ease;
}

/* score pulse animation for updates */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 12px 36px rgba(0,0,0,0.22); }
  30% { transform: scale(1.08); box-shadow: 0 18px 46px rgba(0,0,0,0.28); }
  60% { transform: scale(0.98); box-shadow: 0 10px 28px rgba(0,0,0,0.18); }
  100% { transform: scale(1); box-shadow: 0 12px 36px rgba(0,0,0,0.22); }
}
.score.pulse { animation: pulse 600ms ease; }

/* subtle gilded border around quiz */
.quiz {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(420px, 92%);
  max-height: calc(100% - 120px);
  overflow: auto;
  z-index: 5;
  background: linear-gradient(180deg,#fbf6ee 0%, #f0e6d1 100%);
  color: #3a2b20;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 18px 54px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.6);
  border: 1px solid rgba(100,76,46,0.12);
  font-family: "Georgia", serif;
  background-image:
    linear-gradient(transparent 0, rgba(0,0,0,0.01) 100%),
    radial-gradient(1200px 600px at 10% 10%, rgba(255,255,255,0.02), transparent 10%),
    linear-gradient(180deg,#fbf6ee 0%, #f0e6d1 100%);
  backdrop-filter: blur(2px);
  animation: fadeInUp 600ms ease both;
}
.quiz h2 { font-size: 18px; margin-bottom: 10px; color: #2e1f14; text-shadow: 0 1px 0 rgba(255,255,255,0.5); letter-spacing: 0.4px; }

/* Question card */
.question { margin-bottom: 12px; padding: 12px; border-radius: 8px; background: linear-gradient(180deg,#fffef8 0%, #fbf2dd 100%); border: 1px solid rgba(90,70,45,0.06); box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.q-text { font-weight: 700; margin-bottom: 10px; font-size: 15px; color: #2b1f12; }

/* Options - vintage radio look */
.options { display: flex; flex-direction: column; gap: 8px; }
.options label {
  font-size: 14px;
  background: linear-gradient(180deg,#fffdf6 0%, #f4ecd8 100%);
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  border: 1px solid rgba(90,70,45,0.08);
  box-shadow: 0 3px 0 rgba(0,0,0,0.03);
  transition: transform 140ms ease, box-shadow 140ms ease, background 220ms ease;
}
.options label:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,0.06); background: linear-gradient(180deg,#fffef6 0%, #f0e6cc 100%); }

.options input {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #6b4b30;
  background: #f7efe0;
  display: inline-block;
  position: relative;
  margin: 0;
  flex: 0 0 20px;
  cursor: pointer;
  transition: background 200ms ease, box-shadow 200ms ease;
}
.options input:checked {
  background: radial-gradient(circle at 50% 40%, #6b4b30 0%, #4a321f 40%, #4a321f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 6px 14px rgba(75,50,30,0.06);
  border-color: #3d2917;
}
.options span { color: #3a2b20; }

/* Controls - retro buttons */
.controls { display:flex; gap:8px; margin-top:12px; justify-content: flex-end; align-items:center; }
button {
  background: linear-gradient(180deg,#6b4b30 0%, #553a28 100%);
  color:#fbf6ee;
  border:none;
  padding:8px 12px;
  border-radius:6px;
  cursor:pointer;
  font-weight:700;
  box-shadow: 0 6px 0 rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.2);
  font-family: "Georgia", serif;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 200ms ease;
}
button:hover { filter: brightness(1.03); transform: translateY(-2px); box-shadow: 0 10px 18px rgba(0,0,0,0.16); }
button:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,0.18); }
button.secondary {
  background: linear-gradient(180deg,#efe0c7 0%, #e7d2b0 100%);
  color:#3a2b20;
  border: 1px solid rgba(60,40,20,0.08);
  box-shadow: none;
}

/* Feedback */
.feedback { margin-top:8px; font-size:13px; min-height:18px; color:#3a2b20; font-style: italic; }

/* Small screens */
@media (max-width:720px) {
  .quiz { left: 50%; transform: translateX(-50%); right: auto; bottom: 12px; width: 94%; max-height: 60%; padding: 12px; }
  .top-sentence { font-size: 14px; top: 12px; }
}