/* Pothole — styles. System fonts only. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #2f3236; color: #1d1d1f;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
#game { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: none; }

/* HUD */
#hud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 12px) 0 calc(env(safe-area-inset-left, 0px) + 12px);
  pointer-events: none; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.45);
}
.hud-left { min-width: 90px; }
.hud-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; font-weight: 700; }
#score { font: 900 30px/1 "Arial Black", "Arial Bold", Arial, system-ui, sans-serif; }
#score.pop { animation: pop .25s ease-out; }
#combo { margin-top: 4px; font: 900 15px/1 "Arial Black", Arial, sans-serif; color: #ffd400; min-height: 16px; }
.hud-mid { text-align: center; }
#lives { display: flex; gap: 6px; justify-content: center; }
.life {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #eceff2 0 22%, #9aa1a8 23% 30%, #d9dde1 31% 62%, #6d747b 63% 100%);
  box-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.life.lost { opacity: .25; filter: grayscale(1); transform: scale(.8); transition: all .3s; }
.life.lost-now { animation: lose .5s ease-out; }
#stage {
  margin-top: 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 10px; display: inline-block;
}
.hud-right { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; cursor: pointer;
  background: rgba(20,22,25,.55); color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.icon-btn svg { fill: #fff; }
.icon-btn .wave { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn .ico-off { display: none; }
.icon-btn.muted .ico-on { display: none; }
.icon-btn.muted .ico-off { display: block; }

/* Council memo toast */
.memo {
  position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: min(92vw, 420px); transform: translate(-50%, 140%) rotate(-1deg);
  background: #fdfbf3; border: 1px solid #d8d2bf; border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 10px 14px 12px;
  transition: transform .45s cubic-bezier(.2,1.4,.4,1); pointer-events: none;
}
.memo.show { transform: translate(-50%, 0) rotate(-1deg); }
.memo-head { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8a2a1f; border-bottom: 1px dashed #c9c1a8; padding-bottom: 5px; margin-bottom: 6px; }
#memo-text { font-size: 15px; line-height: 1.35; font-family: Georgia, "Times New Roman", serif; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(20,22,26,.45);
  overflow-y: auto;
}
.card {
  width: min(94vw, 440px); background: #fdfbf3; border-radius: 14px; padding: 22px 22px 18px;
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 4px #ffd400;
  animation: cardIn .4s cubic-bezier(.2,1.3,.4,1);
  margin: auto;
}
#logo { width: 140px; height: 120px; display: block; margin: -4px auto 0; }
.title {
  margin: 2px 0 4px; font: 900 56px/1 "Arial Black", "Arial Bold", Impact, Arial, sans-serif; letter-spacing: .04em;
  color: #ffd400; -webkit-text-stroke: 2px #1d1d1f; text-shadow: 0 5px 0 #1d1d1f;
}
.tag { margin: 6px 0 12px; font-size: 12px; font-weight: 700; color: #6b6656; text-transform: uppercase; letter-spacing: .06em; }
.howto { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.best { margin: 12px 0 4px; font-size: 14px; }
.joke { margin: 8px 0 12px; font-size: 13px; color: #6b6656; font-style: italic; line-height: 1.4; }
h2 { margin: 6px 0 8px; font: 900 24px/1.15 "Arial Black", Arial, sans-serif; }
.btn {
  font: 900 18px/1 "Arial Black", Arial, sans-serif; border: 0; border-radius: 12px; cursor: pointer;
  padding: 14px 26px; background: #ffd400; color: #1d1d1f; box-shadow: 0 5px 0 #b79800;
  transition: transform .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b79800; }
.btn.big { font-size: 22px; padding: 16px 40px; }
.btn.ghost { background: #ebe6d6; box-shadow: 0 5px 0 #c4bda6; font-size: 15px; }
.btn.small { font-size: 12px; padding: 8px 14px; box-shadow: 0 3px 0 #c4bda6; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid #2b5fae; outline-offset: 2px; }
.row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 10px 0; }

.letterhead { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #8a2a1f; border-bottom: 2px solid #8a2a1f; padding-bottom: 6px; }
.cause { margin: 0 0 10px; font-size: 14px; color: #6b6656; font-style: italic; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.stats div { background: #f1ecdc; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b6656; font-weight: 700; }
.stats b { font: 900 22px/1.1 "Arial Black", Arial, sans-serif; }
.stats .best-row { grid-column: 1 / -1; background: #fff2a8; }
.newbest { margin: 6px 0; font-weight: 800; color: #2f7d4a; font-size: 14px; }
.rank { margin: 8px 0 2px; font-size: 15px; }
.ref { margin: 2px 0 8px; font-size: 12px; color: #8a8471; font-family: "Courier New", monospace; }

@keyframes pop { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes lose { 0% { transform: scale(1.6) rotate(0); } 100% { transform: scale(.8) rotate(200deg); } }
@keyframes cardIn { from { transform: translateY(30px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-height: 560px) {
  .card { padding: 14px 18px 12px; }
  #logo { width: 90px; height: 78px; }
  .title { font-size: 40px; }
  .howto { margin-bottom: 10px; font-size: 15px; }
  .joke { margin: 4px 0 8px; }
  .stats b { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .memo { animation: none; transition: none; }
}
