:root {
  --color-bg: #070910;
  --color-fg: #f4f7fb;
  --color-muted: #b7c0ce;
  --color-sky: #3ec8ff;
  --color-pink: #ff4fa8;
  --color-gold: #ffb020;
  --color-lime: #c6f04a;
  --color-line: rgba(244, 247, 251, 0.16);
  --font-sans: "Segoe UI", "Helvetica Neue", "Avenir Next", sans-serif;
  --radius: 16px;
}

  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
}

.cg-host,
.cg-host * {
  box-sizing: border-box;
}

.cg-stage [hidden] {
  display: none !important;
}

.cg-root {
  position: fixed;
  left: 0;
  top: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background:
    radial-gradient(120% 80% at 50% 100%, rgba(62, 200, 255, 0.08), transparent 46%),
    var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-fg);
}

.cg-stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  container-type: size;
  background: #070910;
  box-shadow: 0 0 0 1px rgba(244, 247, 251, 0.04);
}

.cg-canvas {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  display: block;
  z-index: 0;
}

.cg-hud {
  position: relative;
  flex: 0 0 auto;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "sound score pause"
    "chip chip chip";
  align-items: center;
  column-gap: 0.4rem;
  row-gap: 0.3rem;
  padding: max(0.4rem, env(safe-area-inset-top)) 0.45rem 0.4rem;
  background: #0c111a;
  border-bottom: 1px solid rgba(62, 200, 255, 0.32);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.cg-hud.is-covered {
  visibility: hidden;
  pointer-events: none;
}

.cg-hud-sound {
  grid-area: sound;
  justify-self: start;
}

.cg-hud-pause {
  grid-area: pause;
  justify-self: end;
}

.cg-scoreblock {
  grid-area: score;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 3.2em;
  line-height: 1.05;
}

.cg-kicker {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-muted);
}

.cg-score {
  font-size: 1.45em;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.cg-live-best {
  margin-top: 0.12em;
  font-size: 0.72em;
  font-weight: 760;
  letter-spacing: 0.03em;
  color: #f4d56a;
}

.cg-chip {
  grid-area: chip;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 0.25em 0.75em 0.25em 0.45em;
  border-radius: 999px;
  border: 2px solid var(--chip, var(--color-sky));
  background: rgba(7, 9, 16, 0.78);
  box-shadow: 0 0 18px color-mix(in srgb, var(--chip, var(--color-sky)) 45%, transparent);
  font-weight: 760;
  font-size: 1em;
}

.cg-chip-svg {
  width: 1.35em;
  height: 1.35em;
  color: var(--chip, var(--color-sky));
  display: block;
}

.cg-btn {
  appearance: none;
  border: 2px solid rgba(244, 247, 251, 0.72);
  background: #0c0e12;
  color: #f7f8fb;
  border-radius: 14px;
  min-height: 48px;
  min-width: 44px;
  padding: 0.55em 0.9em;
  font: inherit;
  font-weight: 720;
  font-size: 1.02em;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cg-btn:focus {
  outline: none;
}

.cg-btn.is-focus {
  outline: 3px solid var(--color-sky);
  outline-offset: 3px;
}

.cg-btn.primary {
  background: var(--color-fg);
  color: #10141c;
  border-color: var(--color-fg);
}

.cg-btn:active {
  transform: translateY(1px);
}

.cg-hud-btn {
  min-height: 44px;
  padding: 0.35em 0.6em;
  font-size: 0.86em;
  background: rgba(7, 9, 16, 0.78);
}

.cg-prompt {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 0.45em 0.9em;
  border-radius: 999px;
  background: rgba(7, 9, 16, 0.72);
  border: 1px solid var(--color-line);
  font-size: 1.25em;
  font-weight: 760;
  pointer-events: none;
  white-space: nowrap;
}

.cg-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  padding: 0.8rem max(2.75rem, 12%) 4.75rem;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(7, 9, 16, 0.42) 0%, rgba(7, 9, 16, 0.82) 42%, rgba(7, 9, 16, 0.92) 100%);
}

.cg-panel-plain {
  background: linear-gradient(180deg, rgba(7, 9, 16, 0.16) 0%, rgba(7, 9, 16, 0.34) 48%, rgba(7, 9, 16, 0.5) 100%);
}

.cg-fit {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55em;
}

