:root {
  color-scheme: light;
  --wine: #48282d;
  --cream: #fff1d9;
  --paper: #f8efde;
  --surface: #fff8eb;
  --ink: #322722;
  --muted: #6d584c;
  --line: #deccb2;
  --gain: #325a47;
  --loss: #963d35;
  --display: Baskerville, "Iowan Old Style", Georgia, serif;
  background: #eee1ca;
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p, ul, ol, figure, dt, dd, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible {
  outline: 2px solid var(--loss);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px clamp(14px, 2vw, 30px);
  min-height: 58px;
  border-bottom: 1px solid #a67563;
  background: var(--wine);
  color: var(--cream);
}
.masthead-brands { display: flex; align-items: center; gap: 14px; }
.masthead-partner { padding-inline-start: 14px; border-inline-start: 1px solid #aa8278; }
.gbbo-logo, .sail-logo { display: block; width: auto; }
.gbbo-logo { height: clamp(54px, 7vw, 64px); transform: translateY(3px); }
.sail-logo { height: 26px; }
.masthead-brands svg path { fill: currentColor; }
.masthead-link { justify-self: center; color: inherit; font-size: 13px; font-weight: 650; text-decoration-color: #d3a46b; text-underline-offset: 3px; }
.masthead-link:focus-visible { outline: 2px solid #e3b67c; outline-offset: 4px; }
.street-status { display: inline-flex; justify-self: end; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.street-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #e3b67c; }
.street-status[data-status="live"]::before { background: #b8d6a7; }
.street-status[data-status="error"]::before { background: #f19d8e; }

main { min-width: 0; padding: 12px clamp(12px, 1vw, 20px); }
.street {
  --street-radius: 8px;
  --street-inner-radius: calc(var(--street-radius) - 1px);
  overflow: hidden;
  border: 1px solid #cfb79b;
  border-radius: var(--street-radius);
  background: var(--surface);
}
.street-heading, .panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.street-heading { padding: 7px 12px; border-bottom: 1px solid #d4bd9d; background: var(--paper); }
.street-heading h2, .panel-heading h2 { font: 600 21px/1.1 var(--display); }
.street-heading > span, .panel-heading > span { color: var(--muted); font-size: 12px; text-align: right; }
.street-loading { padding: 22px; color: var(--muted); text-align: center; }
.shop-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shop-grid li { min-width: 0; }
.shop-card, .street-workspace {
  --shop-accent: var(--wine);
  --shop-ink: color-mix(in srgb, var(--shop-accent) 55%, #241b17);
  --shop-tint: color-mix(in srgb, var(--shop-accent) 14%, var(--paper));
}
.shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: var(--surface);
  text-align: left;
}
.shop-card::after { content: ""; position: absolute; z-index: 1; inset: 0; border-radius: inherit; pointer-events: none; }
.shop-card[aria-pressed="true"]::after { box-shadow: inset 0 0 0 2px var(--shop-accent); }
.shop-card:focus-visible { z-index: 2; outline-offset: -4px; }
.shop-card:hover .shop-information { background: #f4e6cf; }
.shop-card[aria-pressed="true"] .shop-information { background: var(--shop-tint); }
.shop-card:not([aria-pressed="true"]) .shop-information { box-shadow: inset -1px 0 0 #e4d2b8; }
.shop-art {
  position: relative;
  display: block;
  width: 100%;
  height: 95px;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, #cdb27b 0 15px, transparent 15px 53px) 0 84px / auto 2px repeat-x,
    repeating-linear-gradient(90deg, #a78d70 0 1px, transparent 1px 23px) 0 68px / auto 8px repeat-x,
    linear-gradient(to bottom, #dfc7a3 0 66px, #c4ad8c 66px 75px, #e1caa3 75px 78px, #404145 78px 95px);
}
.shop-art canvas {
  position: absolute;
  bottom: 21px;
  left: 50%;
  width: min(190px, 98%);
  height: auto;
  display: block;
  transform: translateX(-50%);
  image-rendering: pixelated;
}
.shop-information { display: grid; gap: 2px; width: 100%; padding: 8px 10px 9px; flex: 1; }
.shop-identity, .shop-earnings { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; }
.shop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 clamp(14px, 1.7vw, 19px)/1.14 var(--display); }
.shop-rank { flex: 0 0 auto; color: var(--shop-ink); font-weight: 700; font-size: 12px; }
.shop-model { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.shop-total { font: 600 clamp(17px, 2vw, 23px)/1 var(--display); font-variant-numeric: tabular-nums; }
.shop-served { color: var(--muted); font-size: 11px; white-space: nowrap; }
.negative { color: var(--loss); }

.street-workspace { display: grid; gap: 12px; margin-top: 12px; }
.live-bakery {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--shop-ink);
  border-radius: 8px;
  background: color-mix(in srgb, var(--shop-accent) 14%, #252427);
}
.kitchen-message { padding: 20px; color: var(--cream); font-size: 13px; }
#street-kitchen { display: block; width: 100%; height: auto; image-rendering: pixelated; }

.street-stats { min-width: 0; border: 1px solid #cfb79b; border-radius: 8px; background: var(--paper); }
.stats-panel { padding: 12px; border-bottom: 1px solid var(--line); }
.stats-panel:last-child { border-bottom: 0; }
.panel-heading { margin-bottom: 8px; }
.performance-heading { align-items: center; flex-wrap: wrap; }
.day-indicator { display: flex; align-items: center; gap: 6px; color: var(--shop-ink); font-size: 12px; white-space: nowrap; }
.day-indicator strong { min-width: 42px; padding: 2px 5px; border-radius: 3px; background: var(--shop-tint); text-align: center; font-variant-numeric: tabular-nums; }
.scoreboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--line); }
.scoreboard > div { min-width: 0; padding: 6px 8px; background: var(--surface); }
.scoreboard dt { color: var(--muted); font-size: 11px; }
.scoreboard dd { font: 600 19px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.scoreboard .score-feature { grid-column: 1 / -1; padding-block: 7px; background: var(--shop-ink); color: var(--cream); }
.score-feature dt { color: inherit; }
.score-feature dd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 30px; }
.score-rank { font: 600 12px/1.3 system-ui, -apple-system, sans-serif; white-space: nowrap; }
.score-feature .negative { color: #f2a596; }
.profit-chart { margin-top: 10px; }
.profit-chart + .profit-chart { margin-top: 14px; }
.profit-chart figcaption { font-weight: 650; font-size: 12px; }
.profit-chart-plot { position: relative; min-width: 0; height: 125px; }
.profit-chart-values:not(.visually-hidden) { max-height: 125px; overflow: auto; color: var(--muted); font-size: 11px; }
.chart-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 10px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.chart-legend li { display: flex; align-items: center; gap: 5px; }
.chart-legend li.is-selected { color: var(--ink); font-weight: 700; }
.chart-legend li::before { content: ""; flex: 0 0 10px; height: 3px; border-radius: 2px; background: var(--shop-accent); }
.chart-history-note { margin-top: 5px; color: var(--muted); font-size: 11px; }
.decision-filter { position: relative; display: inline-block; margin-bottom: 4px; color: var(--shop-ink); }
.decision-filter select {
  appearance: none;
  display: block;
  min-height: 30px;
  padding-block: 3px;
  padding-inline: 10px 29px;
  border: 1px solid #bea084;
  border-radius: 4px;
  background: var(--surface);
  font-size: 12px;
}
.decision-filter::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-end: 13px;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
@media (forced-colors: active) {
  .decision-filter select { appearance: auto; padding-inline-end: 6px; }
  .decision-filter::after { display: none; }
}
.decisions li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; overflow-wrap: anywhere; }
.decisions li:first-child { border-top: 0; }
.decision-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.decision-title span, .decision-reason, .decision-provider, .empty-decisions, .source-note { color: var(--muted); font-size: 11px; }
.decision-title span { flex: 0 0 auto; }
.decision-result, .decision-reason, .decision-provider, .decision-notice { margin-top: 2px; }
.decision-notice { color: var(--loss); }
.source-note { padding: 8px 12px; }
.source-note a, a.source-note { color: var(--wine); }

@media (min-width: 801px) {
  body { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; min-height: 620px; }
  main { display: flex; flex-direction: column; }
  .street { flex: none; }
  .street-workspace { flex: 1; min-height: 0; grid-template: minmax(0, 1fr) / minmax(0, 1fr) clamp(290px, 24vw, 480px); }
  #street-kitchen { height: 100%; object-fit: contain; }
  .street-stats { overflow: auto; scrollbar-width: thin; scrollbar-gutter: stable; }
}
@media (width > 630px) {
  .shop-grid > li:nth-child(4n + 1):nth-last-child(-n + 4) { border-end-start-radius: var(--street-inner-radius); }
  .shop-grid > li:nth-child(4n):last-child { border-end-end-radius: var(--street-inner-radius); }
}
@media (max-width: 630px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-grid li:nth-child(n + 3) { border-top: 1px solid #d5bf9d; }
  .shop-grid > li:nth-child(odd):nth-last-child(-n + 2) { border-end-start-radius: var(--street-inner-radius); }
  .shop-grid > li:nth-child(even):last-child { border-end-end-radius: var(--street-inner-radius); }
  .shop-card .shop-name { font-size: 17px; }
  .shop-card .shop-total { font-size: 21px; }
}
@media (max-width: 530px) {
  .masthead { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .masthead-link { grid-area: 2 / 1 / 3 / -1; }
  .masthead .street-status { grid-area: 1 / 2; }
}
@media (max-width: 405px) {
  .street-heading > span { font-size: 11px; }
}
