/* ═══════════════════════════════════════════════
   CASE FILE / DETECTIVE DOSSIER — 五下 LEGO 感測 week pages
   專屬於 student_web_五下 目錄
   配色：米紙 + 印章紅 + 螢光黃 + 機密黑
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Bebas+Neue&family=Noto+Serif+TC:wght@700;900&family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  --paper: #e6dcc4;
  --paper-dark: #d4c5a4;
  --paper-edge: #b8a482;
  --ink: #1c1814;
  --ink-soft: #4a3f30;
  --red: #b22232;
  --red-deep: #7a1722;
  --string: #c92a2a;
  --highlight: #f5dd6e;
  --tape: rgba(212,180,80,0.55);
  --redact: #14110d;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", -apple-system, sans-serif;
  line-height: 1.85;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(160,120,60,0.18) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 90%, rgba(120,80,40,0.20) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, transparent 0%, rgba(0,0,0,0.06) 100%),
    var(--paper);
  position: relative;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.85' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0.55;
  z-index: 1;
}

.typewriter { font-family: "Special Elite", monospace; }
.stencil { font-family: "Bebas Neue", "Impact", sans-serif; letter-spacing: 0.12em; }

/* ═══ TOP CASE STRIP ═══ */
.case-strip {
  background: var(--ink);
  color: var(--paper);
  padding: 8px 0;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-align: center;
  position: relative;
  z-index: 4;
}
.case-strip::before, .case-strip::after {
  content: "▪ ▪ ▪ CONFIDENTIAL ▪ ▪ ▪";
  margin: 0 12px;
  color: var(--red);
}

/* ═══ MAIN ═══ */
main.dossier {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 32px 96px;
  position: relative;
  z-index: 2;
}

/* ═══ CRUMB ═══ */
.crumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  margin-bottom: 26px;
  background: var(--paper-dark);
  border: 1px solid var(--paper-edge);
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.crumb a {
  color: var(--ink);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
  transition: all 0.2s;
}
.crumb a:hover {
  background: var(--ink);
  color: var(--highlight);
}
.crumb a.home { background: var(--red); color: var(--paper); border-color: var(--red); }
.crumb a.home:hover { background: var(--red-deep); color: var(--highlight); }
.crumb .muted { color: var(--ink-soft); padding: 5px 12px; }

/* ═══ WK HEADER (CASE FILE COVER) ═══ */
.wk-header {
  position: relative;
  padding: 32px 36px 28px;
  margin-bottom: 36px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.15);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
}
.wk-header::before {
  content: "▪ FILE OPENED ▪";
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--ink);
  color: var(--highlight);
  padding: 3px 14px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
}
.wk-header::after {
  content: "★";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 3px solid var(--red);
  color: var(--red);
  display: grid;
  place-items: center;
  font-size: 22px;
  transform: rotate(-12deg);
  background:
    radial-gradient(circle, rgba(178,34,50,0.06) 30%, transparent 60%),
    repeating-conic-gradient(rgba(178,34,50,0.08) 0 6deg, transparent 6deg 14deg);
  opacity: 0.7;
}
.wk-stamp {
  display: inline-block;
  transform: rotate(-3deg);
  padding: 12px 22px;
  border: 3px solid var(--red);
  color: var(--red);
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.18em;
  text-align: center;
  position: relative;
}
.wk-stamp::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px dashed var(--red);
  opacity: 0.55;
}
.wk-stamp .label {
  font-size: 11px;
  letter-spacing: 0.3em;
  display: block;
}
.wk-stamp .num {
  font-size: 48px;
  line-height: 0.95;
  display: block;
}
.wk-stamp .file {
  font-size: 10px;
  letter-spacing: 0.25em;
  margin-top: 4px;
  display: block;
  color: var(--ink-soft);
}
.wk-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}
.wk-meta .tag {
  padding: 3px 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
}
.wk-meta .difficulty {
  color: var(--red);
  letter-spacing: 0.1em;
  font-size: 13px;
}
.wk-title {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.wk-title .accent {
  color: var(--red);
  position: relative;
}
.wk-title .accent::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%; bottom: 6%;
  height: 12px;
  background: var(--highlight);
  z-index: -1;
  transform: skew(-3deg) rotate(-1deg);
  opacity: 0.7;
}

