:root {
  --bg: #f6ebd9;
  --card: #fff8ee;
  --ink: #3b2a1f;
  --muted: #8a7060;
  --play: #e07a4a;
  --ok: #6b8f71;
  --score: #c45c26;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Nunito, "Segoe UI", sans-serif;
}
.shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.view { position: relative; }
.hidden { display: none !important; }
h2 { margin: 8px 0; font-weight: 800; }
.lead, .intro {
  color: var(--muted);
  line-height: 1.45;
  font-weight: 600;
}
.intro { white-space: pre-line; margin: 0 0 12px; }
.ticket-off {
  position: absolute;
  left: -9999px;
  width: 320px;
  height: 480px;
}

.home-block { padding-top: 8vh; }
.score-num {
  margin: 0 0 20px;
  font-size: 4.2rem;
  line-height: 1;
  text-align: center;
  font-weight: 800;
  color: var(--score);
}
.road {
  position: relative;
  height: 64px;
  margin: 0 4px 24px;
}
.road-track {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 26px;
  height: 12px;
  background: #e8d5bc;
  border-radius: 20px;
  box-shadow: inset 0 1px 3px rgba(59, 42, 31, 0.12);
}
.road-fill {
  height: 100%;
  width: 0;
  background: var(--play);
  border-radius: 20px;
}
.road-nodes {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
.road-nodes .node {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(59, 42, 31, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--ink);
}
.road-nodes .node.off { filter: grayscale(1); opacity: 0.45; }
.road-nodes .node.on { background: #fff; color: var(--score); box-shadow: 0 2px 8px rgba(196, 92, 38, 0.25); }
.road.compact { height: 52px; margin: 0 0 10px; }
.road.compact .road-track { top: 20px; height: 10px; }
.road.compact .road-pawn { top: 8px; width: 16px; height: 16px; }
.road-pawn {
  position: absolute;
  top: 12px;
  width: 18px;
  height: 18px;
  background: var(--score);
  border-radius: 50%;
  z-index: 2;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(59, 42, 31, 0.2);
}
.home-bar { display: flex; gap: 10px; }
.home-bar .btn { flex: 1; margin-top: 0; }
.home-offer {
  margin: 0 8px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 56px;
  padding: 14px 18px;
  border: 0;
  border-radius: 18px;
  background: var(--play);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(224, 122, 74, 0.35);
  cursor: pointer;
}
.btn-ok { background: var(--ok); box-shadow: 0 4px 12px rgba(107, 143, 113, 0.3); }
.btn-ghost {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(59, 42, 31, 0.08);
}
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 12vh;
}
.lang-grid .btn {
  margin-top: 0;
  min-height: 72px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(59, 42, 31, 0.08);
  font-size: 1.25rem;
}

.hud {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  padding: 4px 0 10px;
}
.hud-pad { padding-left: 48px; }
.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hud-item img {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
}
.hud-item .score { color: var(--score); }
.hud-item .score-round { color: var(--play); font-weight: 800; }
.hud-game { justify-content: space-between; flex-wrap: wrap; }
.back {
  position: absolute;
  top: 4px;
  left: 0;
  z-index: 3;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(59, 42, 31, 0.1);
  cursor: pointer;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.card {
  position: relative;
  min-height: 108px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(59, 42, 31, 0.08);
  text-align: center;
}
.card-open { cursor: pointer; }
.card-play {
  background: #fde8dc url("../assets/kenney/ui-pack/PNG/Yellow/Default/button_rectangle_depth_flat.png") center / 100% 100% no-repeat;
  box-shadow: none;
}
.card-play .card-name { color: var(--play); }
.card-ok {
  background: #e8f0e9 url("../assets/kenney/ui-pack/PNG/Green/Default/button_rectangle_depth_flat.png") center / 100% 100% no-repeat;
  box-shadow: none;
}
.card-ok .card-name { color: var(--ok); }
.card-score {
  background: #f8e4d8 url("../assets/kenney/ui-pack/PNG/Red/Default/button_rectangle_depth_flat.png") center / 100% 100% no-repeat;
}
.card-score .card-name { color: var(--score); }
.card-done { pointer-events: none; }
.card-closed {
  pointer-events: none;
  background: #efe4d2 url("../assets/kenney/ui-pack/PNG/Grey/Default/button_rectangle_depth_flat.png") center / 100% 100% no-repeat;
  box-shadow: none;
  opacity: 0.85;
}
.card-ico { width: 36px; height: 36px; image-rendering: pixelated; }
.card-name { font-size: 0.92rem; font-weight: 800; line-height: 1.2; }
.card-closed .card-name { color: var(--muted); }
.card-sub { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
}

.lives {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 12px;
}
.lives img { width: 28px; height: 28px; }
.lives img.off { opacity: 0.3; filter: grayscale(1); }
.lives-hud { margin: 0; }
.lives-hud img { width: 22px; height: 22px; }

#view-game { touch-action: none; }
#board {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px auto 0;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(59, 42, 31, 0.08);
  touch-action: none;
}