/* Lantern Logic: a paper-cut night market. Light is the only strong colour on the page. */
:root {
  --night: #1d1740;
  --night-deep: #130e30;
  --dusk: #2f2763;
  --cobble: #3c3379;
  --paper: #fff1cf;
  --paper-dim: #d6cdec;
  --ink: #241338;
  --saffron: #ffc857;
  --amber: #efa02f;
  --persimmon: #e4472a;
  --awning: #157a76;
  --awning-dark: #0d4f52;
  --alarm: #b40038;
  --ok: #bdf2c8;
  --display: "Rockwell", "Roboto Slab", "Sitka Small", "Cambria", Georgia, serif;
  --text: "Gill Sans", "Gill Sans MT", "Trebuchet MS", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night);
  color: var(--paper);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; margin: 0; }
p { margin: 0; }
h2:focus, h3:focus { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.note { color: var(--paper-dim); font-size: .92rem; max-width: 60ch; }
.note-problem { color: #ffc4d4; font-weight: 700; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  border: 2px solid var(--ink);
  border-radius: 3px 3px 12px 3px;
  background: var(--paper);
  color: var(--ink);
  font: 700 1rem/1.15 var(--text);
  min-height: 46px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--night-deep);
  touch-action: manipulation;
}
.btn small { display: block; font-weight: 600; font-size: .76rem; }
.btn:hover:not(:disabled) { background: #fff8e6; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--night-deep); }
.btn:disabled { background: #6c6496; color: #1a1336; cursor: not-allowed; box-shadow: none; }
.btn-main { background: var(--saffron); font-family: var(--display); font-size: 1.15rem; padding: 12px 20px; min-height: 52px; }
.btn-main:hover:not(:disabled) { background: #ffd67e; }
.btn-small { min-height: 44px; padding: 6px 10px; font-size: .92rem; }
.btn:focus-visible, input:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px #1f49e0;
}

/* ---------------------------------------------------------------- start screen */
.start {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 0 16px;
  background:
    radial-gradient(70% 34% at 50% 8%, rgba(255, 200, 87, .2), transparent 70%),
    var(--night);
}

.sign {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 26px;
  padding-top: 6px;
  font-size: clamp(1.5rem, 8vw, 3rem);
}
.sign-line { display: flex; position: relative; gap: clamp(1px, .5vw, 4px); padding-top: 22px; }
.sign-line::before {
  content: "";
  position: absolute;
  left: -14px; right: -14px; top: 6px; height: 18px;
  border-bottom: 2px solid var(--paper-dim);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.sign-letter {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.32em;
  height: 1.6em;
  margin-top: var(--sag, 6px);
  color: var(--ink);
  background: linear-gradient(90deg, #f6a93a 0, var(--saffron) 28%, #ffe29b 50%, var(--saffron) 72%, #f6a93a 100%);
  border: 2px solid var(--ink);
  border-radius: 46% 46% 44% 44% / 40% 40% 38% 38%;
  animation: kindle .5s calc(var(--k) * 90ms + 150ms) both ease-out;
}
.sign-letter::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 2px; height: 7px;
  background: var(--paper-dim);
}
.sign-letter::after {
  content: "";
  position: absolute;
  bottom: -9px; left: 50%;
  width: 7px; height: 8px;
  margin-left: -3px;
  background: repeating-linear-gradient(90deg, var(--persimmon) 0 2px, transparent 2px 3px);
}
.sign-line .sign-letter:nth-child(1), .sign-line .sign-letter:nth-last-child(1) { --sag: 0px; }
.sign-line .sign-letter:nth-child(2), .sign-line .sign-letter:nth-last-child(2) { --sag: 5px; }
.sign-line .sign-letter:nth-child(3), .sign-line .sign-letter:nth-last-child(3) { --sag: 9px; }
.sign-line .sign-letter:nth-child(4) { --sag: 10px; }
@keyframes kindle {
  from { background: var(--dusk); color: var(--paper-dim); box-shadow: none; }
  to { box-shadow: 0 0 22px rgba(255, 200, 87, .55); }
}
.sign-letter { box-shadow: 0 0 22px rgba(255, 200, 87, .55); }

.start-main { display: grid; gap: 14px; justify-items: start; margin-top: 12px; }
.pitch { font-size: 1.14rem; max-width: 40ch; }
.start-form { display: grid; gap: 12px; width: 100%; justify-items: start; }
.start-form .btn-main { width: 100%; max-width: 420px; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.code-row label { font-weight: 700; }
.code-row input {
  width: 5.4ch;
  min-height: 44px;
  box-sizing: content-box;
  padding: 0 8px;
  font: 700 1.1rem var(--display);
  text-align: center;
  color: var(--paper);
  background: var(--dusk);
  border: 2px solid var(--paper-dim);
  border-radius: 3px;
}
.code-row input[aria-invalid="true"] { border-color: #ff7fa3; }
.start-extras { display: flex; flex-wrap: wrap; gap: 10px; }

.rules-panel h2 { font-size: 1.3rem; margin-bottom: 10px; }
.diagrams { display: grid; gap: 14px; }
.diagram { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.diagram figcaption { font-size: .95rem; max-width: 46ch; }
.diagram figcaption strong { display: block; font-family: var(--display); font-size: 1.02rem; margin-bottom: 2px; }
.mini-board {
  --cell: 27px;
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-auto-rows: var(--cell);
  gap: 1px;
  padding: 3px;
  background: var(--night-deep);
  border-radius: 3px;
}

.start-street {
  display: flex;
  align-items: flex-end;
  height: 66px;
  margin: 6px -16px 0;
  border-bottom: 8px solid var(--night-deep);
  align-self: end;
}
.start-street .shop { flex: 1; height: 100%; }

@media (min-width: 860px) {
  .start {
    grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.1fr);
    grid-template-rows: auto 1fr auto;
    gap: 24px 48px;
    padding: 0 max(32px, calc(50vw - 560px));
  }
  .sign { grid-column: 1 / -1; font-size: clamp(2.2rem, 5vw, 3.4rem); padding-top: 10px; }
  .start-main { align-self: start; }
  .start-street { grid-column: 1 / -1; height: 96px; margin: 0 calc(-1 * max(32px, calc(50vw - 560px))); }
  .mini-board { --cell: 31px; }
}

/* ---------------------------------------------------------------- play layout */
.play {
  --side: 18px;
  --rim: clamp(34px, calc((100dvh - 100vw - 345px) / 2 + 18px), 74px);
  --bar-h: 58px;
  --panel-h: 212px;
  --cell: clamp(34px,
    min(
      calc((100vw - 12px - 2 * var(--side)) / var(--n)),
      calc((100dvh - var(--bar-h) - var(--panel-h) - 2 * var(--rim) - 18px) / var(--n))
    ),
    78px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--night);
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--bar-h);
  padding: 6px 8px;
  background: var(--night-deep);
}
.bar-title { flex: 1; min-width: 0; }
.bar-title h2 { font-size: 1.14rem; white-space: nowrap; }
.bar-title p { font-size: .82rem; color: var(--paper-dim); }
.pips { display: none; gap: 2px; }
.pip { width: 24px; height: 28px; opacity: .35; filter: grayscale(1); }
.pip.now { opacity: .8; filter: grayscale(.6); }
.pip.done { opacity: 1; filter: none; }
.pip svg { display: block; width: 100%; height: 100%; }
.clock { font: 700 1.14rem var(--display); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.bar .btn-small { padding: 4px 8px; font-size: .84rem; line-height: 1.05; max-width: 76px; }

@media (max-width: 380px) {
  .bar { gap: 6px; padding: 6px; }
  .bar-title h2 { font-size: .98rem; white-space: normal; }
  .bar-title p { font-size: .76rem; }
  .clock { font-size: 1rem; }
  .bar .btn-small { font-size: .78rem; padding: 4px 6px; max-width: 62px; }
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 10px;
}

.plaza {
  display: grid;
  grid-template-columns: var(--side) auto var(--side);
  grid-template-rows: var(--rim) auto var(--rim);
  grid-template-areas: ". top ." "left board right" ". bottom .";
}
.strip { display: grid; }
.strip-top { grid-area: top; grid-template-columns: repeat(var(--n), var(--cell)); }
.strip-bottom { grid-area: bottom; grid-template-columns: repeat(var(--n), var(--cell)); }
.strip-left { grid-area: left; grid-template-rows: repeat(var(--n), var(--cell)); }
.strip-right { grid-area: right; grid-template-rows: repeat(var(--n), var(--cell)); }

.board {
  grid-area: board;
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-auto-rows: var(--cell);
  background: var(--night-deep);
  outline: 2px solid var(--night-deep);
}
.board-row { display: contents; }

/* ---------------------------------------------------------------- shops */
.shop {
  --wall: #2a2258;
  --roof: #241c4e;
  --window: #15103a;
  --awn: #352c6c;
  --stripe: #2a2258;
  min-width: 0;
  min-height: 0;
}
.shop svg { display: block; width: 100%; height: 100%; }
.shop .wall { fill: var(--wall); transition: fill .5s; }
.shop .roof { fill: var(--roof); transition: fill .5s; }
.shop .win { fill: var(--window); transition: fill .35s; }
.shop .awning { fill: var(--awn); transition: fill .5s; }
.shop .stripe { fill: var(--stripe); transition: fill .5s; }
.shop .door { fill: var(--night-deep); }
.shop .frame { stroke: var(--night-deep); stroke-width: 1.4; fill: none; }
.shop.lit { --window: var(--saffron); }
.shop.open, .plaza.opened .shop {
  --wall: var(--wall-open);
  --roof: color-mix(in srgb, var(--wall-open) 62%, #150d30);
  --window: #ffe08f;
  --awn: var(--awning-open);
  --stripe: var(--wall-open);
}
.plaza.opened .shop svg, .pano .shop.open svg {
  animation: shop-glow 1.1s calc(var(--wave, 0) * 90ms) both ease-out;
}
@keyframes shop-glow {
  from { filter: brightness(.55); }
  55% { filter: brightness(1.28); }
  to { filter: brightness(1); }
}

/* ---------------------------------------------------------------- cells */
.cell {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button.cell { cursor: pointer; }
button.cell[aria-disabled="true"] { cursor: default; }
button.cell:focus { outline: none; }
button.cell:focus-visible { z-index: 3; }
button.cell:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  border: 3px solid #fff;
  box-shadow: inset 0 0 0 3px #1f49e0;
}
@media (hover: hover) {
  button.walk:hover:not([aria-disabled="true"]) .pave { filter: brightness(1.2); }
}

.pave {
  position: absolute;
  inset: .5px;
  background-color: var(--dusk);
  background-image:
    radial-gradient(circle at 25% 28%, var(--cobble) 0 14%, transparent 15%),
    radial-gradient(circle at 73% 26%, var(--cobble) 0 11%, transparent 12%),
    radial-gradient(circle at 50% 72%, var(--cobble) 0 15%, transparent 16%);
  transition: background-color .28s calc(var(--d, 0) * 42ms);
}
.lit .pave {
  background-color: var(--saffron);
  background-color: color-mix(in srgb, #ffe28f calc(var(--glow, 1) * 100%), var(--amber));
  background-image: none;
}

/* Festoon strings: the light itself is drawn as a line, so it reads without relying on colour. */
.str { position: absolute; opacity: 0; transition: opacity .2s calc(var(--d, 0) * 42ms); background-repeat: no-repeat; background-size: 100% 100%; pointer-events: none; }
.str-h {
  left: 0; right: 0; top: 34%; height: 32%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M0 10Q25 28 50 10T100 10' fill='none' stroke='%23241338' stroke-width='3.5'/%3E%3Ccircle cx='25' cy='25' r='8' fill='%23fff8e0' stroke='%23241338' stroke-width='3'/%3E%3Ccircle cx='75' cy='25' r='8' fill='%23fff8e0' stroke='%23241338' stroke-width='3'/%3E%3C/svg%3E");
}
.str-v {
  top: 0; bottom: 0; left: 34%; width: 32%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 100' preserveAspectRatio='none'%3E%3Cpath d='M10 0Q28 25 10 50T10 100' fill='none' stroke='%23241338' stroke-width='3.5'/%3E%3Ccircle cx='25' cy='25' r='8' fill='%23fff8e0' stroke='%23241338' stroke-width='3'/%3E%3Ccircle cx='25' cy='75' r='8' fill='%23fff8e0' stroke='%23241338' stroke-width='3'/%3E%3C/svg%3E");
}
.has-h .str-h, .has-v .str-v { opacity: 1; }
.bad-h .str-h {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M0 20 17 4 33 36 50 4 67 36 83 4 100 20' fill='none' stroke='%23b40038' stroke-width='7'/%3E%3C/svg%3E");
}
.bad-v .str-v {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 100' preserveAspectRatio='none'%3E%3Cpath d='M20 0 4 17 36 33 4 50 36 67 4 83 20 100' fill='none' stroke='%23b40038' stroke-width='7'/%3E%3C/svg%3E");
}

.lamp, .cross, .flag { position: absolute; display: none; }
.has-lamp .lamp {
  display: block;
  inset: 8% 14%;
  animation: lamp-in .18s ease-out;
}
.lamp svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 5px rgba(255, 240, 180, .9)); }
@keyframes lamp-in { from { transform: scale(.55) translateY(-14%); } to { transform: none; } }
.conflict .lamp svg { filter: none; }
.has-cross .cross {
  display: block;
  inset: 26%;
  color: var(--paper);
}
.has-cross.lit .cross { color: var(--ink); }
.cross svg { display: block; width: 100%; height: 100%; }
.conflict .flag {
  display: grid;
  place-items: center;
  top: 2px; right: 2px;
  width: 38%; height: 38%;
  min-width: 15px; min-height: 15px;
  z-index: 2;
  color: #fff;
  background: var(--alarm);
  border: 1.5px solid #fff;
  border-radius: 50%;
  font: 800 .8rem/1 var(--text);
}

.post { background: var(--awning-dark); }
.post-roof {
  position: absolute;
  inset: .5px;
  background: repeating-linear-gradient(45deg, var(--awning) 0 12%, var(--awning-dark) 12% 24%);
}
.blank .post-roof {
  background: repeating-linear-gradient(45deg, #1a4f58 0 8px, #103943 8px 16px);
  box-shadow: inset 0 0 0 2px var(--night-deep);
}
.post-sign {
  position: absolute;
  inset: 14%;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  transition: background-color .2s, color .2s;
}
.post-num { font: 800 calc(var(--cell, 44px) * .46)/1 var(--display); }
.mini-board .post-num { font-size: .86rem; }
.mini-board .post-sign { inset: 6%; border-width: 1.5px; }
.mini-board .post-state { min-width: 12px; min-height: 12px; width: 12px; height: 12px; font-size: .56rem; right: 0; bottom: 0; }
.mini-board .flag { min-width: 12px; min-height: 12px; width: 12px; height: 12px; font-size: .56rem; top: 0; right: 0; }
.post-state {
  position: absolute;
  right: 1px; bottom: 1px;
  display: grid;
  place-items: center;
  width: 42%; height: 42%;
  min-width: 15px; min-height: 15px;
  font: 800 .78rem/1 var(--text);
  color: var(--ink);
  border-radius: 50%;
}
.post-state:empty { display: none; }
.met .post-sign { background: var(--ok); }
.met .post-state { background: var(--ok); border: 1.5px solid var(--ink); }
.over .post-sign { background: var(--alarm); color: #fff; border-color: #fff; }
.over .post-state { background: #fff; color: var(--alarm); border: 1.5px solid var(--alarm); }

.hinted::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 3px dashed #1f49e0;
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px #fff;
  pointer-events: none;
}

.opened .has-lamp .lamp { animation: lamp-open .9s ease-out; }
@keyframes lamp-open { 40% { transform: scale(1.18); } }

/* ---------------------------------------------------------------- panel */
.panel { width: 100%; max-width: 440px; }
.working { display: grid; gap: 6px; }
.coach {
  min-height: 3.1em;
  padding: 7px 10px;
  background: var(--dusk);
  border-left: 5px solid var(--saffron);
  font-size: .98rem;
  line-height: 1.3;
}
.coach[data-tone="problem"] { border-left-color: #ff7fa3; background: #4a1e4e; }
.coach[data-tone="hint"] { border-left-color: #8fb1ff; background: #243a78; }
.tally { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; color: var(--paper-dim); padding: 0 2px; }
.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--paper-dim);
  border-radius: 3px;
  background: var(--night-deep);
}
.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: 700 .98rem/1.1 var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
.mode-btn + .mode-btn { border-left: 2px solid var(--paper-dim); }
.mode-btn[aria-pressed="true"] {
  background: var(--saffron);
  color: var(--ink);
  box-shadow: inset 0 -5px 0 var(--ink);
}
.mode-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 6px #1f49e0;
}
.mode-icon { display: block; width: 20px; height: 22px; flex: none; }
.mode-icon svg { display: block; width: 100%; height: 100%; }
.tools { display: grid; grid-template-columns: 1.1fr .8fr 1.1fr; gap: 8px; }
.tools .btn { padding: 5px 6px; font-size: .95rem; }
.keys { display: none; font-size: .86rem; color: var(--paper-dim); }
.tap-note { display: none; font-size: .9rem; color: var(--paper-dim); padding: 0 2px; }
@media (min-height: 790px) { .tap-note { display: block; } }
@media (max-width: 719px) and (max-height: 660px) {
  .play { --rim: 22px; --panel-h: 160px; }
  .tally { display: none; }
  .coach { min-height: 2.8em; font-size: .9rem; padding: 4px 8px; }
  .working { gap: 5px; }
  .stage { padding: 4px 6px 6px; gap: 4px; }
}

.done { display: grid; gap: 8px; }
.done h3 { font-size: 1.35rem; color: var(--saffron); }
.done-shops { font-size: .96rem; }
.points { display: grid; gap: 1px; margin: 0; font-size: .92rem; }
.points div { display: flex; justify-content: space-between; gap: 10px; }
.points dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.points-total { border-top: 2px solid var(--paper-dim); padding-top: 3px; font-size: 1.05rem; font-weight: 700; }
.done .btn-main { width: 100%; }

@media (min-width: 720px) and (min-aspect-ratio: 1/1) {
  .play {
    --side: 40px;
    --rim: 58px;
    --cell: clamp(34px,
      min(
        calc((100vw - 390px - 2 * var(--side)) / var(--n)),
        calc((100dvh - var(--bar-h) - 2 * var(--rim) - 28px) / var(--n))
      ),
      78px);
  }
  .bar { padding: 6px 20px; gap: 14px; }
  .bar-title h2 { font-size: 1.3rem; }
  .pips { display: flex; }
  .bar .btn-small { max-width: none; padding: 6px 12px; font-size: .92rem; }
  .stage { flex-direction: row; justify-content: center; align-items: flex-start; gap: 28px; padding: 10px 16px; }
  .panel { width: 320px; flex: none; padding-top: var(--rim); }
  .working { gap: 12px; }
  .coach { font-size: 1.06rem; min-height: 5.4em; }
  .tools { grid-template-columns: 1fr; }
  .keys, .tap-note { display: block; }
}
@media (min-width: 720px) and (min-aspect-ratio: 1/1) and (max-height: 560px) {
  .play { --rim: 24px; --side: 18px; }
  .keys, .tap-note { display: none; }
  .tools { grid-template-columns: 1fr 1fr 1fr; }
  .coach { min-height: 3.2em; font-size: .96rem; }
  .panel { padding-top: 0; }
}

/* ---------------------------------------------------------------- result */
.result {
  min-height: 100dvh;
  background: radial-gradient(90% 40% at 50% 0, rgba(255, 200, 87, .24), transparent 70%), var(--night);
}
.pano {
  display: flex;
  align-items: flex-end;
  height: clamp(58px, 15vw, 150px);
  margin-top: 14px;
  padding: 0 4px;
  border-bottom: 8px solid var(--night-deep);
}
.pano .shop { flex: 1; height: 100%; }
.result-body { display: grid; gap: 12px; justify-items: start; max-width: 640px; margin: 0 auto; padding: 18px 16px 32px; }
.result-body h2 { font-size: clamp(1.7rem, 7vw, 2.6rem); }
.result-score { font: 800 clamp(3rem, 15vw, 5rem)/1 var(--display); color: var(--saffron); }
.result-of { font: 600 1rem var(--text); color: var(--paper-dim); }
.result-rank { font: 700 1.2rem var(--display); }
.result-table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.result-table th, .result-table td { padding: 5px 6px; text-align: right; border-bottom: 1px solid var(--cobble); }
.result-table th:first-child { text-align: left; font-weight: 700; }
.result-table thead th { color: var(--paper-dim); font-weight: 600; }
.result-shops { font-size: .98rem; max-width: 62ch; }
.result-summary { padding: 8px 10px; background: var(--dusk); border-left: 5px solid var(--saffron); width: 100%; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- dialogs */
.dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 18px;
  color: var(--paper);
  background: var(--dusk);
  border: 2px solid var(--paper-dim);
  border-radius: 3px 3px 22px 3px;
}
.dialog-wide { width: min(620px, calc(100vw - 24px)); }
.dialog::backdrop { background: var(--night-deep); }
#rules-dialog::backdrop { background: rgba(19, 14, 48, .97); }
.dialog h2 { font-size: 1.5rem; margin-bottom: 8px; }
.dialog-actions { display: grid; gap: 10px; margin-top: 14px; }
.rule-extra { display: grid; gap: 8px; margin: 14px 0; font-size: .95rem; }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
}
