/* City map page (shares tokens and components with editor.css). */

#map {
  position: fixed;
  inset: 0;
  /* Exactly the visible viewport; 100vh is taller than it on phones. */
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#map.panning { cursor: grabbing; }

a.button {
  color: var(--text);
  text-decoration: none;
  background: rgba(236, 230, 214, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 5px 10px;
  white-space: nowrap;
}
a.button:hover { background: rgba(236, 230, 214, 0.1); }
a.button.primary { background: var(--bone); color: #141412; border-color: var(--bone); font-weight: 600; }

.search input {
  width: 240px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 5px 9px;
}
.search input:focus { outline: 1px solid var(--amber); }

#legend {
  left: 10px;
  bottom: 14px;
  padding: 10px 12px;
  min-width: 200px;
}
#legend .row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 3px 0;
}
#legend .row span:last-child { margin-left: auto; font-family: var(--mono); color: var(--bone); }
#legend .note { margin-top: 8px; }
.swatch {
  width: 22px;
  height: 7px;
  border-radius: 1px;
  flex: none;
}
.swatch.free { border: 1px dashed rgba(236, 230, 214, 0.8); }
.swatch.auction { border: 1px dashed rgba(224, 154, 74, 0.9); }
.swatch.awarded {
  border: 1px solid rgba(236, 230, 214, 0.85);
  background:
    linear-gradient(rgba(236, 230, 214, 0.9), rgba(236, 230, 214, 0.9)) left top / 3px 3px no-repeat,
    linear-gradient(rgba(236, 230, 214, 0.9), rgba(236, 230, 214, 0.9)) right top / 3px 3px no-repeat,
    linear-gradient(rgba(236, 230, 214, 0.9), rgba(236, 230, 214, 0.9)) left bottom / 3px 3px no-repeat,
    linear-gradient(rgba(236, 230, 214, 0.9), rgba(236, 230, 214, 0.9)) right bottom / 3px 3px no-repeat;
}
.swatch.construction {
  background: repeating-linear-gradient(45deg, rgba(224, 154, 74, 0.6) 0 2px, #0a0a09 2px 5px);
}
.swatch.open { background: #050505; box-shadow: 0 0 0 1px rgba(236, 230, 214, 0.35); }
.swatch.closed { background: #1a1a18; box-shadow: 0 0 0 1px rgba(224, 88, 58, 0.6); }

#site-panel {
  right: 10px;
  top: 64px;
  width: 310px;
  padding: 14px 16px 16px;
  max-height: calc(100vh - 80px);
  overflow: auto;
}
#site-panel h2 {
  margin: 0 24px 2px 0;
  font-size: 18px;
  color: var(--bone);
  letter-spacing: 0.02em;
}
#site-panel .sub { color: var(--muted); margin-bottom: 12px; }
#site-panel .status-line { margin: 10px 0 12px; }
#site-panel .actions { display: flex; gap: 8px; margin-top: 14px; }
#site-panel .actions a { flex: 1; text-align: center; }
button.close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

/* Phones: compact top bar, site panel as a bottom sheet. */
@media (max-width: 800px) {
  body.map-page #topbar { gap: 8px; padding: 6px 8px; flex-wrap: nowrap; }
  body.map-page .brand span { display: none; }
  .search input { width: 140px; }
  #legend { display: none; }
  #site-panel {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 55vh;
  }
  body.map-page a.button[href="workshop.html"] { display: none; }
}

/* ---- economy ---- */
h3.yours { margin-top: 14px; }
.yours-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.yours-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-left: 2px solid var(--amber);
  margin-bottom: 3px;
  cursor: pointer;
  font-size: 12px;
}
.yours-list li:hover { background: rgba(224, 154, 74, 0.08); }
.yours-list li small { color: var(--muted); white-space: nowrap; }
.bid-form, .toll-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.bid-form label, .toll-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.bid-form input, .toll-form input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 6px 8px;
  font-family: var(--mono);
}
.bid-form input:focus, .toll-form input:focus { outline: 1px solid var(--amber); }
.ok-text { color: var(--ok); }
.bad-text { color: var(--danger); }
details.specs { margin-top: 14px; border-top: 1px solid var(--panel-border); padding-top: 8px; }
details.specs summary { cursor: pointer; color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }

