:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #080b1a;
  color: #f8f7ff;
  font-synthesis: none;
  --pink: #ff4ecb;
  --cyan: #4ef5e7;
  --purple: #8d63ff;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #080b1a;
}

button { font: inherit; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(92, 52, 164, .28), transparent 35%),
    linear-gradient(180deg, #0b0e24 0%, #080b1a 65%, #11101f 100%);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 26px max(28px, env(safe-area-inset-bottom));
  text-align: center;
}

.screen[hidden], .hud[hidden] { display: none; }

.screen--home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(8, 11, 26, .05), rgba(8, 11, 26, .76));
}

.brand-mark {
  width: 96px;
  height: 80px;
  position: relative;
  margin-bottom: 22px;
  filter: drop-shadow(0 0 18px rgba(78, 245, 231, .25));
}

.brand-mark i {
  position: absolute;
  left: 50%;
  width: 72px;
  height: 19px;
  border-radius: 5px;
  transform: translateX(-50%) skewY(-3deg);
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  box-shadow: 0 5px 14px rgba(78, 245, 231, .14);
}

.brand-mark i:nth-child(1) { top: 52px; width: 90px; }
.brand-mark i:nth-child(2) { top: 27px; width: 68px; background: linear-gradient(90deg, var(--pink), var(--purple)); }
.brand-mark i:nth-child(3) { top: 2px; width: 44px; background: linear-gradient(90deg, #ffb94e, var(--pink)); }

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
}

h1 {
  margin: 0;
  font-size: clamp(54px, 16vw, 76px);
  line-height: .9;
  letter-spacing: -.08em;
  text-shadow: 0 0 28px rgba(141, 99, 255, .28);
}

.subtitle {
  margin: 19px 0 34px;
  color: rgba(248, 247, 255, .6);
  font-size: 15px;
  letter-spacing: .08em;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.primary-button {
  width: min(100%, 300px);
  min-height: 66px;
  padding: 13px 30px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--pink), #7c59ff 62%, #55dcec);
  box-shadow: 0 14px 38px rgba(120, 73, 255, .33), inset 0 1px 0 rgba(255,255,255,.28);
  font-size: 20px;
  font-weight: 900;
  transition: transform .14s ease, filter .14s ease;
}

.primary-button:active { transform: scale(.96); filter: brightness(.9); }
.primary-button span, .primary-button small { display: block; }
.primary-button small { margin-top: 3px; font-size: 10px; font-weight: 500; opacity: .7; letter-spacing: .06em; }

.home-stats {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.home-stats div,
.result-stats div {
  min-width: 92px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(14px);
}

.home-stats span,
.result-stats span { display: block; color: rgba(255,255,255,.45); font-size: 10px; }
.home-stats strong,
.result-stats strong { display: block; margin-top: 2px; font-size: 18px; }

.icon-button {
  padding: 8px 12px;
  background: transparent;
  color: rgba(255,255,255,.46);
  font-size: 12px;
}

.utility-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 18px;
}

.tutorial {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 35%, rgba(5, 7, 18, .22));
}

.tutorial[hidden] { display: none; }

.tutorial-guide {
  position: absolute;
  left: 50%;
  bottom: 25%;
  transform: translateX(-50%);
  min-width: 190px;
  text-align: center;
  color: rgba(255,255,255,.68);
  font-size: 13px;
  letter-spacing: .06em;
  animation: tutorial-in .4s ease both;
}

.tutorial-guide span {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 13px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(78,245,231,.35);
  animation: tap-pulse 1.25s ease-out infinite;
}

.tutorial-guide p { margin: 0; }
.tutorial-guide strong { color: #fff; font-size: 16px; }

.hud {
  position: absolute;
  z-index: 4;
  top: max(18px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.hud-item { display: flex; flex-direction: column; }
.hud-item--right { text-align: right; }
.hud-label { color: rgba(255,255,255,.5); font-size: 10px; letter-spacing: .14em; }
.hud strong { font-size: 28px; line-height: 1; }

.screen--result {
  background: rgba(5, 7, 17, .62);
  backdrop-filter: blur(10px);
  animation: fade-in .25s ease both;
}

.result-card {
  width: min(100%, 360px);
  padding: 34px 25px 25px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 30px;
  background: linear-gradient(160deg, rgba(30, 31, 64, .96), rgba(14, 16, 37, .96));
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
}

.screen--report {
  z-index: 7;
  justify-content: flex-end;
  background: rgba(5, 7, 17, .72);
  backdrop-filter: blur(12px);
}

.report-card {
  width: min(100%, 430px);
  max-height: calc(100vh - 38px);
  overflow-y: auto;
  padding: 27px 22px 20px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(30, 31, 64, .98), rgba(14, 16, 37, .98));
  box-shadow: 0 24px 70px rgba(0,0,0,.48);
  text-align: left;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.report-header .eyebrow { margin-bottom: 5px; }
.report-header h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }

.close-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.7);
  font-size: 25px;
  line-height: 1;
}

.report-source { margin: 9px 0 17px; color: rgba(255,255,255,.45); font-size: 11px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.metrics-grid div {
  min-width: 0;
  padding: 13px 10px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}

.metrics-grid span { display: block; color: rgba(255,255,255,.44); font-size: 9px; white-space: nowrap; }
.metrics-grid strong { display: block; margin-top: 5px; font-size: 20px; }
.report-actions { margin-top: 18px; }
.primary-button--small { width: 100%; min-height: 52px; border-radius: 17px; font-size: 15px; }
.privacy-note { margin: 8px 3px 0; color: rgba(255,255,255,.28); font-size: 9px; line-height: 1.5; }

.result-score {
  display: block;
  margin: 5px 0;
  font-size: 88px;
  line-height: 1;
  letter-spacing: -.07em;
  background: linear-gradient(180deg, #fff, #b7a9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-message { margin: 9px 0 22px; color: rgba(255,255,255,.56); }
.result-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 22px; }
.result-card .primary-button { min-height: 58px; font-size: 17px; }

.secondary-button {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: transparent;
  color: rgba(255,255,255,.62);
  font-size: 13px;
}

.toast {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .2s ease;
}

.toast--show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tutorial-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes tap-pulse {
  0% { transform: scale(.86); box-shadow: 0 0 0 0 rgba(78,245,231,.42); }
  65% { transform: scale(1); box-shadow: 0 0 0 19px rgba(78,245,231,0); }
  100% { transform: scale(.86); box-shadow: 0 0 0 0 rgba(78,245,231,0); }
}

@media (max-height: 650px) {
  .brand-mark { margin-bottom: 12px; transform: scale(.82); }
  .subtitle { margin: 12px 0 22px; }
  .home-stats { margin-top: 12px; }
  .utility-row { margin-top: 8px; }
  .report-card { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
