/* Lot Order: a plain valuation sheet, in the shared report style of
   gamesyoucanplayatwork.com. The first block mirrors costofliving/style.css
   so the page stands alone; when it lives in the site it can link that
   stylesheet instead and keep only the "board" section below. */
:root {
  --bg: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #666660;
  --rule: #D9D9D4;
  --rule-strong: #1A1A1A;
  --band: #F4F4F1;
  --accent: #1B3A6B;
  --good: #1F7A3E;
  --good-bg: #E8F3EB;
  --near-bg: #FBF3DC;
  --bad: #A8321E;
  --bad-bg: #F7E9E5;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --col: 600px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* ---------- masthead ---------- */
.masthead {
  max-width: var(--col);
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--rule-strong);
  padding-bottom: 10px;
}
.wordmark { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 18px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  font: 500 14px var(--sans);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  border-radius: 3px;
}
.nav-link:hover { color: var(--ink); background: var(--band); }
.nav-link[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-link:focus-visible, .btn:focus-visible, select:focus-visible, summary:focus-visible, .lot:focus-visible, .keys button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- report ---------- */
.report { max-width: var(--col); margin: 0 auto; padding: 22px 16px 60px; }
.report-head { margin-bottom: 18px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 2px; line-height: 1.25; }
.report-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13.5px; }
.report-question { margin: 12px 0 0; font-size: 15px; }

