:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17313a;
  background: #f2e7d3;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; }
body { overflow: hidden; background: #f2e7d3; }
button { font: inherit; }

.app {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(35, 79, 86, .08) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(180deg, #f7eedf 0%, #e8d8bd 100%);
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  padding: max(28px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

[data-screen="home"] .home-screen,
[data-screen="play"] .play-screen,
[data-screen="result"] .result-screen { display: flex; }

.brand {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: 24px;
  color: #2f6f74;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .18em;
}

.brand::after {
  content: "";
  display: inline-block;
  width: 42px;
  height: 2px;
  margin-left: 10px;
  vertical-align: middle;
  background: #e35f4f;
}

.eyebrow {
  margin: 0 0 12px;
  color: #d65344;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .18em;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 920px;
  margin-bottom: 14px;
  color: #17313a;
  font-size: clamp(64px, 10vw, 132px);
  line-height: .9;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  color: #e35f4f;
  font-size: clamp(104px, 18vw, 236px);
  line-height: .82;
  letter-spacing: 0;
}

h3 {
  margin: 18px 0 20px;
  color: #234f56;
  font-size: clamp(27px, 4vw, 58px);
  letter-spacing: 0;
}

.copy {
  margin-bottom: 22px;
  color: #365d62;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 820;
}

.tiny {
  margin: 14px 0 0;
  color: #6f7f7b;
  font-size: 12px;
}

.hero-target {
  position: relative;
  width: clamp(132px, 17vw, 208px);
  aspect-ratio: 1.15;
  margin-bottom: 28px;
  animation: bob 1.8s ease-in-out infinite;
}

.hero-target::before {
  position: absolute;
  inset: 8% 4% 18%;
  border: 7px solid #17313a;
  border-radius: 48% 52% 46% 54% / 56% 52% 48% 44%;
  background: #e35f4f;
  box-shadow: 12px 14px 0 rgba(23, 49, 58, .18);
  content: "";
}

.hero-target::after {
  position: absolute;
  left: 24%;
  top: 8%;
  width: 22%;
  height: 28%;
  border: 6px solid #17313a;
  border-radius: 999px;
  background: #79d5c6;
  box-shadow: 54px 4px 0 -2px #79d5c6, 54px 4px 0 4px #17313a;
  content: "";
}

.hero-target span,
.hero-target i {
  position: absolute;
  z-index: 1;
  display: block;
  border-radius: 50%;
  background: #17313a;
}

.hero-target span {
  left: 41%;
  top: 42%;
  width: 9%;
  height: 10%;
  box-shadow: 32px 0 0 #17313a;
}

.hero-target i {
  left: 48%;
  bottom: 25%;
  width: 26%;
  height: 7%;
  border-radius: 999px;
  background: #ffd36a;
}

.mode-picker {
  width: min(900px, 92vw);
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mode-button {
  position: relative;
  min-height: 98px;
  padding: 18px 18px 18px 70px;
  border: 2px solid rgba(23, 49, 58, .16);
  border-radius: 8px;
  color: #17313a;
  background: rgba(255, 251, 241, .82);
  box-shadow: 5px 6px 0 rgba(23, 49, 58, .14);
  text-align: left;
  cursor: pointer;
}

.mode-button::before {
  position: absolute;
  left: 18px;
  top: 24px;
  width: 34px;
  height: 34px;
  border: 3px solid #17313a;
  border-radius: 50%;
  background: #e35f4f;
  content: "";
}

.mode-button[data-mode="focus"]::before { background: #79d5c6; }
.mode-button[data-mode="zoomies"]::before { background: #ffd36a; }

.mode-button.selected {
  border-color: #e35f4f;
  background: #fff7df;
  box-shadow: 0 0 0 4px rgba(227, 95, 79, .12), 5px 6px 0 rgba(23, 49, 58, .14);
}

.mode-button b {
  display: block;
  margin-bottom: 7px;
  color: #17313a;
  font-size: 20px;
}

.mode-button span {
  color: #496b6c;
  font-size: 13px;
  font-weight: 780;
}

.primary-button,
.secondary-button {
  min-width: min(360px, 88vw);
  min-height: 58px;
  padding: 0 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 950;
}

.primary-button {
  border: 3px solid #17313a;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  color: #17313a;
  background: #ffd36a;
  box-shadow: 6px 7px 0 rgba(23, 49, 58, .2);
  font-size: 20px;
}

.primary-button span { font-size: 28px; }

.secondary-button {
  border: 2px solid rgba(23, 49, 58, .22);
  color: #17313a;
  background: rgba(255, 251, 241, .82);
  font-size: 18px;
}

.play-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: none;
  align-items: stretch;
  justify-content: stretch;
  background: #07151b;
}

.hud {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  width: min(700px, calc(100vw - 28px));
  min-height: 68px;
  padding: 7px 14px;
  border: 2px solid rgba(255, 243, 210, .32);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: rgba(8, 25, 31, .78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .26);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.hud div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hud small {
  color: #9fe2d4;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
}

.hud strong {
  color: #fff1c8;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.countdown {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffd36a;
  font-size: clamp(126px, 20vw, 240px);
  font-weight: 950;
  text-shadow: 0 10px 0 #07151b, 0 0 24px rgba(255, 211, 106, .42);
  pointer-events: none;
}

.countdown.hidden { display: none; }

.result-screen {
  overflow: auto;
  justify-content: flex-start;
  padding-top: max(30px, env(safe-area-inset-top));
}

.stats {
  width: min(900px, 92vw);
  margin: 0 0 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stats span {
  min-height: 78px;
  padding: 12px;
  border: 2px solid rgba(23, 49, 58, .12);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #496b6c;
  background: rgba(255, 251, 241, .78);
  font-size: 14px;
  font-weight: 860;
}

.stats b {
  display: block;
  margin-top: 4px;
  color: #17313a;
  font-size: 28px;
}

.card-preview {
  width: min(230px, 36vw);
  aspect-ratio: 9 / 16;
  height: auto;
  margin: 0 0 18px;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 49, 58, .24);
}

.actions {
  width: min(760px, 92vw);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 14px;
}

@keyframes bob {
  50% { transform: translateY(8px) rotate(3deg); }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app { min-height: 100dvh; height: auto; overflow: auto; }
  .mode-picker { grid-template-columns: 1fr; }
  .mode-button { min-height: 76px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .actions { flex-direction: column; align-items: center; }
  .card-preview { width: min(260px, 62vw); }
}

@media (orientation: portrait) {
  .play-screen { height: 100dvh; }
  .hud { top: max(10px, env(safe-area-inset-top)); min-height: 62px; }
  .hud small { font-size: 10px; }
  .hud strong { font-size: 28px; }
}
