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

:root{
  --paper:#efe6d7;
  --cream:#fbf7f2;
  --ink:#1a130f;
  --gold:#b98538;
  --soft:#6b5a47;
  --torn: #efe6d7;
  --muted:#7a6a57;
  --card-shadow: rgba(24,18,12,0.12);
}

/* Body parchment with richer warm vignette and subtle paper grain */
body {
  font-family: 'Noto Sans', sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 700px at 8% 12%, rgba(0,0,0,0.06), transparent 20%),
    radial-gradient(1000px 600px at 92% 88%, rgba(0,0,0,0.04), transparent 18%),
    linear-gradient(180deg, rgba(235,215,185,0.14), rgba(230,210,180,0.05)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.00) 1px, rgba(0,0,0,0.00) 2px);
  background-attachment: fixed;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  /* slightly larger base font for readability */
  font-size: 18px;
}

/* Central paper panel with soft gold border, inner glow and subtle texture */
.newspaper {
  max-width: calc(100% - 48px);
  margin: 18px auto;
  background: linear-gradient(180deg, rgba(255,255,250,0.99), rgba(249,243,233,0.98));
  min-height: 92vh;
  padding: 40px;
  border-radius: 14px;
  border: 6px solid rgba(185,133,56,0.06);
  box-shadow: 0 24px 60px rgba(18,12,8,0.18), inset 0 2px 12px rgba(255,255,255,0.6);
  position: relative;
  overflow: visible;
}

/* Index / Table of Contents */
.index {
  display: flex;
  justify-content: center;
  margin: 14px 0 18px;
}
.index-inner{
  background: linear-gradient(180deg, rgba(255,250,242,0.98), rgba(250,244,236,0.95));
  border: 1px solid rgba(120,80,30,0.06);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(12,8,6,0.06);
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  display:flex;
  gap:16px;
  align-items:center;
}
.index-title {
  font-size:18px;
  color:var(--ink);
  margin-right:6px;
  letter-spacing:0.8px;
}
.index-list {
  list-style: none;
  display:flex;
  gap:12px;
  margin:0;
  padding:0;
  align-items:center;
  font-size:16px;
}
.index-list a {
  color: #3f352e;
  text-decoration: none;
  padding:6px 8px;
  border-radius:6px;
  transition: background 160ms, transform 120ms;
  font-family: 'Playfair Display', 'Cinzel', serif;
}
.index-list a:hover {
  background: rgba(185,133,56,0.08);
  transform: translateY(-2px);
}

/* Masthead refinements: decorative rule and subtitle badge */
.masthead-inner {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin-bottom:6px;
}
.page-title-wrap {
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
}
.page-title {
  display: block;
  font-family: 'Playfair Display', 'Cinzel', serif;
  font-weight: 900;
  font-size: 64px;
  color: var(--ink);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin: 0;
  line-height: 0.95;
  padding: 10px 22px;
  background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,240,0.2));
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  border: 1px solid rgba(120,80,30,0.04);
}

/* Shakespearean handwritten title — dramatic, slightly irregular calligraphy */
.shaky-title {
  /* antique-looking primary font, with fallbacks */
  font-family: 'IM Fell English SC', 'Cinzel', 'Playfair Display', serif;
  font-size: 64px;
  color: var(--ink);
  letter-spacing: 2px;
  line-height: 1.02; /* slightly more breathing so long title wraps cleanly */
  margin: 0;
  padding: 10px 20px;
  transform: rotate(-1.2deg);
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(255,255,255,0.6), 0 6px 18px rgba(18,12,8,0.10);
  border-bottom: 2px solid rgba(120,80,30,0.06);
  background: linear-gradient(90deg, rgba(255,255,255,0.92), rgba(255,250,240,0.85));
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(18,12,8,0.08);
  padding-left: 18px;
  padding-right: 18px;

  /* Ensure the full title is visible and not clipped */
  white-space: normal;
  max-width: calc(100% - 40px);
  overflow: visible;
  display: inline-block;
}

