/* -------------------------------------------------
   Earlier — Minimal Typewriter UI
   - Courier / typewriter feel
   - Centered layout
   - High-contrast, simple
-------------------------------------------------- */

:root{
  --bg: #faf7f2;
  --ink: #111;
  --muted: #555;
  --border: #111;
  --card: #fffdf8;
}

/* Make sizing predictable */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 16px;
  background: var(--bg);
  color: var(--ink);

  /* Typewriter vibe */
  font-family: "Courier New", Courier, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.4;
}

a {
  color: var(--ink);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

.container {
  max-width: 620px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand {
  font-size: 22px;
  letter-spacing: 0.5px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 18px 0;
}

/* Card */
.card {
  background: var(--card);
  border: 2px solid var(--border);
  padding: 18px;
  margin: 14px 0;
}

/* Buttons */
button {
  font-family: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

button:hover {
  background: #111;
  color: #fff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Result */
.result {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--ink);
}

.subtle {
  color: var(--muted);
  font-size: 14px;
}

/* Share */
pre {
  margin: 10px 0;
  padding: 10px;
  border: 1px dashed var(--border);
  background: #fff;
  white-space: pre-wrap;
}

/* Leaderboards */
.section-title {
  margin: 22px 0 8px 0;
  font-size: 14px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.board {
  font-size: 15px;
  line-height: 1.5;
}

/* Footer */
.footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}

/* Blinking cursor effect */
.brand::after {
  content: " ▌";
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* Result stamp style */
.stamp {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  font-weight: bold;
  letter-spacing: 2px;
  transform: rotate(-3deg) scale(1.2);
  opacity: 0;
  /* Ink bleed / print imperfection */
  text-shadow:
  0.4px 0.4px 0 rgba(0,0,0,0.25),
  -0.3px 0.2px 0 rgba(0,0,0,0.18);
  filter: saturate(0.95);

  /* Animate when inserted */
  animation: stampIn 180ms ease-out forwards;
}

.stamp.correct {
  background: #111;
  color: #fff;
  /* Ink bleed / print imperfection */
  text-shadow:
  0.4px 0.4px 0 rgba(0,0,0,0.25),
  -0.3px 0.2px 0 rgba(0,0,0,0.18);
  filter: saturate(0.95);
}

.stamp.wrong {
  background: transparent;
  color: #111;
  /* Wrong stamp looks like dry ink */
  opacity: 0.9;
}

/* Stamp animation */
@keyframes stampIn {
  0% {
    transform: rotate(-8deg) scale(1.4);
    opacity: 0;
  }
  70% {
    transform: rotate(-2deg) scale(0.95);
    opacity: 1;
  }
  100% {
    transform: rotate(-3deg) scale(1);
    opacity: 1;
  }
}

/* -------------------------------------------------
   Paper noise overlay (CSS-only)
   - Uses layered gradients to simulate subtle paper grain
   - Very lightweight (no images needed)
-------------------------------------------------- */

/* Apply noise overlay over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;          /* Overlay doesn't block clicks */
  opacity: 0.08;                 /* Subtle grain strength */
  mix-blend-mode: multiply;      /* Makes it feel like paper */
  z-index: 9999;                 /* Above everything */

  /* Layered gradients = faux noise texture */
  background-image:
    repeating-radial-gradient(circle at 10% 20%, rgba(0,0,0,0.08) 0 1px, transparent 1px 3px),
    repeating-radial-gradient(circle at 80% 70%, rgba(0,0,0,0.06) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.02) 0 1px, transparent 1px 6px);
}

/* -------------------------------------------------
   Tiny screen shake (wrong answer)
-------------------------------------------------- */

.shake {
  animation: shake 120ms ease-in-out;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

/* --- Social scoring panel (paper theme) --- */
.social-score {
  margin-top: 4px;
  border-left: 3px solid var(--ink);
  border-top: none;
  border-right: none;
  border-bottom: none;
  padding-left: 12px;
}

.social-headline {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.social-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.dist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dist-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.dist-label,
.dist-pct {
  font-size: 12px;
  color: var(--muted);
}

.dist-track {
  height: 8px;
  background: rgba(17,17,17,0.08); /* ink-tint, not white */
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  background: rgba(17,17,17,0.70); /* ink fill */
}

/* Simple divider for subsections inside the main card */
.divider {
  margin: 14px 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

button.compact {
  width: auto;
  text-align: center;
  font-size: 14px;
  padding: 8px 10px;
}

.answer-review {
  font-size: 15px;
  margin-top: 8px;
}
.answer-review strong {
  font-weight: 600;
}

.share-hint {
  margin-top: 14px;
  font-size: 0.85rem;
  opacity: 0.7;
}

#streakBadge {
  margin-left: 8px;
  opacity: 0.85;
}