:root {
  --page: #f2eadc;
  --ink: #333;
  --red: #e2231a;
  --red-dark: #c41710;
  --ocean: #1f7eab;
  --ocean-deep: #165f86;
  --sans: Arial, Helvetica, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
}

body { overflow: auto; }

.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto 1fr;
  column-gap: 18px;
  padding: 0 14px 12px;
}

.bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -14px 6px;
  padding: 8px 14px 7px;
}

.brand {
  display: block;
  line-height: 0;
  text-decoration: none;
}

.brand img {
  display: block;
  height: 68px;
  width: auto;
}

.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-links a {
  display: inline-block;
  padding: 5px 9px;
  border: 1px solid #b50e12;
  border-radius: 2px;
  background: var(--red);
  color: #fff;
  font: bold 12px/1.2 var(--sans);
  text-decoration: none;
}

.site-links a:hover { background: var(--red-dark); color: #fff; }

.count {
  margin: 0 0 0 auto;
  color: #777;
  font-size: 12px;
}

.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.offer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 2px 0 8px;
}

.tools {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.tools button {
  border: 1px solid #6d431c;
  border-radius: 2px;
  padding: 5px 9px;
  background: #8d5a2b;
  color: #fff;
  font: bold 12px/1.2 var(--sans);
  cursor: pointer;
}

.tools button:hover { background: #73481f; }

.offer-price {
  margin: 0;
  color: #a34b12;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
}

.offer-note {
  margin: 0;
  color: #444;
  font-size: 13px;
}

#offer-left {
  font-weight: 700;
  color: #222;
}

#offer-next {
  color: var(--red);
  font-weight: 700;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--ocean-deep);
  border: 1px solid #cfc6b8;
  cursor: grab;
  touch-action: none;
  outline: none;
}

.viewport.dragging { cursor: grabbing; }

.world {
  position: absolute;
  left: 0;
  top: 0;
  background-color: var(--ocean);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  transform-origin: 0 0;
  will-change: transform;
}

.land {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background-color: #efe8da;
}

.rounds {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.land::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(63, 52, 43, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(63, 52, 43, 0.28) 1px, transparent 1px);
  background-size: 100px 100px;
}

.plot {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  background: #2f2f2f;
  color: #fff;
  cursor: pointer;
}

.plot.no-image {
  background: #fffdf8;
  color: #333;
}

.plot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.plot::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(63, 52, 43, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(63, 52, 43, 0.45) 1px, transparent 1px);
  background-size: var(--tile) var(--tile);
  pointer-events: none;
}

.name {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 4px;
  text-align: center;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.15;
  z-index: 1;
  pointer-events: none;
}

.plot.selected,
.marker {
  outline: 3px solid var(--red);
  outline-offset: -3px;
  z-index: 2;
}

.marker {
  position: absolute;
  pointer-events: none;
  background: rgba(226, 35, 26, 0.16);
}

.picks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  z-index: 2;
}

.buy,
.copy {
  display: inline-block;
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 2px;
  color: #fff;
  font: bold 13px/1.2 var(--sans);
  cursor: pointer;
}

.buy {
  border: 1px solid #b50e12;
  background: var(--red);
}

.buy:hover { background: var(--red-dark); }

.copy {
  border: 1px solid #6d431c;
  background: #8d5a2b;
}

.copy:hover { background: #73481f; }

.numbers {
  margin: 4px 0;
  padding: 8px;
  background: #f6f1e8;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.panel {
  padding-top: 6px;
  overflow: auto;
}

.panel-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: #3a332c;
}

.hint {
  margin: 0 0 12px;
  color: #666;
  font-size: 12px;
  line-height: 1.4;
}

.hint code {
  font-family: Consolas, monospace;
  font-size: 12px;
}

#detail h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
  color: #222;
}

#detail a { color: var(--red); }

#detail p {
  margin: 4px 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.35;
}

#detail .meta {
  font-family: var(--sans);
  font-size: 12px;
  color: #888;
}

.foot {
  padding: 16px 18px 20px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
}

.foot a { color: #fff; }

.foot-cols {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 200px) minmax(0, 240px);
  gap: 8px 36px;
  margin: 14px 0 12px;
}

.foot h2 {
  margin: 0 0 6px;
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
}

.foot h2 a { color: #fff; text-decoration: none; }

.foot h2 a:hover { text-decoration: underline; }

.foot p { margin: 8px 0; }

.foot-cols ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.foot-cols li { margin: 2px 0; }

.foot-cols a { text-decoration: underline; }

.foot-mail p { margin: 0 0 12px; }

.foot-mail a {
  display: inline-block;
  font-size: 18px;
  line-height: 1.25;
  text-decoration: underline;
}

.foot-mail span { display: block; margin-top: 2px; }

@media (max-width: 640px) {
  .foot-cols { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 800px) {
  body { overflow: auto; }
  .shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding-bottom: 0;
  }
  .bar { flex-wrap: wrap; }
  .stage { min-height: 0; }
  .viewport { min-height: 0; }
  .panel {
    margin: 0 0 calc(18px + env(safe-area-inset-bottom));
    padding: 14px 14px 16px;
    background: #fff;
    border: 1px solid #e3d9c8;
    border-radius: 2px;
    box-shadow: 0 8px 22px rgba(58, 51, 44, 0.16);
    max-height: 46vh;
    overflow: auto;
  }
  .panel-title,
  .hint { display: none; }
  #detail h2 {
    margin-bottom: 4px;
    font-size: 24px;
  }
  #detail p { margin: 3px 0; }
  .panel .buy,
  .panel .copy {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px 16px;
    font-size: 16px;
    text-align: center;
  }
}