/* ---- market ---- */
#market-panel {
  left: 10px;
  top: 64px;
  width: 320px;
  max-height: calc(100vh - 300px);
  overflow: auto;
  padding: 12px 14px;
}
.market-list { list-style: none; margin: 0; padding: 0; }
.market-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 7px 8px;
  margin-bottom: 4px;
  border-left: 2px solid var(--panel-border);
  cursor: pointer;
}
.market-list li.mine { border-left-color: var(--amber); }
.market-list li:hover { background: rgba(236, 230, 214, 0.06); }
.market-list li b { color: var(--bone); font-weight: 600; }
.market-list li .price { font-family: var(--mono); color: var(--bone); text-align: right; }
.market-list li small { color: var(--muted); grid-column: 1 / -1; }
.sell-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.sell-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.sell-form input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 6px 8px;
  font-family: var(--mono);
}
.sell-form input:focus { outline: 1px solid var(--amber); }
.for-sale { color: var(--amber); }
@media (max-width: 800px) {
  #market-panel { left: 8px; right: 8px; width: auto; max-height: 55vh; top: 58px; }
}

/* ---- start screen ---- */
.brand-btn {
  display: flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bone);
  cursor: pointer;
}
.brand-btn:hover { background: none; color: #fff; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(196, 98, 45, 0.16), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(8, 8, 7, 0.55), rgba(8, 8, 7, 0.92) 70%);
  backdrop-filter: blur(3px) grayscale(0.3);
  -webkit-backdrop-filter: blur(3px) grayscale(0.3);
  transition: opacity 0.5s ease;
}
.intro.leaving { opacity: 0; pointer-events: none; }
.intro-inner { max-width: 760px; width: 100%; text-align: center; }
.intro-logo { margin: 0; }
.intro-logo img {
  width: min(300px, 68vw);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 30px rgba(0, 0, 0, 0.6));
  animation: intro-rise 1.4s ease-out both;
}
.intro-tagline {
  max-width: 540px;
  margin: 6px auto 26px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  animation: intro-rise 1.4s 0.2s ease-out both;
}
.intro-tagline b { color: var(--amber); font-weight: 600; }
.intro-steps {
  list-style: none;
  margin: 0 auto 18px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
  animation: intro-rise 1.4s 0.4s ease-out both;
}
.intro-steps li {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(12, 12, 11, 0.6);
  counter-increment: step;
}
.intro-steps svg { width: 30px; height: 30px; flex: none; color: var(--amber); margin-top: 2px; }
.intro-steps b {
  display: block;
  color: var(--bone);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.intro-steps b::before { content: counter(step) " · "; color: var(--muted); }
.intro-steps span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.intro-note { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; animation: intro-rise 1.4s 0.55s ease-out both; }
.intro-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  animation: intro-rise 1.4s 0.65s ease-out both;
}
.intro-actions button, .intro-actions a { padding: 9px 18px; font-size: 14px; }
@keyframes intro-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .intro-logo img, .intro-tagline, .intro-steps, .intro-note, .intro-actions { animation: none; }
}
@media (max-width: 640px) {
  .intro { place-items: start center; }
  .intro-steps { grid-template-columns: 1fr; }
  .intro-tagline { font-size: 15px; }
}

/* ---- bridge silhouettes ---- */
canvas.silhouette {
  display: block;
  width: 100%;
  height: 130px;
  margin: 10px 0 4px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  cursor: zoom-in;
  background: #1a1a18;
}
.silhouette-dialog { width: min(960px, calc(100vw - 32px)); }
.silhouette-dialog canvas { display: block; width: 100%; height: min(52vh, 420px); border-radius: 6px; margin: 6px 0 8px; }
.intro-colophon { margin: 26px 0 0; font-size: 11px; color: var(--muted); opacity: 0.7; animation: intro-rise 1.4s 0.7s ease-out both; }
@media (prefers-reduced-motion: reduce) { .intro-colophon { animation: none; } }