/* ═══ MODULE: case file panel ═══ */
.module {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  padding: 28px 32px 26px;
  margin-bottom: 26px;
  box-shadow: 3px 4px 0 rgba(0,0,0,0.12);
}
.module::before {
  content: "";
  position: absolute;
  top: 0; left: 32px;
  width: 90px;
  height: 8px;
  background: var(--paper-dark);
  transform: translateY(-4px);
  border-radius: 4px 4px 0 0;
  border: 1px solid var(--paper-edge);
  border-bottom: none;
}
.module::after {
  content: "";
  position: absolute;
  top: -10px; right: 30px;
  width: 60px; height: 18px;
  background: var(--tape);
  border: 1px dashed rgba(0,0,0,0.25);
  transform: rotate(4deg);
  pointer-events: none;
}
.module h2 {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.module h2::before {
  content: "❖ ";
  color: var(--red);
}
.module p { margin-bottom: 12px; font-size: 16px; color: var(--ink-soft); }
.module p:last-child { margin-bottom: 0; }
.module strong {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(transparent 60%, var(--highlight) 60%);
  padding: 0 2px;
}
.module .note {
  background: var(--paper-dark);
  border-left: 4px solid var(--red);
  padding: 12px 16px;
  font-size: 14.5px;
  margin: 14px 0;
  font-family: "Special Elite", monospace;
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* highlight: open evidence */
.module--evidence::before { background: var(--red); border-color: var(--red-deep); }
.module--evidence h2::before { content: "🔍 "; }

/* warn: redacted */
.module--warn {
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(178,34,50,0.05) 14px 28px),
    var(--paper);
  border-color: var(--red-deep);
}
.module--warn h2 { color: var(--red); border-bottom-color: var(--red); }
.module--warn h2::before { content: "⚠ "; }

/* ═══ FIGURE / EVIDENCE PHOTO ═══ */
.shot {
  margin: 18px 0 22px;
  padding: 12px 12px 0;
  background: var(--paper-dark);
  border: 1px solid var(--paper-edge);
  position: relative;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.18);
  transform: rotate(-0.6deg);
}
.shot:nth-of-type(2n) { transform: rotate(0.5deg); }
.shot::before {
  content: "▸ EXHIBIT";
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--ink);
  color: var(--highlight);
  padding: 2px 10px;
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
}
.shot::after {
  content: "";
  position: absolute;
  top: -8px; right: 24px;
  width: 50px; height: 16px;
  background: var(--tape);
  border: 1px dashed rgba(0,0,0,0.25);
  transform: rotate(-5deg);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--ink);
  background: white;
  filter: contrast(0.96) sepia(0.08);
}
.shot figcaption {
  font-family: "Special Elite", monospace;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  padding: 10px 4px 12px;
  letter-spacing: 0.04em;
}
.shot figcaption strong { color: var(--red); background: none; }

.shot-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 18px;
  background: var(--paper-dark);
  border: 1px dashed var(--paper-edge);
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}
.shot-pending .ph-icon { font-size: 22px; color: var(--red); }
.shot-pending code { font-family: "Special Elite", monospace; color: var(--red); }
.shot-pending small { color: var(--ink-soft); font-size: 10px; }