.cg-title {
  margin: 0;
  font-size: 2.15em;
  line-height: 1.02;
  font-weight: 760;
  letter-spacing: -0.03em;
  text-align: center;
}

.cg-title span {
  color: var(--color-sky);
}

.cg-title .cg-pink {
  color: var(--color-pink);
}

.cg-tag {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08em;
  font-size: 1.12em;
  line-height: 1.35;
  color: var(--color-fg);
  text-align: center;
}

.cg-hint,
.cg-note,
.cg-best {
  margin: 0;
  font-size: 0.98em;
  line-height: 1.35;
  color: var(--color-muted);
}

.cg-hint,
.cg-best,
.cg-result-title {
  text-align: center;
}

.cg-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  padding: 0.75em 0.85em 0.85em;
  border-radius: 16px;
  background: rgba(8, 10, 14, 0.92);
  border: 2px solid rgba(244, 247, 251, 0.28);
  text-align: center;
}

.cg-copy .cg-hint,
.cg-copy .cg-note,
.cg-copy .cg-best {
  color: #f7f8fb;
}

.cg-panel[data-panel="results"] .cg-fit {
  width: min(100%, 22em);
}

.cg-panel[data-panel="results"] .cg-heading {
  background: #0c0e12;
  color: #f7f8fb;
  border: 2px solid rgba(244, 247, 251, 0.72);
  border-radius: 14px;
  padding: 0.45em 0.7em;
  text-align: center;
}

.cg-panel[data-panel="results"] .cg-stat {
  background: #0c0e12;
  color: #f7f8fb;
  border: 2px solid rgba(244, 247, 251, 0.72);
  border-radius: 14px;
  min-height: 48px;
  padding: 0.45em 0.9em;
  border-bottom: 2px solid rgba(244, 247, 251, 0.72);
}

.cg-panel[data-panel="results"] .cg-stat span,
.cg-panel[data-panel="results"] .cg-stat strong {
  color: #f7f8fb;
}

.cg-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 0.35em;
}

.cg-heading {
  margin: 0;
  font-size: 1.7em;
  line-height: 1.1;
  font-weight: 760;
}

.cg-panel[data-panel="howto"] .cg-heading {
  text-align: center;
}

.cg-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}

.cg-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  padding: 0.35em 0.15em;
  border-bottom: 1px solid var(--color-line);
  font-size: 1.05em;
}

.cg-stat strong {
  font-size: 1.25em;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.cg-card {
  width: min(100%, 22em);
  margin: 0 auto;
  padding: 1em 1em 0.9em;
  border-radius: 18px;
  background: rgba(10, 14, 24, 0.92);
  border: 1px solid var(--color-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.7em;
}

.cg-host-pause {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 5.2rem;
  background: rgba(5, 7, 12, 0.78);
  clip-path: polygon(
    0 0,
    100% 0,
    100% 100%,
    100px 100%,
    100px calc(100% - 60px),
    0 calc(100% - 60px)
  );
}

.cg-host-card {
  min-width: min(100%, 16rem);
  min-height: 4.4rem;
  font-size: 1.35em;
  padding: 0.8em 1.1em;
}

.cg-rotate {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem 5rem;
  text-align: center;
  background: var(--color-bg);
}

.cg-rotate[hidden] {
  display: none !important;
}

.cg-rotate p {
  margin: 0;
  max-width: 10em;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  font-weight: 760;
  line-height: 1.15;
}

@container (max-height: 680px) {
  .cg-panel {
    padding: 0.4rem max(2.75rem, 12%) 4.55rem;
    justify-content: flex-start;
  }

  .cg-fit {
    gap: 0.32em;
  }

  .cg-title {
    font-size: 1.85em;
  }

  .cg-heading {
    font-size: 1.35em;
  }

  .cg-tag,
  .cg-hint,
  .cg-note {
    font-size: 0.92em;
    line-height: 1.25;
  }

  .cg-actions {
    gap: 0.35em;
    margin-top: 0.1em;
  }

  .cg-btn {
    min-height: 44px;
    padding: 0.4em 0.7em;
  }

  .cg-stat {
    padding: 0.2em 0.1em;
  }

  .cg-card {
    padding: 0.75em 0.75em 0.65em;
    gap: 0.45em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cg-btn:active {
    transform: none;
  }
}
