@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #10131d;
  --mist: #f3f1ee;
  --sky-1: #a1c4fd;
  --sky-2: #c2e9fb;
  --accent: #ff7a5a;
  --accent-dark: #f35d3a;
  --pill: rgba(16, 19, 29, 0.08);
  --glass: rgba(255, 255, 255, 0.65);
  --shadow: 0 24px 50px rgba(16, 19, 29, 0.18);
  --frame: rgba(255, 255, 255, 0.85);
  --frame-edge: rgba(16, 19, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.9), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.7), transparent 42%),
    radial-gradient(circle at 10% 80%, rgba(255, 255, 255, 0.5), transparent 45%),
    linear-gradient(180deg, var(--sky-1), var(--sky-2));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  touch-action: manipulation;
}

.scene {
  width: min(900px, 100%);
  height: 100%;
  display: grid;
  gap: 14px;
  grid-template-rows: auto 1fr auto;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 14px 18px;
  box-shadow: 0 18px 36px rgba(16, 19, 29, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo {
  font-family: "Fraunces", serif;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: 0.5px;
}

.tag {
  font-size: 0.9rem;
  color: rgba(16, 19, 29, 0.62);
}

.scores {
  display: flex;
  gap: 16px;
}

.score {
  background: var(--pill);
  border-radius: 18px;
  padding: 10px 16px;
  min-width: 90px;
  text-align: right;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.score .label {
  font-size: 0.75rem;
  color: rgba(16, 19, 29, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score span {
  display: block;
}

.playfield {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
  border-radius: 28px;
  padding: 12px;
  box-shadow: 0 30px 60px rgba(16, 19, 29, 0.2);
  display: grid;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

#game {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  background: linear-gradient(180deg, #b6d9ff 0%, #e0f7ff 60%, #ffe9d6 100%);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 220px);
  border: 1px solid var(--frame-edge);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.5);
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  inset: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 19, 29, 0.22), rgba(16, 19, 29, 0.12));
  display: grid;
  place-items: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  padding: 28px 32px;
  border-radius: 22px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 25px 50px rgba(16, 19, 29, 0.24);
  animation: floatIn 0.6s ease;
}

.panel h1 {
  font-family: "Fraunces", serif;
  font-size: 2rem;
  margin: 0 0 8px;
}

.panel p {
  margin: 0 0 20px;
  color: rgba(16, 19, 29, 0.7);
}

button {
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(16, 19, 29, 0.2);
  margin-left: 8px;
}

.tips {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: rgba(16, 19, 29, 0.65);
  padding: 0 6px;
}

.tips span {
  font-weight: 600;
  color: rgba(16, 19, 29, 0.9);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .scores {
    width: 100%;
    justify-content: space-between;
  }

  .tips {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  #game {
    aspect-ratio: 9 / 16;
    max-height: calc(100vh - 180px);
  }
}

@media (max-height: 720px) {
  body {
    padding: 10px;
  }

  .hud {
    padding: 10px 14px;
  }

  .tag {
    display: none;
  }

  .tips {
    display: none;
  }

  #game {
    max-height: calc(100vh - 150px);
  }
}