/* ═══ TIP CARDS (clue cards) ═══ */
.tip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 6px;
}
.tip-card {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  padding: 16px 16px 14px;
  position: relative;
  box-shadow: 2px 3px 0 rgba(0,0,0,0.1);
  transform: rotate(-0.4deg);
}
.tip-card:nth-child(2n) { transform: rotate(0.4deg); }
.tip-card::before {
  content: "";
  position: absolute;
  top: -8px; left: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d4514f, #911b1b 70%);
  transform: translateX(-50%);
  box-shadow: 1px 2px 3px rgba(0,0,0,0.4);
}
.tip-card .tip-icon { display: none; }
.tip-card strong {
  display: block;
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
  background: none;
  padding: 0;
}
.tip-card span {
  font-family: "Special Elite", monospace;
  font-size: 13.5px;
  color: var(--ink-soft);
  display: block;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

/* ═══ LISTS ═══ */
.module ol {
  list-style: none;
  counter-reset: ev;
  margin: 14px 0 6px;
}
.module ol > li {
  counter-increment: ev;
  position: relative;
  padding: 10px 0 10px 60px;
  margin-bottom: 4px;
  border-bottom: 1px dashed rgba(0,0,0,0.18);
  font-size: 15.5px;
  color: var(--ink);
}
.module ol > li::before {
  content: counter(ev, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 8px;
  width: 44px;
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 18px;
  letter-spacing: 0.1em;
  color: var(--paper);
  background: var(--ink);
  padding: 4px 0;
  border: 1px solid var(--ink);
  box-shadow: 2px 2px 0 var(--red);
}
.module ol > li strong {
  color: var(--red);
  font-weight: 700;
  background: linear-gradient(transparent 60%, var(--highlight) 60%);
}

.module ul {
  list-style: none;
  margin: 12px 0;
  padding-left: 0;
}
.module ul > li {
  position: relative;
  padding: 6px 0 6px 28px;
  font-size: 15.5px;
  color: var(--ink-soft);
}
.module ul > li::before {
  content: "▸";
  position: absolute;
  left: 6px;
  top: 6px;
  color: var(--red);
  font-weight: 700;
}
.module ul ul > li::before { color: var(--ink-soft); content: "·"; font-size: 18px; top: 0; }
.module ul ul { margin-left: 12px; }

/* ═══ STEP FLOW ═══ */
.step-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.step-card {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  padding: 14px 14px 14px 44px;
  position: relative;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.step-card .step-num {
  position: absolute;
  left: 8px; top: 12px;
  width: 28px;
  height: 28px;
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 18px;
  color: var(--paper);
  background: var(--red);
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.step-card strong {
  display: block;
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 2px;
}
.step-card span {
  font-family: "Special Elite", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

/* ═══ BOTTOM NAV ═══ */
.bot-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 3px double var(--ink);
  gap: 12px;
  flex-wrap: wrap;
}
.bot-nav a, .bot-nav span {
  display: inline-block;
  padding: 12px 20px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all 0.2s;
}
.bot-nav a:hover {
  background: var(--ink);
  color: var(--highlight);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--red);
}
.bot-nav a.home {
  background: var(--red);
  color: var(--paper);
  border-color: var(--red-deep);
  box-shadow: 3px 3px 0 var(--red-deep);
}
.bot-nav a.home:hover {
  background: var(--red-deep);
  box-shadow: 5px 5px 0 var(--ink);
}
.bot-nav .muted {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--paper-edge);
  box-shadow: none;
  cursor: default;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 720px) {
  main.dossier { padding: 28px 16px 60px; }
  .wk-header {
    grid-template-columns: 1fr;
    padding: 26px 22px 22px;
  }
  .wk-header::after { display: none; }
  .wk-stamp .num { font-size: 38px; }
  .module { padding: 22px 22px 20px; }
  .module ol > li { padding-left: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ SPIKE 積木排列圖（.blocks）— 沿用四下 W20 元件 ═══
   顏色對齊 SPIKE App 積木分類，學生照顏色找抽屜 */
.blk-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin: 14px 0 4px; font-size: 14px; color: var(--ink-soft);
}
.blk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.blk-legend i {
  width: 16px; height: 16px; background: var(--c);
  border: 1px solid var(--ink); border-radius: 3px;
}
.evt { --c: #f2c230; --t: var(--ink); }
.ctl { --c: #e8902a; --t: #fff; }
.mov { --c: #e0509f; --t: #fff; }
.sen { --c: #63c6df; --t: var(--ink); }
.snd { --c: #a95cc4; --t: #fff; }
.blocks {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 3px; max-width: 100%; overflow-x: auto;
  margin: 16px 0 6px; padding: 18px 20px 20px;
  background: #f3ead2; border: 1.5px dashed var(--paper-edge);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 15.5px; font-weight: 600; line-height: 1.35;
}
.blk, .blk-c {
  background: var(--c); color: var(--t);
  border-radius: 5px; box-shadow: 2px 2px 0 var(--ink); white-space: nowrap;
}
.blk { padding: 8px 14px; }
.blk.hat { border-radius: 18px 18px 5px 5px; padding-top: 12px; }
.blk-c { display: flex; flex-direction: column; min-width: 240px; }
.blk-h { padding: 8px 14px; }
.blk-in {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  margin-left: 18px; padding: 4px 8px 4px 0;
  background: #f3ead2; border-radius: 4px 0 0 4px;
}
.blk-in .blk, .blk-in .blk-c { box-shadow: 1.5px 1.5px 0 var(--ink); }
.blk-f { height: 12px; }
.blk b { font-weight: 800; padding: 0 2px; }
.slot {
  display: inline-block; margin: 0 4px; padding: 3px 16px;
  background: var(--c); color: var(--t);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
}
.blk-note { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
@media (max-width: 640px) {
  .blocks { font-size: 14px; padding: 14px 12px 16px; }
  .blk-c { min-width: 0; }
}