.btn {
  font: 500 14.5px var(--sans);
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 8px 16px;
  cursor: pointer;
}
.btn:hover { background: #142D54; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: var(--band); }
.btn.copied { background: var(--good); border-color: var(--good); }
.btn:disabled { opacity: 0.5; cursor: default; }

.end-panel { margin-top: 22px; padding-top: 16px; border-top: 2px solid var(--rule-strong); }
.end-panel[hidden] { display: none; }
.end-panel h2 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.end-panel .sub { color: var(--muted); font-size: 13.5px; margin: 2px 0 12px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.next-in { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.tiles { font-size: 20px; letter-spacing: 2px; margin: 0 0 12px; line-height: 1; }

.foot-note { color: var(--muted); font-size: 12.5px; margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 10px; }

/* ---------- dialogs ---------- */
.dialog { border: 1px solid var(--rule-strong); border-radius: 4px; padding: 0; max-width: 440px; width: calc(100% - 32px); background: #fff; color: var(--ink); }
.dialog::backdrop { background: rgba(0,0,0,0.35); }
.dialog-body { padding: 22px 22px 18px; margin: 0; font-size: 14.5px; line-height: 1.5; }
.dialog-body h2 { margin: 0 0 10px; font-size: 18px; }
.dialog-body p { margin: 0 0 10px; }
.dialog-body ul { margin: 0 0 10px; padding-left: 20px; }
.dialog-body li { margin-bottom: 4px; }
.dialog-fine { color: var(--muted); font-size: 13px; }
.dialog-body .btn { margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-grid .n { font-size: 22px; font-weight: 600; display: block; }
.stat-grid .l { font-size: 12px; color: var(--muted); }
.dist-row { display: grid; grid-template-columns: 1.4em 1fr; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 13px; }
.dist-bar { background: var(--rule); color: var(--ink); padding: 1px 6px; min-width: 1.6em; text-align: right; font-weight: 500; }
.dist-bar.today { background: var(--accent); color: #fff; }
.dist-label { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; }

/* ================= board ================= */
/* A numbered rail on the left and the five lots beside it. While playing the
   lots are absolutely positioned and slide with transforms so they can be
   dragged; after locking in they settle into two plain columns. */
.board {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0 10px;
  align-items: start;
  border-top: 1px solid var(--rule-strong);
  padding-top: 8px;
}
#rail {
  list-style: none;
  margin: 0;
  padding: 0;
  --slot: 86px;
  --gap: 8px;
}
#rail li {
  height: calc(var(--slot) - var(--gap));
  margin-bottom: var(--gap);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding-right: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  border-right: 1px solid var(--rule);
}
#rail li small { font-size: 10.5px; font-weight: 400; line-height: 1.1; text-align: right; }

#list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}
#truth { list-style: none; margin: 0; padding: 0; }
#truth[hidden], .col-head[hidden] { display: none; }

.lot {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 8px 6px 8px 8px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 160ms, border-color 160ms;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.lot:hover { border-color: #B9B9B3; }
.lot.dragging {
  cursor: grabbing;
  z-index: 5;
  border-color: var(--rule-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  transition: box-shadow 160ms;
}
.thumb {
  width: 56px; height: 56px;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--band);
  display: block;
  pointer-events: none;
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
  font-weight: 600;
}
.lot-body { min-width: 0; }
.name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.spec { font-size: 13px; color: var(--ink); opacity: 0.85; margin-top: 2px; line-height: 1.35; }
.basis { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.keys { display: flex; flex-direction: column; gap: 2px; }
.keys button {
  width: 30px; height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 3px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.keys button:hover:not(:disabled) { background: var(--band); color: var(--ink); }
.keys button:disabled { opacity: 0.25; cursor: default; }

.submit-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.submit-row[hidden] { display: none; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- revealed: your order beside the correct order ---------- */
.col-head {
  grid-row: 1;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding-bottom: 6px;
}
.col-head-you { grid-column: 2; }
.col-head-truth { grid-column: 3; }
.revealed .board { grid-template-columns: 26px 1fr 1fr; gap: 0 10px; }
.revealed #rail { grid-row: 2; grid-column: 1; --slot: 72px; }
.revealed #rail li { font-size: 14px; padding-right: 6px; }
.revealed #rail li small { display: none; }
.revealed #list, .revealed #truth { grid-row: 2; height: auto !important; display: flex; flex-direction: column; }
.revealed #list { grid-column: 2; }
.revealed #truth { grid-column: 3; }
.revealed .lot {
  position: static;
  transform: none !important;
  transition: none;
  height: 64px;
  min-height: 0;
  margin-bottom: 8px;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  padding: 6px 8px;
  cursor: default;
  touch-action: auto;
}
.revealed .thumb { width: 40px; height: 40px; }
.revealed .spec, .revealed .basis, .revealed .keys { display: none; }
.revealed .name {
  font-size: 13px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.verdict { display: none; font-size: 11.5px; margin-top: 2px; white-space: nowrap; font-weight: 500; }
.revealed .verdict { display: block; }
.lot.hit { background: var(--good-bg); border-color: #BFDCC7; }
.lot.hit .verdict { color: var(--good); }
.lot.near { background: var(--near-bg); border-color: #E8D8A8; }
.lot.near .verdict { color: #7A5B12; }
.lot.miss { background: var(--bad-bg); border-color: #E6C5BC; }
.lot.miss .verdict { color: var(--bad); }
.lot.truth { background: #fff; animation: rise 400ms ease-out; }
.lot.truth.hit { border-color: #BFDCC7; }
.amount { font-weight: 600; font-size: 14px; margin-top: 2px; white-space: nowrap; }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }

/* ---------- dev menu (localhost only) ---------- */
#dev {
  margin-top: 28px;
  padding: 10px 12px;
  border: 1px dashed var(--rule);
  border-radius: 3px;
  font-size: 13px;
}
#dev[hidden] { display: none; }
#dev summary { cursor: pointer; color: var(--muted); font-weight: 500; }
#dev label { display: block; margin: 10px 0 8px; color: var(--muted); }
#dev select {
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  font: 400 13.5px var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.dev-row, .dev-cats { display: flex; flex-wrap: wrap; gap: 6px; }
#dev .btn { padding: 5px 10px; font-size: 13px; }
.dev-note { margin: 12px 0 6px; color: var(--muted); }

@media (max-width: 520px) {
  body { font-size: 14px; }
  .lot { grid-template-columns: 48px 1fr auto; gap: 10px; min-height: 74px; }
  .thumb { width: 48px; height: 48px; }
  .name { font-size: 14px; }
  .spec { font-size: 12.5px; }
  .revealed .lot { grid-template-columns: 1fr; height: 72px; }
  .revealed .thumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lot { transition: none; }
  .lot.truth { animation: none; }
}
