/* Simple printable exam styling with enhanced authentic paper feel */
:root{
  --accent:#0a3d62;
  --muted:#444;
  --paper:#fbf4e6; /* slightly warmer off-white for aged paper */
  --paper-edge:#d2c7b8;
  --line:#dfd2c3;
  --fiber-dark: rgba(0,0,0,0.03);
  --crease: rgba(0,0,0,0.06);
}

*{box-sizing:border-box}
body{
  background: linear-gradient(180deg, #e9e7e2 0%, #efece6 100%); /* soft desk surface */
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color:var(--muted);
  padding:36px;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
}

/* Paper sheet */
.exam-sheet{
  max-width:900px;
  width:100%;
  margin:0 auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95), rgba(252,248,240,0.98)),
    var(--paper);
  padding:42px 48px;
  border:1px solid var(--paper-edge);
  border-radius:10px;
  position:relative;
  box-shadow:
    0 28px 60px rgba(12,18,20,0.25), /* stronger cast shadow for lift */
    inset 0 1px 0 rgba(255,255,255,0.6);
  font-family: Georgia, "Times New Roman", Times, serif; /* paper-like typography for the sheet contents */
  color:#222;
  overflow:visible;
  transform:rotate(-0.25deg); /* tiny skew to look hand-placed */
}

/* textured fibers + ruled lines for a real-paper look */
.exam-sheet::before{
  content:"";
  position:absolute;
  inset:-2px;
  pointer-events:none;
  border-radius:12px;
  background-image:
    repeating-linear-gradient(
      to bottom,
      var(--fiber-dark) 0px,
      var(--fiber-dark) 1px,
      transparent 1px,
      transparent 28px
    ),
    radial-gradient(circle at 8% 18%, rgba(0,0,0,0.02), transparent 18%),
    radial-gradient(circle at 82% 72%, rgba(0,0,0,0.02), transparent 16%),
    linear-gradient(90deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
  opacity:0.9;
  mix-blend-mode:multiply;
  filter:blur(0.3px);
  transform:translateZ(0);
}

/* deckled / irregular paper edge effect */
.exam-sheet::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:10px;
  background:
    radial-gradient(120px 20px at 2% 3%, rgba(0,0,0,0.02), transparent 30%),
    radial-gradient(80px 18px at 98% 97%, rgba(0,0,0,0.02), transparent 30%);
  mask-image: linear-gradient(#000, #000); /* keep subtle */
  box-shadow:
    inset 0 30px 50px rgba(0,0,0,0.03), /* soft inner vignette */
    inset 0 -24px 40px rgba(0,0,0,0.02);
}

/* fake crease for realism */
.exam-sheet .crease{
  position:absolute;
  left:0;
  right:0;
  top:48%;
  height:2px;
  background: linear-gradient(90deg, transparent, var(--crease), transparent);
  opacity:0.12;
  transform:skewY(-1deg);
  pointer-events:none;
}

/* header tweaks to look like a printed header */
.exam-header{
  display:flex;
  gap:18px;
  align-items:center;
  border-bottom:1px dashed var(--line); /* dashed for a slightly inked header line */
  padding-bottom:16px;
  margin-bottom:18px;
}

.logo{
  width:92px;
  height:92px;
  object-fit:contain;
  background:transparent;
  padding:6px;
  border-radius:8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06) inset;
}

.school-name{
  margin:0;
  font-size:24px;
  color:var(--accent);
  font-weight:700;
  letter-spacing:0.2px;
  font-family: "Garamond", Georgia, "Times New Roman", serif;
}

.exam-meta{
  font-size:15px;
  margin-top:4px;
}

.exam-title{
  font-weight:700;
  margin-bottom:6px;
  font-size:16px;
  color:#111;
  letter-spacing:0.6px;
  text-transform:uppercase;
}

