/* Chrome shared by the three surveying sheets: across-the-street.html, its
   problem set, and vi-4.html.
   The look is cos-15.html's, deliberately: a sheet of paper, instruments
   along the top, readings along the bottom, and a column on the right that
   reads over the student's shoulder. Those sheets each carry their own copy
   of their engine; these three were written together and share one, because
   the protractor and the ruler are the same instruments in all three and a
   fix to either has to land in all three. */
:root{
  --paper:#f1e7cf; --paper-2:#eadcbb; --paper-3:#e2d2ad;
  --ink:#453220; --ink-2:#6b5335; --ink-faint:#9c8560;
  --rubric:#9d3a26;            /* red ink: the scribe, and the citation */
  --azure:#2e5c7a;             /* blue: the student's own marks */
  --gold:#a8813a;              /* ghost targets */
  --green:#4d6b32;
  --sky:#cfd9df; --sky-2:#e7ecef;
  --brick:#b08363; --brick-2:#9a6f52; --road:#b7b0a4;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--ink);
  font:16px/1.55 "Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif;
  background:#2a241c;
}
#wrap{display:flex; min-height:100vh; gap:0}
#stage{flex:1 1 auto; min-width:0; display:flex; flex-direction:column;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(255,250,235,.55), rgba(0,0,0,0) 60%),
    radial-gradient(140% 120% at 80% 100%, rgba(120,88,44,.30), rgba(0,0,0,0) 55%),
    linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 55%, var(--paper-3) 100%);
  box-shadow:inset 0 0 120px rgba(90,62,26,.35);
  position:relative;
}
#stage::after{ /* fibre grain */
  content:""; position:absolute; inset:0; pointer-events:none; opacity:.16; mix-blend-mode:multiply;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/><feColorMatrix type='saturate' values='0'/></filter><rect width='240' height='240' filter='url(%23f)' opacity='.5'/></svg>");
}

/* ── instrument rack ───────────────────────────────────────────── */
#rack{display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:10px 14px 8px; position:relative; z-index:3;
  border-bottom:1px solid rgba(80,58,30,.22)}
.tool{appearance:none; border:1px solid rgba(80,58,30,.35); background:rgba(255,248,232,.45);
  color:var(--ink); border-radius:3px; padding:7px 11px 6px; cursor:pointer;
  font:inherit; font-size:13px; letter-spacing:.02em; display:flex; align-items:center; gap:7px}
.tool:hover{background:rgba(255,250,238,.85)}
.tool[aria-pressed=true]{background:#fdf6e4; border-color:var(--ink); box-shadow:0 1px 0 rgba(70,50,24,.35), inset 0 0 0 1px rgba(255,255,255,.6)}
.tool.fresh{border-color:var(--rubric); color:var(--rubric); animation:offer 1.7s ease-in-out infinite}
@keyframes offer{0%,100%{box-shadow:0 0 0 0 rgba(157,58,38,.45)}50%{box-shadow:0 0 0 5px rgba(157,58,38,0)}}
.tool[hidden]{display:none}
.tool svg{display:block}
#rack .hint{flex:1 0 100%; font-size:13px; color:var(--ink-2); font-style:italic; text-align:left; margin:1px 0 -2px}
#rack .hint:empty{display:none}

/* ── the stage ─────────────────────────────────────────────────── */
#paperwrap{flex:1 1 auto; position:relative; min-height:400px}
svg#paper{position:absolute; inset:0; width:100%; height:100%; touch-action:none; display:block;
  user-select:none; -webkit-user-select:none}
svg#paper text{user-select:none}
.grab{cursor:grab} .grab:active{cursor:grabbing}

/* ── readings strip ────────────────────────────────────────────── */
#measures{display:flex; flex-wrap:wrap; gap:6px 18px; padding:9px 16px 11px; position:relative; z-index:2;
  border-top:1px solid rgba(80,58,30,.22); min-height:42px; align-items:center}
.m{font-size:14px; white-space:nowrap}
.m b{font-weight:normal; color:var(--ink-2)}
.m i{font-style:normal; font-variant-numeric:tabular-nums; font-weight:600}
.m.blue i{color:var(--azure)} .m.red i{color:var(--rubric)} .m.green i{color:var(--green)} .m.ink i{color:var(--ink-2)}
.m.live i{background:rgba(46,92,122,.12); border-radius:2px; padding:0 3px}
#measures .none{color:var(--ink-faint); font-style:italic; font-size:13px}

