:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111317;
  color: #f5f0dc;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  background: #111317;
}

button {
  font: inherit;
}

#shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
  background: #111317;
  touch-action: none;
  user-select: none;
}

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

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(560px, calc(100vw - 24px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.readout {
  min-width: 0;
  border: 1px solid rgba(245, 240, 220, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(16, 19, 23, 0.58);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.readout span,
#resultKicker,
#resultDetail {
  display: block;
  color: rgba(245, 240, 220, 0.68);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.readout strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #fff8df;
  font-size: clamp(1rem, 3.8vw, 1.35rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(17, 19, 23, 0.12), rgba(17, 19, 23, 0.76));
}

.message[hidden] {
  display: none;
}

.message div {
  width: min(460px, calc(100vw - 44px));
}

#resultKicker {
  margin: 0 0 8px;
  color: #8fe8db;
}

#resultTitle {
  margin: 0;
  color: #fff8df;
  font-size: clamp(2.1rem, 10vw, 4.3rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-wrap: balance;
}

#resultDetail {
  margin: 14px 0 0;
  color: rgba(255, 248, 223, 0.78);
  font-size: 0.95rem;
  text-transform: none;
}

#again {
  min-width: 132px;
  min-height: 48px;
  border: 1px solid rgba(255, 248, 223, 0.34);
  border-radius: 8px;
  padding: 12px 24px;
  color: #111317;
  background: #ffd36a;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
  font-weight: 900;
}

#again:active {
  transform: translateY(1px);
}

#share {
  min-height: 48px;
  margin-top: 10px;
  border: 1px solid rgba(255, 248, 223, 0.34);
  border-radius: 8px;
  padding: 10px 20px;
  color: rgba(255, 248, 223, 0.85);
  background: transparent;
  font-weight: 700;
}

#share:active {
  transform: translateY(1px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 430px) {
  #shell {
    min-height: 480px;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .readout {
    padding: 7px 8px;
  }

  .readout.compact {
    display: none;
  }
}
