/* Play: Metro Minsk */

.play-head { padding-top: 86px; padding-bottom: 8px; max-width: calc(1040px + var(--gutter) * 2); }
@media (min-width: 900px) { .play-head { padding-top: 104px; padding-bottom: 8px; } }
.play-head h1 { margin-top: 10px; font-size: clamp(36px, 10vw, 72px); }
.play-head .lede { margin-top: 10px; font-size: 16px; color: var(--ink-2); max-width: 640px; }
@media (min-width: 900px) { .play-head .lede { font-size: 18px; } }

.game { display: grid; gap: 12px; margin-top: 14px; max-width: calc(1040px + var(--gutter) * 2); }
.hud {
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  gap: 8px;
}
.hud-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--card-line);
  min-width: 0;
}
.hud-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.hud-value { font-family: var(--font-head); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-item.low .hud-value { color: #ff7a7a; }
.hud-next { justify-content: space-between; }
.hud-next .hud-value { color: var(--link); }
@media (max-width: 560px) {
  .hud { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .hud-item { flex-direction: column; gap: 0; padding: 7px 12px; }
  .hud-next { grid-column: 1 / -1; }
}

.screen {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: #070b1c;
  box-shadow: 0 0 0 1px rgb(61 224 255 / 0.16), 0 30px 70px -30px rgb(0 0 0 / 0.6);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.game-canvas { width: 100%; aspect-ratio: 4 / 3; cursor: pointer; }
@media (min-width: 720px) { .game-canvas { aspect-ratio: 2.3 / 1; } }
/* the overlay text needs the height on the smallest phones */
@media (max-width: 359px) { .game-canvas { aspect-ratio: 1 / 1; } }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(80% 80% at 50% 50%, rgb(7 11 28 / 0.78), rgb(7 11 28 / 0.9));
}
.overlay[hidden] { display: none; }
.overlay-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  max-width: 420px;
  color: #eef1fb;
}
.overlay-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.overlay-title { font-size: clamp(24px, 6.4vw, 40px); color: #ffffff; }
.overlay-text { color: #c3cbe8; font-size: 15.5px; line-height: 1.5; }
.overlay .btn { margin-top: 6px; }
@media (max-width: 719px) {
  .overlay { background: rgb(7 11 28 / 0.94); }
}
@media (max-width: 420px) {
  .overlay-text { font-size: 13.5px; line-height: 1.45; }
  .overlay .btn { min-height: 46px; }
}
@media (max-width: 359px) {
  .overlay { padding: 10px; }
  .overlay-card { gap: 8px; }
}

.postcard-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: min(92%, 420px);
  transform: translateX(-50%);
  padding: 12px 16px 14px;
  border-radius: 16px;
  background: #fbf7ee;
  color: var(--ink-blue);
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 0.6);
  border: 1px solid rgb(20 24 58 / 0.1);
  pointer-events: none;
}
.postcard-toast[hidden] { display: none; }
@media (min-width: 720px) {
  .postcard-toast { left: auto; right: 16px; bottom: 16px; width: min(46%, 380px); transform: none; }
  @keyframes toast-in-side { from { transform: translateY(30px) rotate(3deg); opacity: 0; } }
  .postcard-toast.show { animation-name: toast-in-side; }
}
.postcard-toast.show { animation: toast-in 0.5s var(--ease-spring); }
@keyframes toast-in { from { transform: translate(-50%, 30px) rotate(-3deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .postcard-toast.show { animation: none; } }
.toast-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #1f8a4c; }
.toast-title { font-family: var(--font-head); font-weight: 700; font-size: 17px; margin-top: 2px; }
.toast-text { font-size: 14px; line-height: 1.45; color: #3b4063; margin-top: 4px; }

.game-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.brake {
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  background: var(--btn);
  color: var(--btn-ink);
  font: 800 17px/1 var(--font-body);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 6px 0 #b8741a, 0 14px 30px -10px rgb(255 181 71 / 0.6);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.brake.held { transform: translateY(5px); box-shadow: 0 1px 0 #b8741a, 0 6px 16px -8px rgb(255 181 71 / 0.6); }
.brake-dot { width: 14px; height: 14px; border-radius: 50%; background: #c0392b; box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.25); }
.brake.held .brake-dot { background: #ff4d3d; box-shadow: 0 0 10px #ff4d3d; }
.brake kbd {
  font: 700 12px/1 var(--font-body);
  padding: 5px 8px;
  border-radius: 7px;
  border: 1.5px solid rgb(20 24 58 / 0.35);
}
@media (hover: none) { .brake kbd { display: none; } }
.small-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 700 15px/1 var(--font-body);
  cursor: pointer;
  transition: transform 0.25s var(--ease-spring), border-color 0.2s ease;
}
.small-btn:hover { border-color: var(--link); }
.small-btn:active { transform: scale(0.95); }
.small-btn svg { width: 18px; height: 18px; }
#sound[aria-pressed="false"] .wave { opacity: 0.25; }
#sound[aria-pressed="true"] { border-color: var(--link); color: var(--link); }
#pause[aria-pressed="true"] { border-color: var(--amber); }

.how { margin-top: 36px; }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 900px) { .how-list { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.how-list li { display: flex; gap: 14px; align-items: flex-start; color: var(--ink-2); }
.how-num {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--card-line);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  color: var(--link);
}

/* postcards */
.postcards { padding-top: 72px; }
.postcards-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.postcards-head h2 { font-size: clamp(28px, 7vw, 48px); }
.postcards-count { font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--link); white-space: nowrap; }
.postcards-lede { margin-top: 10px; color: var(--ink-2); max-width: 620px; }
.postcard-grid {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 16px;
}
.postcard {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 168px;
  padding: 18px 18px 18px;
  border-radius: 18px;
  background: #fbf7ee;
  color: var(--ink-blue);
  border: 1px solid rgb(20 24 58 / 0.1);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 14px 30px -18px rgb(0 0 0 / 0.5);
  transition: transform 0.4s var(--ease-spring);
}
.postcard::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px dashed rgb(20 24 58 / 0.14);
  pointer-events: none;
}
/* min-height keeps the text below the stamp when the name fits on one line */
.postcard h3 { font-size: 17px; padding-right: 54px; line-height: 1.25; min-height: 40px; }
.postcard .stamp {
  position: absolute;
  top: 14px; right: 14px;
  width: 42px; height: 48px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #2340c9;
  color: #ffffff;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 16px;
  outline: 2px dashed #fbf7ee;
  outline-offset: -5px;
  transform: rotate(4deg);
}
.postcard-text { font-size: 14.5px; line-height: 1.5; color: #353a5c; }
.postcard .maps-link { color: #2340c9; font-size: 14px; }
.postcard-lock { font-size: 14px; color: #5a5f80; }
.postcard.locked { background: transparent; color: var(--ink-3); border: 1.5px dashed var(--line-strong); box-shadow: none; }
.postcard.locked::after { display: none; }
.postcard.locked { min-height: 0; }
.postcard.locked .stamp { background: transparent; color: var(--ink-3); border: 1.5px dashed var(--line-strong); outline: none; transform: none; }
.postcard.locked h3 { color: var(--ink-2); }
.postcard.locked .postcard-lock { color: var(--ink-3); }
.postcard.locked .postcard-text, .postcard.locked .maps-link { display: none; }
.postcard.unlocked .postcard-lock { display: none; }
.postcard.fresh { animation: stamp-in 0.7s var(--ease-spring); }
@keyframes stamp-in { 0% { transform: scale(0.9) rotate(-2deg); } 60% { transform: scale(1.04) rotate(1deg); } }
@media (prefers-reduced-motion: reduce) { .postcard.fresh { animation: none; } }
.postcards-reset { margin-top: 24px; }

@media (max-width: 560px) {
  .brake { flex-basis: 100%; min-height: 64px; }
  .game-controls .small-btn { flex: 1 1 0; justify-content: center; }
  .postcard-toast { top: 10px; bottom: auto; padding: 9px 14px 10px; border-radius: 14px; }
  .toast-title { font-size: 15px; }
  .toast-text { display: none; }
}