/* slightly larger on wide screens, a touch smaller on narrow screens */
@media (min-width: 900px) {
  .shaky-title { font-size: 64px; transform: rotate(-1deg); padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 520px) {
  .shaky-title { font-size: 28px; transform: rotate(0deg); padding-left: 12px; padding-right: 12px; white-space: normal; text-align:center; }
}

/* slightly larger on wide screens, a touch smaller on narrow screens */
@media (min-width: 900px) {
  .shaky-title { font-size: 64px; transform: rotate(-1deg); padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 520px) {
  .shaky-title { font-size: 28px; transform: rotate(0deg); padding-left: 12px; padding-right: 12px; white-space: normal; text-align:center; }
}
.page-subtitle {
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  font-size: 14px;
  color: var(--muted);
  background: rgba(255,250,242,0.92);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(120,80,30,0.04);
  margin-top:6px;
  letter-spacing: 0.6px;
}

/* give the ads section a poster gallery look with breathing space */
.ads-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 26px;
  align-items: start;
  justify-items: center;
  padding-top: 8px;
}

/* poster-style profile cards: stronger shadows, soft gradient edges */
.ad {
  background: linear-gradient(180deg, rgba(255,255,250,0.995), rgba(247,240,230,0.98));
  border: 1px solid rgba(110,80,50,0.06);
  padding: 22px;
  position: relative;
  transition: transform 260ms cubic-bezier(.2,.9,.3,1), box-shadow 260ms, filter 200ms;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-radius: 14px;
  overflow: visible;
  box-shadow: 0 20px 48px var(--card-shadow);
  font-family: 'Playfair Display', 'Cinzel', serif;
  color: #2f2621;
  min-height: 440px;
  width: 100%;
  max-width: 340px;
  padding-top: 26px;
  padding-bottom: 26px;
  background-image:
    radial-gradient(circle at 12% 10%, rgba(245,230,210,0.06), transparent 10%),
    linear-gradient(180deg, rgba(255,255,250,0.99), rgba(248,242,232,0.96));
  border-left: 6px solid rgba(185,133,56,0.06);
}

/* poster hover: lift, warmer glow and slight saturation */
.ad:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 42px 110px rgba(18,12,8,0.24);
  filter: saturate(1.04) contrast(1.02);
}

/* tone down forced rotations for a cleaner grid on larger screens */
.ads-container .ad:nth-child(odd) { transform: none; }
.ads-container .ad:nth-child(3n) { transform: none; }
.ads-container .ad:nth-child(4n) { transform: none; }

/* a printed, typewriter-ish ad number stamp with softer styling */
.ad-number {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  font-size: 14px;
  color: #7a6650;
  background: rgba(255,255,255,0.88);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(120,80,30,0.06);
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
  transform: rotate(-4deg);
  opacity: 0.98;
}

/* headline style and subtle decorative divider */
.ad h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: 0.2px;
  text-transform: none;
}
.ad .divider {
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(185,133,56,0.95), rgba(185,133,56,0.5));
  margin-top: 6px;
}

/* body copy more like clipped classified ads with softer leading */
.ad p {
  font-family: 'Noto Sans', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #403733;
  max-width: none;
  margin-left: 6px;
  padding-right: 12px;
  text-align: center;
}

/* portrait treatment: framed portrait with subtle vignette and frame */
.portrait-figure {
  position: relative;
  width: 86%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: saturate(1.03) contrast(1.04);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(245,240,235,0.6));
  box-shadow: 0 18px 42px rgba(12,8,6,0.12);
  padding: 6px;
}
.character-portrait {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  border: 8px solid rgba(255,255,250,0.98);
  background: #fff;
  transform-origin: center;
  transition: transform 260ms ease, box-shadow 260ms ease;
}

/* subtle decorative top label on poster */
.portrait-figure::before {
  content: "";
  display: block;
  position: absolute;
  left: 14px;
  top: 14px;
  width: 80px;
  height: 12px;
  background: linear-gradient(90deg, rgba(185,133,56,0.18), rgba(255,255,255,0.0));
  border-radius: 4px;
  pointer-events: none;
  transform: translateY(0);
  opacity: 0.95;
}

/* make each ad look physically different: softer torn footer pseudo-element */
.ad::after {
  content: "";
  position: absolute;
  left: 0;
  right: 6%;
  bottom: -10px;
  height: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(230,210,180,0.6));
  clip-path: polygon(0 24%, 6% 12%, 12% 28%, 18% 8%, 26% 34%, 34% 10%, 44% 28%, 54% 6%, 64% 30%, 74% 8%, 84% 26%, 94% 6%, 100% 32%);
  opacity: 0.95;
  transform: rotate(-0.6deg);
  pointer-events: none;
}

/* decorative printed border along the left for classifieds feel */
.ad::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8%;
  bottom: 8%;
  width: 8px;
  background-image: linear-gradient(180deg, rgba(0,0,0,0.06) 0.5px, transparent 2px);
  transform: skewY(-6deg);
  border-radius: 2px;
  pointer-events: none;
}

