:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #66625c;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --line: #d9d4ca;
  --accent: #0c7c68;
  --accent-dark: #075b4b;
  --warm: #d88a2d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(12, 124, 104, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(216, 138, 45, 0.16), transparent 38%),
    var(--paper);
}

button {
  font: inherit;
}

.smoke-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.hero {
  width: min(1000px, 100%);
}

.title-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
}

h1 {
  flex: 1 1 auto;
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 6.2rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.intro {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.subtitle-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 18px;
}

.counter-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
}

.visit-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(7, 91, 75, 0.2);
  cursor: pointer;
}

.visit-counter:focus-visible {
  outline: 3px solid rgba(216, 138, 45, 0.55);
  outline-offset: 3px;
}

.counter-label {
  font-size: 0.62rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.digit-reel {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 2.6ch;
  height: 23px;
  overflow: hidden;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 800;
}

.digit-reel.revolving {
  animation: reelSnap 680ms cubic-bezier(0.2, 0.72, 0.22, 1);
}

@keyframes reelSnap {
  0% {
    transform: translateY(85%);
    opacity: 0.22;
    filter: blur(3px);
  }
  58% {
    transform: translateY(-14%);
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: translateY(0);
  }
}

.rollout {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  width: min(310px, calc(100vw - 36px));
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(21, 21, 21, 0.14);
  transform-origin: top right;
  animation: rollOpen 180ms ease-out;
}

@keyframes rollOpen {
  from {
    opacity: 0;
    transform: translateY(-6px) scaleY(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.rollout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  margin-bottom: 10px;
}

.rollout-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.refresh-counter {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.refresh-counter:hover,
.refresh-counter:focus-visible {
  background: rgba(12, 124, 104, 0.09);
  border-color: rgba(12, 124, 104, 0.2);
}

.refresh-counter:focus-visible {
  outline: 2px solid rgba(216, 138, 45, 0.55);
  outline-offset: 2px;
}

.refresh-counter svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-counter.is-refreshing svg {
  animation: refreshSpin 700ms linear infinite;
}

@keyframes refreshSpin {
  to {
    transform: rotate(360deg);
  }
}

.country-list {
  display: grid;
  gap: 8px;
}

.country-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.country-row:first-child {
  border-top: 0;
}

.country-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.country-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4ch;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

@media (max-width: 620px) {
  .title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .subtitle-row {
    margin-top: 12px;
  }

  .counter-wrap {
    align-self: flex-end;
  }
}
