:root {
  --felt: #0b4f24;
  --cream: #fff8dc;
  --paper: #fffdf0;
  --ink: #151515;
  --green: #0a8f2e;
  --lime: #19e34a;
  --gold: #d4a017;
  --gold-hi: #ffe27a;
  --red: #c1121f;
  --navy: #000080;
  --chrome: #d4d0c8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--felt);
  background-image:
    radial-gradient(rgba(255, 255, 255, .08) 1.2px, transparent 1.7px),
    radial-gradient(rgba(0, 0, 0, .16) 1.2px, transparent 1.7px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  color: var(--ink);
  font: 17px/1.45 "Times New Roman", Times, serif;
}

a { color: #0000ee; }
a:visited { color: #551a8b; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.center { text-align: center; }
.back { margin-top: 22px; }

.page {
  max-width: 720px;
  margin: 14px auto 40px;
  background: var(--cream);
  border: 6px ridge var(--gold);
  padding-bottom: 18px;
  overflow: hidden;
}

/* ---------- masthead + nav (every page) ---------- */
.masthead { text-align: center; padding: 18px 10px 10px; }
.masthead h1, .masthead .brand {
  font: italic 900 clamp(27px, 8.2vw, 56px)/1 Arial, Helvetica, sans-serif;
  color: var(--green);
  margin: 0;
  letter-spacing: -1px;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 var(--gold);
  overflow-wrap: anywhere;
}
.masthead .brand { font-size: clamp(24px, 7vw, 44px); }
.masthead .brand a, .masthead .brand a:visited { color: inherit; text-decoration: none; }
.masthead .sub { font-size: 16px; margin: 10px 0 0; font-style: italic; }

.nav {
  display: flex; flex-wrap: wrap; gap: 4px 22px; justify-content: center;
  padding: 9px 12px;
  font: bold 15px Arial, Helvetica, sans-serif;
  border-block: 2px dashed var(--green);
  background: #fffbe9;
}
.nav a[aria-current] { color: var(--ink); text-decoration: none; }

.marquee {
  background: #000;
  color: #ffee00;
  font: bold 15px "Courier New", Courier, monospace;
  overflow: hidden;
  white-space: nowrap;
  border-block: 3px double var(--gold);
  padding: 5px 0;
}
.marquee span { display: inline-block; padding-left: 100%; animation: scroll 30s linear infinite; }
@keyframes scroll { to { transform: translateX(-100%); } }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- home: the hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(150px, 250px) 1fr;
  gap: 20px;
  padding: 22px 16px 20px;
  align-items: center;
}
#king { margin: 0; }
#king svg { display: block; width: 100%; height: auto; }
#king .crown {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
#king.askew .crown { transform: rotate(-12deg); }
#king.fallen .crown { transform: translate(58px, 168px) rotate(80deg); transition: transform .7s cubic-bezier(.5, 0, .9, .4); }

.decree {
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 12px 14px;
  min-height: 6.4em;
  font: bold 22px/1.25 Arial, Helvetica, sans-serif;
  text-align: left;
}
.decree-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-height: 15px; margin-bottom: 6px; }
.decree .who { font: bold 12px "Courier New", Courier, monospace; color: #555; }
.hear {
  font: bold 12px "Courier New", Courier, monospace; line-height: 15px; color: #0000ee; white-space: nowrap;
  background: none; border: 0; text-decoration: underline; cursor: pointer;
  padding: 10px 8px; margin: -10px -8px; /* a finger-sized target without changing the layout */
}
.hear[aria-pressed="true"] { color: var(--red); }
.caret { display: inline-block; width: .5em; height: 1em; margin-left: 2px; background: var(--ink); vertical-align: -0.12em; animation: blink 1s steps(1) infinite; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.bigbtn {
  font: 900 22px Arial, Helvetica, sans-serif;
  padding: 14px 26px;
  min-height: 56px;
  background: #ffe600;
  color: #000;
  border: 4px outset #fff38a;
  border-radius: 0;
  cursor: pointer;
}
.bigbtn:active { border-style: inset; }
.tally { font: 13px "Courier New", Courier, monospace; margin: 12px 0 0; }
.earned { margin: 10px 0 0; font: bold 16px Arial, Helvetica, sans-serif; }

/* ---------- shared pieces ---------- */
section { padding: 4px 16px; scroll-margin-top: 10px; }
h2 { font: italic 900 25px/1.15 Arial, Helvetica, sans-serif; color: var(--green); margin: 18px 0 6px; }
.pagetitle { font: italic 900 30px/1.12 Arial, Helvetica, sans-serif; color: var(--green); margin: 18px 0 8px; }
.lede { margin: 0 0 12px; }
.fine { font-size: 14px; color: #444; margin: 12px 0 0; }
.box { border: 3px groove #bbb; background: var(--paper); padding: 12px; }
.divider { text-align: center; color: var(--gold); font-size: 18px; letter-spacing: 10px; margin: 18px 0 2px; user-select: none; }

label { display: block; font: bold 13px Arial, Helvetica, sans-serif; margin: 8px 0 3px; }
textarea {
  display: block; width: 100%; max-width: 100%;
  font: 16px Arial, Helvetica, sans-serif; color: #000;
  padding: 8px; background: #fff; border: 2px inset #ddd; border-radius: 0;
  resize: vertical; min-height: 96px;
}
.btn {
  font: bold 14px Arial, Helvetica, sans-serif;
  padding: 7px 14px; min-height: 38px;
  background: var(--chrome); color: #000;
  border: 2px outset #fff; border-radius: 0; cursor: pointer;
}
.btn:active { border-style: inset; }
.btn.primary { background: #ffe600; }
a.btn, a.btn:visited { display: inline-flex; align-items: center; color: #000; text-decoration: none; }
.linkbtn {
  background: none; border: 0; padding: 4px 2px; margin-right: 8px;
  font: 14px "Times New Roman", Times, serif; color: #0000ee; text-decoration: underline; cursor: pointer;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.row.center { justify-content: center; margin: 22px 0 6px; }
.note { font: 13px "Courier New", Courier, monospace; margin: 8px 0 0; min-height: 1.3em; }

/* ---------- inner pages ---------- */
.clear main { padding: 4px 18px 0; }
.clear ol, .clear ul { padding-left: 22px; }
.clear li { margin: 4px 0; }
.clear .warn { background: #ffe600; border: 3px solid #111; padding: 8px 12px; font: bold 15px Arial, Helvetica, sans-serif; text-align: center; margin: 16px 0 0; }
.clear .mini { float: right; width: 132px; margin: 4px 0 8px 16px; }
.clear table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.clear td, .clear th { border: 1px solid #999; padding: 6px 8px; text-align: left; vertical-align: top; }
.clear th { background: #f0e9c4; font: bold 14px Arial, Helvetica, sans-serif; }
.clear td:first-child { white-space: nowrap; font-weight: bold; }
.clear .src { font-size: 14px; color: #444; }

/* ---------- citations ---------- */
.summons {
  background: var(--red);
  color: #fff;
  text-align: center;
  padding: 12px 14px;
  font: bold 16px/1.35 Arial, Helvetica, sans-serif;
  border-bottom: 4px double #fff;
}
.summons b { display: block; font-size: 22px; letter-spacing: .5px; }
.cardimg { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border: 2px solid var(--ink); background: var(--cream); }
.cited main { padding-top: 16px; }

.clear ul.book {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px 16px;
}
ul.book li { margin: 0; padding: 6px; border: 2px solid transparent; }
ul.book li.picked { border: 2px dashed var(--red); background: #fff3b0; }
ul.book img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border: 2px solid var(--ink); background: var(--cream); }
ul.book .name { display: block; margin: 6px 0 0; color: var(--ink); text-decoration: none; font: bold 15px/1.3 Arial, Helvetica, sans-serif; min-height: 2.6em; }
ul.book .name:hover, ul.book .name:focus { text-decoration: underline; }
/* Four buttons: two by two under a card in the book, one row under the card on its own page. */
.cardacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.cardacts .btn { font-size: 13px; padding: 5px 9px; min-height: 34px; justify-content: center; }
.serve { margin: 12px 0 0; text-align: center; }
.serve p { margin: 0 0 8px; font: bold 14px/1.35 Arial, Helvetica, sans-serif; }
.serve .cardacts { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 0; }
.serve .cardacts .btn { font-size: 14px; padding: 7px 14px; min-height: 38px; }

/* the evidence: a button, then the court's answer in its place. The panel keeps one
   height, so nothing below it moves when the answer arrives. */
.evidence {
  max-width: 440px; min-height: 124px; margin: 0 auto; padding: 14px;
  border: 3px dashed var(--ink); background: #fff;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.exhibit { margin: 0; font: 14px "Courier New", Courier, monospace; color: #555; }
.exhibit:focus { outline: none; } /* focused only so a screen reader starts reading here */
.exhibit.found { font: bold 20px/1.4 Arial, Helvetica, sans-serif; color: var(--ink); }
.exhibit span { display: inline-block; }
.exhibit .tag { display: block; margin-bottom: 4px; font: bold 12px "Courier New", Courier, monospace; letter-spacing: 1px; color: #555; }

/* ---------- vague-o-meter ---------- */
.samples { font-size: 14px; margin: 8px 0 0; }
.samples .linkbtn { margin-right: 10px; }
.gauge { height: 26px; border: 2px inset #ddd; background: #fff; margin-top: 12px; }
.gauge i {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--navy) 0 12px, transparent 12px 15px);
  transition: width 1.1s steps(22);
}
.ruling { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.pct { font: 900 44px/1 Arial, Helvetica, sans-serif; }
.stamp {
  font: 900 20px/1.1 Arial, Helvetica, sans-serif; color: var(--red);
  border: 4px double var(--red); padding: 6px 10px; transform: rotate(-3deg); text-transform: uppercase;
}
.stamp.ok { color: var(--green); border-color: var(--green); }
.w4 { display: flex; flex-wrap: wrap; gap: 4px 14px; font: bold 13px "Courier New", Courier, monospace; margin: 12px 0 0; padding: 0 !important; list-style: none; }
.w4 .ok { color: var(--green); }
.w4 .no { color: var(--red); }
#m-text { margin: 10px 0 0; }

/* ---------- home: faq + footer ---------- */
dl.faq { margin: 0; }
dl.faq dt { font: bold 16px Arial, Helvetica, sans-serif; margin-top: 10px; }
dl.faq dd { margin: 2px 0 0 0; }
.foot { text-align: center; font-size: 14px; padding: 0 14px; }
.foot p { margin: 8px 0; }
/* a hit counter whose slots spell words instead of digits; one <b> per slot */
.odo {
  display: inline-block; vertical-align: middle; margin-left: 3px;
  background: #000; color: var(--lime); border: 2px inset #666; padding: 2px;
  font: bold 18px/1 "Courier New", Courier, monospace;
}
.odo b {
  display: inline-block; width: 19px; padding: 4px 0 3px; text-align: center;
  background: linear-gradient(#333, #000 40%, #000 60%, #262626);
}
.odo b + b { margin-left: 2px; }

/* ---------- dialogs ---------- */
#dialogs { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.dlg {
  position: absolute; width: min(330px, 88vw);
  background: var(--chrome); border: 2px outset #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .5);
  pointer-events: auto; font: 14px/1.35 Arial, Helvetica, sans-serif;
}
.dlg .tb {
  background: linear-gradient(90deg, var(--navy), #1084d0); color: #fff; font-weight: bold;
  padding: 4px 4px 4px 8px; display: flex; justify-content: space-between; align-items: center;
  cursor: move; user-select: none; touch-action: none;
}
.dlg .x {
  width: 22px; height: 20px; padding: 0; font: bold 12px/1 Arial, Helvetica, sans-serif;
  background: var(--chrome); color: #000; border: 2px outset #fff; cursor: pointer;
}
.dlg .bd { display: flex; gap: 12px; padding: 14px 12px 8px; align-items: flex-start; }
.dlg .ico {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: #ffe600; border: 2px solid #000; font: 900 22px/30px Arial, Helvetica, sans-serif; text-align: center;
}
.dlg p { margin: 6px 0 0; font-size: 15px; }
.dlg .acts { display: flex; gap: 8px; justify-content: center; padding: 6px 10px 12px; }

/* the share window */
.dlg.share { width: min(340px, 94vw); max-height: calc(100vh - 12px); overflow: auto; }
.dlg.share .bd { display: block; padding: 10px 12px 14px; }
.dlg.share .lead { margin: 0 0 8px; }
.dlg.share .grp { margin: 12px 0 5px; font: bold 12px "Courier New", Courier, monospace; text-transform: uppercase; }
.linkrow { display: flex; gap: 6px; }
.linkrow input {
  flex: 1; min-width: 0; font: 16px Arial, Helvetica, sans-serif; color: #000;
  padding: 4px 6px; background: #fff; border: 2px inset #ddd; border-radius: 0;
}
.nets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nets .btn, .linkrow .btn { font-size: 13px; padding: 5px 6px; min-height: 34px; justify-content: center; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .page { margin: 0 0 24px; border-width: 4px; }
  .masthead { padding-top: 14px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; padding-top: 16px; }
  #king { width: min(46vw, 180px); }
  .say { width: 100%; }
  .decree { font-size: 20px; min-height: 6.6em; } /* room for three lines, so the buttons below do not move while he types */
  .actions { justify-content: center; margin-top: 16px; }
  .serve .cardacts { display: grid; }
  .clear .mini { width: 96px; }
  .clear td:first-child { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee { white-space: normal; text-align: center; }
  .marquee span { animation: none; padding-left: 0; }
  .caret { animation: none; }
  #king .crown, .gauge i { transition: none; }
}
