:root {
  --desk: #2a241d;
  --desk-edge: #1e1a15;
  --paper: #f1e6c8;
  --ink: #3b2e22;
  --muted: #b9a988;
  --accent: #c9a45c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, var(--desk), var(--desk-edge));
  color: var(--paper);
  font-family: "IM Fell English", Georgia, serif;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 16px 14px;
}
.brand h1 { margin: 0; font-family: "IM Fell English SC", Georgia, serif; font-size: 2rem; font-weight: 400; letter-spacing: .04em; }
.brand p { margin: 0; color: var(--muted); font-style: italic; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.controls label { color: var(--muted); }
.controls input, .controls button {
  font: inherit;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #5a4c3b;
  padding: 7px 12px;
}
.controls input { width: 11rem; background: #1b1713; color: var(--paper); }
.controls input:focus-visible, .controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls button { background: var(--paper); color: var(--ink); cursor: pointer; }
.controls button:hover { background: #fff6dc; }
.controls button[type="submit"] { background: var(--accent); border-color: var(--accent); }

.controls button.watch { background: #f6ecd2; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.controls button:disabled { opacity: .55; cursor: default; }

main { max-width: 1600px; margin: 0 auto; padding: 0 16px 28px; }
.sheet { position: relative; }

/* the replay's caption card, laid over the bottom of the map */
.replay { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: center; pointer-events: none; }
.replay[hidden] { display: none; }
.replay__card {
  pointer-events: auto;
  width: 100%;
  max-width: 780px;
  padding: 14px 18px;
  border: 1px solid rgba(201, 164, 92, .55);
  border-radius: 10px;
  background: rgba(30, 25, 20, .88);
  color: var(--paper);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.replay__bar { display: flex; gap: 4px; margin-bottom: 10px; }
.replay__bar span { position: relative; flex: 1; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(241, 230, 200, .2); }
.replay__bar span::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); }
.replay__step { margin: 0; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.replay__step[data-paused="yes"]::after { content: " · paused"; color: var(--muted); }
.replay__keys { margin: 0 auto 0 0; align-self: center; font-size: .8rem; color: var(--muted); }
.replay__keys[hidden] { display: none; }
@media (hover: none) { .replay__keys { display: none; } }
.replay__text { margin: .3rem 0 .25rem; font-size: 1.22rem; line-height: 1.35; }
.replay__tech { margin: 0; min-height: 1.2em; font-size: .92rem; font-style: italic; color: var(--muted); }
.replay__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.replay__actions button {
  font: inherit;
  font-size: .92rem;
  padding: 5px 12px;
  border: 1px solid #5a4c3b;
  border-radius: 6px;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}
.replay__actions button:hover { border-color: var(--accent); }
.replay__actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay__actions button[hidden] { display: none; }
canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
}
.stats { margin: 10px 0 0; color: var(--muted); font-size: .9rem; text-align: right; cursor: help; }

@media (max-width: 760px) {
  /* on small screens the caption sits under the map instead of covering it */
  .replay { position: static; margin-top: 10px; }
  .replay__text { font-size: 1.05rem; }
}
@media (max-width: 640px) {
  .controls input { width: 100%; flex: 1 1 100%; }
  .stats { text-align: left; }
}