/* ── the scribe's column ───────────────────────────────────────── */
#book{flex:0 0 400px; max-width:400px; overflow-y:auto; height:100vh;
  background:linear-gradient(180deg,#f3e9d2,#e9dcbd);
  border-left:2px solid rgba(70,50,24,.35); box-shadow:inset 14px 0 26px -18px rgba(60,40,14,.8);
  padding:20px 22px 60px}
#book h1{font-size:19px; margin:0 0 2px; letter-spacing:.01em}
#book .sub{font-size:13px; color:var(--ink-2); margin:0 0 14px; font-style:italic}
.card{border-top:1px solid rgba(80,58,30,.28); padding:14px 0 4px}
.card:first-of-type{border-top:none}
.card .n{font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-faint)}
.card h2{font-size:16px; margin:2px 0 7px; font-weight:600}
.card p{margin:0 0 9px}
.card img.figure{display:block; width:100%; height:auto; border-radius:4px; margin:4px 0 10px; background:#ece7de}
/* history folds to one line a card; press a line to read that card again */
.card.past{padding:5px 0; border-top-color:rgba(80,58,30,.16)}
.card.past:not(.open) > :not(.recap){display:none}
.card.past.open{padding-bottom:10px}
.card.past .task{background:rgba(255,252,242,.5)}
.recap{display:none}
.card.past .recap{display:flex; align-items:baseline; gap:8px; width:100%; appearance:none; border:0; background:transparent;
  font:inherit; font-size:13.5px; color:var(--ink-2); text-align:left; padding:3px 0; cursor:pointer}
.card.past .recap:hover{color:var(--ink)}
.recap .tick{color:var(--green); font-size:12px}
.recap b{font-weight:600; white-space:nowrap}
.recap .sum{color:var(--ink-faint); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0}
.card.past.open .recap .sum{white-space:normal}
.card.fresh{animation:arrive .5s ease-out}
@keyframes arrive{from{opacity:0; transform:translateY(10px)} to{opacity:1; transform:none}}
@media (prefers-reduced-motion:reduce){.card.fresh{animation:none}}

/* fill in: slots filled by tapping the figure, or a number typed in place */
.slots{display:inline-grid; grid-template-columns:auto auto auto; align-items:center; gap:4px 10px; margin:10px 0 6px}
.frac{display:grid; grid-template-rows:auto auto auto; justify-items:center; gap:3px}
/* The bar is an underline under a row of spaces, clipped to the fraction's
   width. An underline is painted as text, so it takes the numbers' colour
   and a browser that shows the page dark lightens it with them. A border or a
   background is not treated as text, and went dim against a dark page. */
.frac i{display:block; position:relative; width:100%; height:9px; overflow:hidden; font-style:normal; color:inherit}
/* taken out of flow, so the row of spaces cannot widen the fraction: the bar
   is exactly as wide as whatever is above and below it */
.frac i u{position:absolute; left:0; top:-0.5px; white-space:nowrap; font-size:10px; line-height:10px; color:inherit;
  text-decoration:underline; text-decoration-thickness:2.5px; text-underline-offset:-3px; text-decoration-skip-ink:none}
.frac.inline{display:inline-grid; vertical-align:middle; margin:0 3px; gap:1px; font-variant-numeric:tabular-nums}
.frac.inline i{height:7px}
.frac.inline i u{top:-1.5px}
.reply .eqsign{font-size:16px; margin:0 2px; vertical-align:middle}
.slot{appearance:none; min-width:92px; min-height:40px; border:1.5px dashed rgba(80,58,30,.5); border-radius:3px;
  background:rgba(255,252,242,.85); font:inherit; font-size:15px; color:var(--ink); cursor:pointer; padding:3px 8px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1.15}
.slot small{font-size:11px; color:var(--ink-faint); letter-spacing:.04em}
.slot.full{border-style:solid}
.slot.sel{outline:2.5px solid var(--gold); outline-offset:1px}
.slot.a{border-color:var(--azure)} .slot.b{border-color:var(--rubric)}
.eqsign{font-size:22px}
.fillrow{display:flex; align-items:center; gap:8px; margin:10px 0 4px; flex-wrap:wrap}
.fillrow input{font:inherit; font-size:17px; width:110px; padding:6px 8px; border:1.5px solid rgba(80,58,30,.5); border-radius:3px;
  background:#fffdf6; color:var(--ink); font-variant-numeric:tabular-nums}
.fillrow input:focus{outline:2.5px solid var(--gold); outline-offset:1px}
blockquote.euclid{margin:9px 0 11px; padding:0 0 0 13px; border-left:2px solid var(--rubric);
  color:var(--rubric); font-style:italic}
blockquote.euclid cite{display:block; font-style:normal; font-size:12px; color:var(--ink-2); margin-top:5px; letter-spacing:.03em}
.task{background:rgba(255,252,242,.85); border:1px solid rgba(80,58,30,.3); border-radius:4px;
  padding:10px 12px 10px; margin:10px 0 6px; font-size:15px}
.task .ask{margin:0}
/* inside the problem box, answers are rows of one surface rather than boxes of their own */
.task .choices{margin:10px -12px 0; gap:0}
.task button.opt{background:transparent; border:0; border-top:1px solid rgba(80,58,30,.18); border-radius:0; padding:9px 12px}
.task button.opt:hover:not(:disabled){background:rgba(80,58,30,.07); border-color:rgba(80,58,30,.18)}
.task button.opt.right{background:rgba(206,226,184,.55); border-color:rgba(77,107,50,.35)}
.task .reply{margin:10px -12px 0; border-left:0; border-top:1px solid rgba(80,58,30,.18); padding:9px 12px 10px}
.task .reply:last-child{margin-bottom:-10px}
.task .then{margin:10px -12px 0; padding:10px 12px; border-top:1px solid rgba(80,58,30,.3)}
.task .then:last-child{margin-bottom:-10px}
.then.fresh{animation:arrive .5s ease-out}
.task .fillrow{margin:10px 0 2px}
.task > .act{margin-top:10px}
.task .k{display:block; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-faint); margin-bottom:3px}
.task.done{border-color:var(--green); background:rgba(232,242,216,.7)}
.task.done .k::after{content:" ✓"; color:var(--green)}
.toolcard{border:1px dashed rgba(80,58,30,.5); border-radius:3px; padding:9px 11px; margin:10px 0; font-size:14px; background:rgba(255,250,235,.5)}
.toolcard .k{font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-faint)}
.toolcard b{font-weight:600}
.act{appearance:none; font:inherit; font-size:14px; cursor:pointer; margin:4px 6px 4px 0;
  background:#fdf6e4; border:1px solid var(--ink); border-radius:3px; padding:6px 12px; color:var(--ink);
  box-shadow:0 1px 0 rgba(70,50,24,.4)}