/* portrait hover micro-interaction retains subtle lift */
.ad:hover .character-portrait {
  transform: translateY(-8px) scale(1.035);
  filter: saturate(1.06) contrast(1.06);
  box-shadow: 0 26px 60px rgba(12,8,6,0.14);
}

/* responsive grid tweaks */
@media (min-width: 600px) {
  .ads-container { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; }
  .portrait-figure { width: 92%; max-width: 310px; }
  .character-portrait { width: 100%; height: auto; }
  .page-title { font-size: 56px; padding: 8px 22px; }
}

@media (min-width: 900px) {
  .ads-container { grid-template-columns: repeat(4, 1fr); gap: 32px; }
  .masthead h1 { font-size: 56px; }
  .portrait-figure { width: 180px; height: 180px; padding: 8px; }
  .character-portrait { width: 170px; height: 170px; }
}

/* exercise section restyled to match torn classified slips but elevated */
.exercise {
  margin-top: 22px;
  padding: 12px;
}
.exercise-inner {
  background: linear-gradient(180deg, var(--cream), rgba(255,255,250,0.96));
  border: 1px solid rgba(120,80,30,0.06);
  padding: 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(12,8,6,0.08);
}
.exercise h3 {
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  font-size: 44px;
  margin-bottom: 14px;
  color: var(--ink);
  letter-spacing: 0.6px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  line-height: 1.05;
}
.exercise-instruction {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 16px;
  font-weight: 700;
  color: #3f352e;
  background: rgba(255,250,242,0.96);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.35;
  border: 1px solid rgba(120,80,30,0.04);
  max-width: 100%;
  letter-spacing: 0.4px;
}

