* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #1d2430;
  color: #e8ecf2;
}

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 16px;
  background: #151b25;
  border-bottom: 1px solid #2c3647;
}

header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* The "." in Coinography.NET, drawn as a larger orange dot centred on the
   capital letters. The real "." stays in the text for copy/paste and screen
   readers; overflow: hidden puts the box's baseline at its bottom edge. */
header h1 .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px 0 3px;
  border-radius: 50%;
  background: #ffb547;
  font-size: 0;
  overflow: hidden;
  vertical-align: 3px;
}

#year-label {
  font-size: 22px;
  font-weight: 700;
  color: #ffd27a;
  font-variant-numeric: tabular-nums;
}

#status {
  margin-left: auto;
  font-size: 13px;
  color: #93a1b5;
}

#powered {
  padding-left: 16px;
  border-left: 1px solid #2c3647;
  font-size: 13px;
  color: #93a1b5;
  text-decoration: none;
  white-space: nowrap;
}

#powered b { color: #ffb547; font-weight: 600; }
#powered:hover { color: #e8ecf2; }
#powered:hover b { text-decoration: underline; }

#map {
  flex: 1;
  min-height: 0;
  background: #aad3df;
}

#coins {
  display: flex;
  background: #151b25;
  border-top: 1px solid #2c3647;
  padding: 8px 0 6px;
}

.coins-main {
  flex: 1;
  min-width: 0;
}

/* Years that have coins for the pinned territory; click to jump there. */
#coin-years {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  padding: 0 12px;
  border-left: 1px solid #2c3647;
}

#years-head {
  padding-bottom: 6px;
  font-size: 13px;
  color: #93a1b5;
  white-space: nowrap;
}

#years-list {
  position: relative;
  height: 170px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #36435a transparent;
}

#years-list .hint {
  font-size: 12px;
  color: #7f8da3;
}

.year-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  background: none;
  color: #e8ecf2;
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
}

.year-row:hover { background: #222b3a; }
.year-row.active { background: #ffb547; color: #151b25; font-weight: 600; }
.year-row:disabled { color: #5d6a7e; cursor: default; background: none; }

.year-bar {
  height: 6px;
  border-radius: 3px;
  background: #36435a;
}

.year-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: #ffb547;
}

.year-row.active .year-bar { background: rgba(21, 27, 37, 0.25); }
.year-row.active .year-bar i { background: #151b25; }

.years-short { display: none; }

@media (max-width: 640px) {
  /* Narrow panel on phones so the coin strip gets the room. */
  #coin-years { flex: 0 0 96px; min-width: 0; padding: 0 6px; }
  #years-head { overflow: hidden; text-overflow: ellipsis; }
  .years-full { display: none; }
  .years-short { display: inline; }
  .year-row { grid-template-columns: 36px 1fr; gap: 6px; padding: 2px 4px; }
}

#coins-head {
  padding: 0 16px 6px;
  font-size: 13px;
  color: #93a1b5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#coins-head b { color: #e8ecf2; }

#coins-list {
  display: flex;
  gap: 10px;
  height: 170px;
  padding: 0 16px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #36435a transparent;
}

#coins-list .hint {
  align-self: center;
  margin: 0 auto;
  font-size: 13px;
  color: #7f8da3;
  text-align: center;
}

.coin {
  flex: 0 0 120px;
  height: 164px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border: 1px solid #2c3647;
  border-radius: 8px;
  background: #1d2430;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
}

.coin:hover { border-color: #ffb547; background: #222b3a; }

.coin img,
.coin .placeholder {
  flex: none;
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.coin .placeholder {
  background: #222b3a;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.5; } }

.coin-title {
  flex: none;
  margin-top: 4px;
  width: 100%;
  font-size: 11px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.coin-site {
  width: 100%;
  font-size: 10px;
  color: #7f8da3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#timeline {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 26px;
  background: #151b25;
  border-top: 1px solid #2c3647;
}

.controls {
  display: flex;
  gap: 6px;
}

.controls button {
  width: 40px;
  height: 34px;
  border: 1px solid #36435a;
  border-radius: 6px;
  background: #222b3a;
  color: #e8ecf2;
  font-size: 13px;
  cursor: pointer;
}

.controls button:hover { background: #2d384b; }

.controls button {
  display: grid;
  place-items: center;
}

.controls svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}


.slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

#slider {
  width: 100%;
  margin: 0;
  accent-color: #ffb547;
  cursor: pointer;
}

#ticks {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 24px;
  height: 14px;
  pointer-events: none;
}

#ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  color: #7f8da3;
  white-space: nowrap;
}

/* Pin info box; app.js moves it inside the map container. */
#info {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  max-width: 280px;
  padding: 8px 8px 10px 12px;
  border-radius: 8px;
  background: rgba(21, 27, 37, 0.92);
  border: 1px solid #36435a;
  color: #e8ecf2;
  font-size: 13px;
  line-height: 1.45;
  cursor: default;
}

#info .info-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

#info h3 { flex: 1; margin: 2px 0 4px; font-size: 15px; }
#info .muted { color: #93a1b5; }

#info button {
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid #36435a;
  border-radius: 6px;
  background: #222b3a;
  color: #e8ecf2;
  font-size: 12px;
  cursor: pointer;
}
#info button:hover { background: #2d384b; }

#map { cursor: crosshair; }

/* "Pin my location" button, styled like the Leaflet zoom buttons. */
.locate-control a {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.locate-control svg {
  width: 18px;
  height: 18px;
  fill: #333;
  stroke: #333;
}

.locate-control a.busy svg {
  fill: #ffb547;
  stroke: #ffb547;
  animation: pulse 1s ease-in-out infinite;
}

.map-toast {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 1000;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(21, 27, 37, 0.92);
  border: 1px solid #36435a;
  color: #e8ecf2;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.leaflet-tooltip.country-tip {
  background: rgba(21, 27, 37, 0.9);
  color: #fff;
  border: none;
  font-weight: 600;
}
.leaflet-tooltip.country-tip::before { display: none; }

/* Arrows: holding them repeats, so stop touch screens from scrolling,
   selecting text or opening the long-press menu instead. */
.controls button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (max-width: 640px) {
  /* Two header lines: title + year, then borders status + Powered by.
     The ::before is a zero-height, full-width flex item that forces the wrap. */
  header { flex-wrap: wrap; column-gap: 12px; row-gap: 2px; padding: 8px 12px; }
  header::before { content: ''; order: 2; flex-basis: 100%; height: 0; }
  header h1 { font-size: 17px; }
  #year-label { font-size: 20px; }
  #status { order: 3; margin-left: 0; font-size: 12px; }
  #status .status-count { display: none; }
  #powered { order: 4; margin-left: auto; padding-left: 0; border-left: none; font-size: 12px; }

  #timeline { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 16px 24px; }
  .controls { justify-content: center; gap: 12px; }
  .controls button { width: 64px; height: 44px; }
  .controls svg { width: 16px; height: 16px; }

  .year-row { min-height: 40px; font-size: 14px; }

  /* Compact pin box: right of the zoom buttons, details hidden. */
  #info { left: 54px; max-width: none; padding: 6px 6px 8px 10px; }
  #info .detail { display: none; }
  #info button { width: 32px; height: 32px; }
}

@media (max-width: 760px) {
  #ticks .minor { display: none; }
}