.act:hover{background:#fffdf5}
button.act:disabled{opacity:.4; cursor:default; box-shadow:none}
.act.ghost{border-style:dashed; box-shadow:none; background:transparent}
.act.replay{border-style:dashed; box-shadow:none; background:transparent; font-size:13px}
a.act{display:inline-block; text-decoration:none; color:var(--ink)}

/* ── choices ───────────────────────────────────────────────────── */
.choices{margin:8px 0 2px; display:flex; flex-direction:column; gap:6px}
button.opt{appearance:none; font:inherit; font-size:14.5px; text-align:left; cursor:pointer;
  background:rgba(255,252,242,.9); border:1px solid rgba(80,58,30,.35); border-radius:3px;
  padding:8px 11px; color:var(--ink)}
button.opt:hover:not(:disabled){background:#fffdf5; border-color:var(--ink)}
button.opt:disabled{cursor:default; opacity:.45}
button.opt.picked{border-color:var(--ink); box-shadow:inset 0 0 0 1px rgba(70,50,24,.3)}
button.opt.right{border-color:var(--green); background:rgba(232,242,216,.75)}
button.opt.spent{opacity:.55}
.reply{font-size:14px; margin:6px 0 2px; padding:8px 11px; border-left:2px solid var(--rubric);
  background:rgba(157,58,38,.06); color:var(--ink)}
.reply.good{border-left-color:var(--green); background:rgba(77,107,50,.08)}

/* ── the scribe's remark, over the stage ───────────────────────── */
#scribe{position:absolute; left:16px; right:16px; bottom:12px; z-index:4; pointer-events:none;
  font-size:15px; color:var(--ink); text-shadow:0 1px 0 rgba(255,250,238,.9)}
#scribe .bub{display:inline-block; background:rgba(255,252,242,.94); border:1px solid rgba(80,58,30,.4);
  border-radius:3px; padding:7px 12px; box-shadow:0 2px 10px rgba(60,40,14,.25); max-width:min(720px,92%)}
#scribe .bub.tutor{border-color:var(--rubric); color:var(--rubric)}
#scribe:empty{display:none}

@media (max-width:900px){
  #wrap{flex-direction:column}
  #book{flex:none; max-width:none; height:auto; scroll-behavior:smooth; border-left:0; border-top:2px solid rgba(70,50,24,.35)}
  #paperwrap{min-height:56vh}
}