/* make selects look like vintage buttons */
.exercise select {
  min-width:200px;
  padding:12px 14px;
  border-radius:10px;
  border:1px solid rgba(60,40,20,0.08);
  background: linear-gradient(180deg,#fffdf8,#fff7ec);
  font-family: 'Playfair Display', 'Noto Sans', sans-serif;
  font-size:18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  transition: box-shadow 180ms, transform 160ms;
}
.exercise select:focus { box-shadow: 0 8px 20px rgba(120,80,30,0.06); transform: translateY(-2px); outline: none; }

/* action buttons updated with brighter, tactile style */
#check-btn, #reveal-btn {
  background: linear-gradient(180deg, #e6a84a, #c9832e);
  color: #fff;
  border: none;
  padding:10px 16px;
  border-radius:10px;
  cursor:pointer;
  font-family:'Noto Sans', sans-serif;
  box-shadow: 0 8px 22px rgba(0,0,0,0.16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
#reveal-btn { background: linear-gradient(180deg, #a76b2e, #88501c); }
#check-btn:hover, #reveal-btn:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,0,0,0.22); }
#result { font-weight:600; color:var(--soft); font-size:14px; margin-left:6px; }

/* exercise list & drop zone visuals */
.exercise-ads {
  list-style: decimal;
  padding-left: 1.2rem;
  margin: 0;
  display: grid;
  gap: 20px;
}
.exercise-ads li {
  background: linear-gradient(180deg, rgba(255,255,250,0.99), rgba(250,245,238,0.96));
  padding: 18px;
  border-radius: 8px;
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  color: #3f3630;
  line-height: 1.35;
  font-size: 26px;
  border: 1px solid rgba(120,80,30,0.06);
  box-shadow: 0 10px 26px rgba(12,8,6,0.06);
  position: relative;
  display: block;
  overflow: visible;
  clip-path: polygon(0% 0%, 100% 2%, 100% 88%, 97% 100%, 2% 96%, 0% 82%);
  border-left: 8px solid rgba(185,133,56,0.12);
}

/* slightly larger number marker for clarity */
.exercise-ads li::marker {
  font-weight: 700;
  color: var(--soft);
  font-size: 1.2em;
}

/* ensure compact layout on small screens while keeping separation */
@media (max-width: 520px) {
  .exercise-ads { gap: 12px; }
  .exercise-ads li { padding: 14px; font-size: 20px; line-height: 1.38; }
}

/* footer polished */
.paper-footer {
  text-align:center;
  margin-top:18px;
  color:#6b5a47;
  font-size:12px;
  opacity:0.95;
  letter-spacing: 0.4px;
}

/* Moving post-it note kept but visually muted so it doesn't clash with torn slips */
.moving-postit {
  position: fixed;
  right: 28px;
  top: 18%;
  width: 420px;
  max-width: calc(100% - 56px);
  z-index: 1200;
  pointer-events: none;
  transform: translateZ(0);
  will-change: transform;
  animation: float-sway 6s ease-in-out infinite;
  opacity: 0.95;
}

.postit-inner {
  background: linear-gradient(180deg, #fff3b8 0%, #ffe98a 60%);
  border: 2px solid rgba(90,60,20,0.12);
  box-shadow: 0 18px 40px rgba(0,0,0,0.12);
  border-radius: 10px;
  padding: 16px 14px;
  position: relative;
  transform: rotate(-4deg);
  overflow: hidden;
  pointer-events: auto;
}

/* small pin emoji */
.postit-pin {
  position: absolute;
  left: 12px;
  top: -12px;
  font-size: 26px;
  transform: rotate(-8deg);
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.12));
}

/* reduced postit font size for better balance */
.postit-content {
  font-family: 'IM Fell English SC', 'Cinzel', 'Playfair Display', serif;
  font-size: 15px;
  line-height: 1.3;
  color: #3b2f26;
  white-space: pre-wrap;
  max-height: 56vh;
  overflow: auto;
  padding-right: 8px;
  pointer-events: none;
}

/* gentle floating animation */
@keyframes float-sway {
  0%   { transform: translateY(0) rotate(-4deg); }
  50%  { transform: translateY(-8px) rotate(-2deg); }
  100% { transform: translateY(0) rotate(-4deg); }
}

/* small horizontal slide to draw attention (slow loop) */
@keyframes slide-across {
  0% { transform: translateX(0); }
  50% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}
.postit-content { animation: slide-across 8s ease-in-out infinite; }

/* ensure it looks good on narrow screens: smaller, centered at top */
@media (max-width: 720px) {
  .moving-postit {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 6%;
    width: 92%;
    animation-duration: 5.5s;
  }
  .postit-inner { transform: rotate(-2deg); padding: 12px; }
  .postit-content { font-size: 14px; max-height: 48vh; }
}

/* Interactive exercise controls tweaks for touch */
.exercise .selectors { display:flex; gap:12px; flex-wrap:wrap; justify-content:space-between; align-items:center; margin-top:8px; }
.drop-pair { display:flex; gap:12px; align-items:center; }
.drop-wrapper { display:flex; flex-direction:column; gap:8px; align-items:center; min-width:120px; }
.drop-label { font-family: 'Cinzel', 'IM Fell English SC', serif; color:#3f3630; font-size:14px; }
.drop-zone {
  width: 140px;
  height: 72px;
  background: linear-gradient(180deg, #fffdfa, #fff6e9);
  border: 2px dashed rgba(100,70,40,0.08);
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#6b5848;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  text-align:center;
  padding:8px;
  cursor: pointer;
  transition: box-shadow 180ms, border-color 180ms, transform 160ms;
}
.drop-zone::after { content: "drop here"; font-size:12px; color:rgba(80,60,40,0.26); position:relative; top:6px; }
.drop-zone.occupied::after { content: ""; }
.drop-zone.drop-over { border-color: rgba(120,80,30,0.28); box-shadow: 0 6px 18px rgba(120,80,30,0.06) inset; transform: translateY(-3px); }
.drop-zone.occupied img { width:80px; height:80px; object-fit:cover; border-radius:10px; }
.drop-zone.correct { outline: 3px solid rgba(92,180,110,0.14); box-shadow: 0 6px 18px rgba(92,180,110,0.04) inset; }
.drop-zone.incorrect { outline: 3px solid rgba(220,80,80,0.09); box-shadow: 0 6px 18px rgba(220,80,80,0.02) inset; }

/* make portraits visibly draggable in the profiles */
.draggable-portrait { cursor: grab; touch-action: none; }
.draggable-portrait:active { cursor: grabbing; transform: scale(0.98); }

/* visual feedback for select fallback */
select.correct { outline: 3px solid rgba(92,180,110,0.14); box-shadow: 0 6px 18px rgba(92,180,110,0.06) inset; }
select.incorrect { outline: 3px solid rgba(220,80,80,0.09); box-shadow: 0 6px 18px rgba(220,80,80,0.04) inset; }

/* responsive tweaks */
@media (max-width: 520px) {
  .exercise .selectors { flex-direction:column; align-items:stretch; }
  .exercise label { width:100%; }
  .exercise select { min-width:100%; }
}