.sub{font-style:italic;color:#666;margin-bottom:6px}

.date-line span{
  display:block;
  font-size:16px;
  font-weight:700;
  color:var(--accent);
  margin-bottom:4px;
}

/* prominent red warning under the passing score */
.failing-warning{
  margin-top:8px;
  color:#b71c1c; /* deep red */
  font-weight:900;
  font-size:18px;
  line-height:1.1;
  text-transform:none;
  border-left:4px solid rgba(183,28,28,0.08);
  padding-left:10px;
  font-family: Georgia, "Times New Roman", serif;
}

/* section & content styling tuned for print */
.section-title{
  font-weight:700;
  margin:18px 0 12px;
  color:#111;
  font-size:16px;
  border-left:3px solid rgba(10,61,98,0.08);
  padding-left:10px;
  background: linear-gradient(90deg, rgba(10,61,98,0.015), transparent);
}

.questions{margin:0;padding:0}

.q-list{padding-left:22px;margin:0}

.q-list > li{margin-bottom:16px}

.q-text{font-weight:600;margin-bottom:8px;font-family: Georgia, "Times New Roman", Times, serif}

.choices{list-style:upper-alpha;margin:6px 0 0 22px;padding:0}

.choices li{margin:8px 0}

label{cursor:pointer;}

/* inputs look more like printed bubbles on screen */
.questions input[type="radio"]{
  appearance:none;
  -webkit-appearance:none;
  width:18px;
  height:18px;
  border:2px solid #7a6f62;
  border-radius:50%;
  display:inline-block;
  margin-right:10px;
  vertical-align:middle;
  position:relative;
  top:-1px;
  background:linear-gradient(180deg,#fff,#f7f1e6);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.6);
}
.questions input[type="radio"]:checked{
  background: radial-gradient(circle at center, var(--accent) 46%, transparent 47%);
  border-color:var(--accent);
  box-shadow: 0 0 0 3px rgba(10,61,98,0.05);
}

/* student inputs */
.instructions{
  margin-top:24px;
  display:flex;
  gap:12px;
  align-items:center;
  font-family: Georgia, "Times New Roman", Times, serif;
}

.instructions input{
  border:1px solid #c9bfae;
  background:linear-gradient(180deg,#fff,#fbf4e6);
  padding:8px 10px;
  margin-left:6px;
  min-width:260px;
  border-radius:6px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.03) inset;
}

/* larger, stylized handwritten appearance for the student name field (input) */
.instructions input.handwritten{
  font-family: "Brush Script MT", "Lucida Handwriting", "Segoe Script", cursive;
  font-size:64px; /* increased top name size for stronger handwritten presence */
  font-weight:800;
  color:#111;
  padding:10px 14px;
  min-width:380px;
  letter-spacing:0.6px;
  transform:rotate(-1.5deg);
  background:linear-gradient(180deg,#fff,#fbf4e6);
  border-color:#8f7f64;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.6);
}

/* large handwritten display for the top Student Name */
.top-name{
  display:inline-block;
  font-family: "Brush Script MT", "Lucida Handwriting", "Segoe Script", cursive;
  font-size:72px; /* increased top name size to match new handwritten scale */
  font-weight:800;
  color:#111;
  transform:rotate(-1.5deg);
  margin-left:10px;
  vertical-align:middle;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  line-height:0.95;
}

/* print button */
.print-actions{
  margin-top:18px;
}

button{
  background:var(--accent);
  color:white;
  border:none;
  padding:8px 14px;
  border-radius:4px;
  cursor:pointer;
  font-weight:600;
  box-shadow: 0 6px 18px rgba(10,61,98,0.12);
}

button:hover{opacity:0.95}

.exam-footer{
  margin-top:26px;
  text-align:center;
  color:#6e6a65;
  font-size:12px;
  font-family: Georgia, "Times New Roman", Times, serif;
  letter-spacing:0.2px;
}

/* Handwritten black tick for auto-marked wrong answers (keeps original colors intact) */
.handwritten-tick {
  position: relative;
  padding-right: 28px; /* space for the tick */
}
.handwritten-tick::after{
  content: "✓";
  position: absolute;
  right: 0;
  top: 0;
  color: #000; /* solid black handwritten tick */
  font-family: "Bradley Hand", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 18px;
  line-height: 1;
  transform: rotate(-6deg);
  opacity: 0.95;
}

/* Green tick to mark correct answers on the answer-sheet */
.correct-tick {
  position: relative;
  padding-right: 28px;
}
.correct-tick::after{
  content: "✓";
  position: absolute;
  right: 0;
  top: 0;
  color: #1b7a16; /* green */
  font-family: "Bradley Hand", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 18px;
  line-height: 1;
  transform: rotate(-4deg);
  opacity: 0.95;
}

/* Explanation text styling for the answer sheet */
.answer-explanation{
  font-size:13px;
  color:#0b3d18;
  margin-top:6px;
  margin-left:18px;
  background: rgba(27,122,22,0.03);
  border-left:3px solid rgba(27,122,22,0.08);
  padding:8px 10px;
  border-radius:4px;
}

/* Map area styles */
.map-area{
  margin-top:20px;
  display:flex;
  justify-content:center;
}
.map-wrap{
  position:relative;
  width:100%;
  max-width:820px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,#fffdf9,#fbf4e6);
  padding:10px;
  border-radius:8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.05) inset;
}
.world-map{
  width:100%;
  height:auto;
  display:block;
  border-radius:4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  border:1px solid rgba(0,0,0,0.03);
}

/* SVG overlay sits on top of the image and scales with it */
.map-overlay{
  position:absolute;
  inset:10px;
  width:calc(100% - 20px);
  height:calc(100% - 20px);
  pointer-events:none;
  overflow:visible;
}

/* Handwritten styling for student answers (applies to inputs and textareas with class="handwritten") */
.handwritten{
  font-family: "Bradley Hand", "Brush Script MT", "Lucida Handwriting", "Segoe Script", cursive;
  color:#0b0b0b; /* slightly darker for contrast */
  line-height:1.12; /* more breathing room for legibility */
  font-weight:800;
  letter-spacing:0.8px;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  background:transparent;
  padding:10px 12px;
  box-shadow:none;
  border:0;
  transform:rotate(-0.2deg); /* subtler tilt for readability */
  display:inline-block;
  font-size:60px; /* increased base handwritten size for improved readability */
}

/* Slightly different treatment for form fields so they keep shape but read as handwriting */
input.handwritten, textarea.handwritten{
  border:1px dashed rgba(0,0,0,0.10);
  background: linear-gradient(180deg, rgba(255,255,255,0.00), rgba(251,244,230,0.02));
  padding:12px 14px;
  border-radius:6px;
  font-size:72px; /* increased form field handwritten size for easier reading */
  min-height:80px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

/* Smaller handwritten variant for UI elements like final mark and teacher comments */
.handwritten-small{
  font-family: "Bradley Hand", "Brush Script MT", "Lucida Handwriting", "Segoe Script", cursive;
  font-size:22px;
  font-weight:700;
  color:#2a1f1f;
  line-height:1.05;
  transform:rotate(-1.8deg);
  display:inline-block;
  letter-spacing:0.6px;
  background:transparent;
}

/* ensure multi-line handwritten areas look natural */
textarea.handwritten{
  min-height:140px;
  font-size:68px; /* larger textarea handwritten size for multi-line answers */
  padding-top:14px;
  padding-bottom:14px;
  line-height:1.18; /* improve multi-line spacing */
}

/* Print styles to keep it clean on paper */
@media print{
  body{background:white;padding:0;min-height:initial}
  .exam-sheet{
    box-shadow:none;
    border:none;
    margin:0;
    padding:18px 22px 30px;
    width:auto;
    max-width:none;
    border-radius:0;
    transform:none;
  }
  /* slightly darker texture on print */
  .exam-sheet::before{opacity:0.6}
  .crease{display:none}
  button{display:none}
}

/* Small index (table of contents) for the two exams (in-sheet) */
.exam-index{
  display:flex;
  gap:10px;
  align-items:center;
  margin:6px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size:14px;
  color:#222;
}
.exam-index strong{color:var(--accent);margin-right:8px;font-weight:700}
.exam-index a{
  color:var(--accent);
  text-decoration:none;
  background:rgba(10,61,98,0.04);
  padding:6px 10px;
  border-radius:6px;
  border:1px solid rgba(10,61,98,0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.exam-index a:hover{background:rgba(10,61,98,0.07)}
.exam-index span{color:#8f7f64;margin:0 6px}

/* Top fixed index bar for quick navigation between exam and answer sheet */
.top-index{
  position:fixed;
  top:64px; /* moved down to avoid overlapping top-right buttons */
  left:50%;
  transform:translateX(-50%);
  z-index:1300;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,244,230,0.98));
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(10,61,98,0.06);
  box-shadow: 0 12px 30px rgba(12,18,20,0.14);
  font-size:13px;
  align-items:center;
  gap:8px;
}
.top-index strong{margin-right:6px}
.top-index a{padding:6px 10px}
@media (max-width:640px){
  .top-index{top:64px; left:12px; right:12px; transform:none; font-size:13px; display:flex; justify-content:space-between}
  .top-index span{display:none}
}
 
/* Teacher's Notes toggle button (fixed, accessible) */
.notes-toggle{
  position:fixed;
  top:18px;
  right:18px;
  z-index:1200;
}
#notesBtn{
  background:#ffdd57;
  color:#1b1b1b;
  border:none;
  padding:10px 14px;
  border-radius:8px;
  font-weight:700;
  box-shadow:0 6px 18px rgba(0,0,0,0.12);
  cursor:pointer;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing:0.4px;
}
#readBtn.read-before{
  background:#e74c3c;
  color:white;
  border:none;
  padding:10px 14px;
  border-radius:8px;
  font-weight:700;
  box-shadow:0 6px 18px rgba(231,76,60,0.18);
  cursor:pointer;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing:0.4px;
  margin-left:10px;
}
#readBtn.read-before:focus{outline:3px solid rgba(231,76,60,0.12)}
#notesBtn:focus{outline:3px solid rgba(10,61,98,0.12)}

/* Modal overlay for teacher notes — pinned to the top so the note appears like a sheet of paper over the page */
.teacher-notes{
  position:fixed;
  top:18px;
  left:50%;
  transform:translateX(-50%);
  right:auto;
  bottom:auto;
  background:transparent; /* let the paper look like it's sitting on the page, dim background handled by exam-sheet shadow */
  display:flex;
  align-items:flex-start; /* align to top */
  justify-content:center;
  z-index:1400;
  transition:opacity 220ms ease, transform 220ms ease;
  opacity:0;
  pointer-events:none;
  padding:0;
}

/* Inner panel styled to look like a physical paper sheet */
.teacher-notes-inner{
  background:
    linear-gradient(180deg,#fffefc,#fbf4e6);
  border-radius:8px;
  max-width:760px;
  width:92%;
  padding:18px 20px;
  box-shadow:
    0 18px 40px rgba(12,18,20,0.35), /* cast shadow to lift from page */
    inset 0 1px 0 rgba(255,255,255,0.6);
  border:1px solid var(--paper-edge);
  font-family: Georgia, "Times New Roman", serif;
  color:#111;
  position:relative;
  max-height:70vh;
  overflow:auto;
  transform:rotate(-0.6deg); /* small tilt to look hand-placed */
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.015) 0px,
      rgba(0,0,0,0.015) 1px,
      transparent 1px,
      transparent 160px
    ),
    linear-gradient(180deg,#fffefc,#fbf4e6);
  -webkit-print-color-adjust:exact;
  border-radius:10px;
  padding:20px 22px;
}

/* subtle top "tab" to emphasize physical paper */
.teacher-notes-inner::before{
  content:"";
  position:absolute;
  top:-12px;
  left:26px;
  width:84px;
  height:18px;
  background:linear-gradient(180deg,#fff,#f3e9d9);
  border:1px solid rgba(0,0,0,0.06);
  border-bottom:0;
  border-radius:4px 4px 0 0;
  box-shadow:0 6px 18px rgba(12,18,20,0.12);
}

/* slightly larger header for legibility on the paper */
.teacher-notes-inner h2{
  margin:0 0 10px;
  font-size:18px;
  color:var(--accent);
  letter-spacing:0.2px;
}
.teacher-notes-inner .notes-content{
  background:transparent;
  padding:6px 0 2px;
}
.teacher-notes-inner .notes-content p{margin:8px 0;color:#222;line-height:1.45;font-size:15px}

/* Close button styled like a pen-scribble X */
.close-notes{
  position:absolute;
  top:8px;
  right:8px;
  background:transparent;
  border:0;
  font-size:28px;
  line-height:1;
  cursor:pointer;
  color:#666;
  padding:6px 8px;
}
.close-notes:focus{outline:2px solid rgba(10,61,98,0.12)}

.final-mark{
  margin:18px 0 28px;
  padding:22px 26px;
  border-radius:12px;
  background: linear-gradient(180deg, rgba(255,230,230,0.98), rgba(255,245,245,0.99));
  border:2px solid rgba(183,28,28,0.14);
  box-shadow:
    0 30px 60px rgba(183,28,28,0.12), /* stronger outer alarm shadow */
    inset 0 8px 18px rgba(183,28,28,0.05);
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-start;
  transform:translateZ(0);
  animation: pulse-alarm 1600ms infinite;
}
@keyframes pulse-alarm{
  0% { box-shadow: 0 18px 40px rgba(183,28,28,0.06), inset 0 6px 14px rgba(183,28,28,0.03); transform: translateY(0) scale(1); }
  50% { box-shadow: 0 32px 70px rgba(183,28,28,0.18), inset 0 10px 22px rgba(183,28,28,0.06); transform: translateY(-2px) scale(1.01); }
  100% { box-shadow: 0 18px 40px rgba(183,28,28,0.06), inset 0 6px 14px rgba(183,28,28,0.03); transform: translateY(0) scale(1); }
}

.final-mark h2{
  margin:0;
  color:#b71c1c;
  font-size:26px;
  font-weight:900;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing:0.6px;
  text-transform:uppercase;
  text-shadow: 0 2px 0 rgba(255,255,255,0.4);
}

.final-mark .mark{
  color:#7a0f0f;
  font-size:40px;
  margin-left:6px;
  font-weight:900;
  display:inline-block;
  background: linear-gradient(180deg, rgba(255,245,245,0.0), rgba(255,235,235,0.06));
  padding:6px 10px;
  border-radius:8px;
  border:1px solid rgba(122,15,15,0.12);
  box-shadow: 0 8px 20px rgba(122,15,15,0.10);
  transform: rotate(-2deg);
}

.final-mark .teacher-comment{
  margin:0;
  color:#4a2f2f;
  background:rgba(183,28,28,0.045);
  padding:12px 14px;
  border-left:6px solid rgba(183,28,28,0.18);
  border-radius:6px;
  font-size:16px;
  font-weight:700;
  box-shadow: 0 6px 18px rgba(183,28,28,0.03) inset;
}