.subtitle--inline {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .subtitle--inline {
    flex-wrap: wrap;
    white-space: normal;
  }
}

:root {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #111111;
  background-color: #ffffff;
  line-height: 1.6;
  font-weight: 400;
  --orange: #ff5900;
  --orange-muted: #ffd7c0;
  --border: #c6c6cb;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
  --fs-1: clamp(2.5rem, 5vw, 3.5rem);
  --fs-2: clamp(1.75rem, 3.5vw, 2.5rem);
  --fs-3: 1.125rem;
  --fs-4: 0.875rem;
  --fw-regular: 400;
  --fw-semibold: 600;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  background: #dadade;
  color: inherit;
  font-size: var(--fs-3);
  font-weight: var(--fw-regular);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
a {
  font: inherit;
}

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

.game {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card {
  width: min(960px, 100%);
  max-height: calc(100vh - clamp(2rem, 6vw, 5rem));
  height: 100%;
  background: #dadade;
  /* border: 1px solid var(--border); */
  /* border-radius: 32px; */
  /* box-shadow: var(--shadow); */
  padding: clamp(2rem, 4vw, 3.5rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
}

.screen {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.start-content {
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding: 0.5rem 1rem;
}

.summary-content {
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding: 0.5rem 1rem;
}

.play-stack {
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  overflow: visible;
  padding: 0 1rem;
}

.start-content {
  justify-content: flex-start;
  gap: clamp(0.5rem, 1vh, 0.75rem);
}

.summary-content {
  justify-content: flex-start;
  gap: clamp(0.5rem, 1vh, 0.75rem);
}

.play-stack {
  justify-content: flex-start;
  gap: 1.5rem;
  padding: 0;
}

.start-content>*,
.summary-content>*,
.play-stack>* {
  width: 100%;
  flex-shrink: 0;
}

.start-content .start-copy,
.summary-content .eyebrow,
.summary-content h2,
.summary-content .subtitle {
  flex-shrink: 0;
}

.start-content .face-wrapper {
  flex-shrink: 1;
  min-height: 0;
  max-width: min(450px, 50vh);
  max-height: min(450px, 50vh);
  align-self: center;
}

.summary-content .face-wrapper {
  flex-shrink: 1;
  min-height: 0;
  width: min(360px, 70%);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  overflow: hidden;
  align-self: center;
  margin: clamp(0.25rem, 0.5vh, 0.5rem) 0;
}

.summary-content .face-wrapper img {
  object-fit: contain;
}

.start-content .start-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: clamp(0.5rem, 1vh, 1rem);
}

.summary-content .summary-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: clamp(0.5rem, 1vh, 1rem);
}

.summary-content .share {
  flex-shrink: 0;
  margin-top: clamp(0.5rem, 1vh, 1rem);
}

.play-stack .face-wrapper {
  width: min(360px, 70%);
  align-self: center;
}

@media (max-width: 600px) {
  .play-stack {
    max-width: 100%;
    padding: 0 0.75rem;
  }
}

@media (max-width: 768px) {
  body {
    padding: 1.25rem;
    /* Allow the page to scroll on smaller screens instead of hard-clipping to viewport */
    height: auto;
    max-height: none;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: auto;
  }

  .game-card {
    /* Let the card grow with content on mobile and rely on page scroll */
    max-height: none;
    height: auto;
    border-radius: 24px;
    padding: 1.75rem;
  }

  .start-content,
  .summary-content {
    max-width: 100%;
    height: auto;
    max-height: none;
  }

  .play-stack {
    max-width: 100%;
    padding: 0 0.75rem;
  }

  .subtitle--inline {
    flex-wrap: wrap;
    white-space: normal;
  }
}

.screen.hidden {
  display: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.stack--center {
  text-align: center;
  align-items: center;
}

.start-copy {
  gap: 0.75rem;
  flex-shrink: 0;
}

.start-actions {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: visible;
  padding: 0.5rem 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: var(--fw-semibold);
  max-width: 100%;
}

h2 {
  font-size: var(--fs-2);
  font-weight: var(--fw-semibold);
  text-align: center;
}

.summary-content h2 {
  white-space: nowrap;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.subtitle {
  font-size: var(--fs-3);
  color: #111111;
  opacity: 0.8;
  max-width: 32ch;
}

.eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: var(--fs-4);
  font-weight: var(--fw-semibold);
  color: #111111;
  opacity: 0.7;
}

.face-wrapper {
  width: min(360px, 70%);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  overflow: hidden;
  background: #dadade;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(0.5rem, 1.5vw, 1.5rem);
}

.face-wrapper--hidden {
  display: none;
}

.face-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 200ms ease;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  flex-direction: column;
}

.hud__top {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud__row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: var(--fw-semibold);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: #efefef;
  border-radius: 999px;
  overflow: hidden;
}

.progress-line {
  height: 100%;
  background: var(--orange);
  width: 100%;
  transform-origin: left center;
}

.hud__misc {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.misses {
  font-weight: var(--fw-semibold);
}

.misses.danger {
  color: var(--orange);
}

.sound-toggle {
  border: 1.5px solid rgba(17, 17, 17, 0.15);
  background: #ffffff;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease,
    background 150ms ease, color 150ms ease;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 6l-4 4H4v4h3l4 4z'/%3E%3Cpath d='M15.5 9.5a3.5 3.5 0 010 5'/%3E%3Cpath d='M18.5 7a5.5 5.5 0 010 10'/%3E%3C/svg%3E");
}

.sound-toggle__icon {
  display: none;
}

.sound-toggle.is-muted {
  background-color: #fff4ec;
  border-color: var(--orange);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5900' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 6l-4 4H4v4h3l4 4z'/%3E%3Cline x1='17' y1='9' x2='21' y2='15'/%3E%3Cline x1='21' y1='9' x2='17' y2='15'/%3E%3C/svg%3E");
}

.prompt {
  font-size: var(--fs-2);
  font-weight: var(--fw-semibold);
  text-align: center;
  color: #111111;
}

.answers {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  justify-items: center;
  padding: 0.5rem 0;
  overflow: visible;
}

.answers button {
  width: 100%;
}

.answer--correct {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.answer--wrong {
  background: var(--orange-muted);
  color: #111;
  border-color: transparent;
}

.pill {
  border-radius: 999px;
  border: 1.5px solid var(--orange);
  background: #fff;
  color: var(--orange);
  padding: 0.75rem 1.5rem;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease,
    background 150ms ease, color 150ms ease;
}

.pill:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pill--primary {
  background: #fff;
}

.pill--ghost {
  border-color: rgba(17, 17, 17, 0.2);
  color: #111111;
}

.pill:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.pill--selected,
.pill--primary.pill--selected {
  background: var(--orange);
  color: #fff;
  box-shadow: none;
  transform: scale(1.03);
}


.screen--center {
  text-align: center;
}

.screen--center .subtitle {
  margin-left: auto;
  margin-right: auto;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  width: 100%;
  overflow: visible;
  padding: 0.5rem 0;
}

.share {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.share__label {
  margin: 0;
  font-size: var(--fs-4);
  color: #111111;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: left;
  margin-bottom: 0.25rem;
}

.share__row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  flex-wrap: nowrap;
}

.share__text {
  padding: 0.75rem 1.5rem;
  border-radius: 16px;
  border: 1.5px dashed rgba(17, 17, 17, 0.2);
  font-weight: var(--fw-regular);
  color: #111111;
  flex: 1;
  text-align: left;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.share__text:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.share__text--expanded {
  white-space: normal;
  overflow: auto;
}

.share__row button {
  flex-shrink: 0;
}

.share__feedback {
  margin: 0;
  font-size: var(--fs-4);
  color: var(--orange);
  min-height: 1em;
  text-align: center;
}

@media (max-width: 720px) {
  body {
    padding: 1rem;
  }

  .game-card {
    width: 100%;
    /* Follow the 768px behavior: allow growth and rely on page scroll */
    max-height: none;
    border-radius: 0;
  }

  .face-wrapper {
    width: 70%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0;
  }

  /* Slightly reduce heading scale on very small screens to avoid awkward wrapping */
  h1 {
    font-size: clamp(2rem, 7vw, 2.75rem);
  }

  h2 {
    font-size: clamp(1.5rem, 5vw, 2.1rem);
  }

  .summary-content h2 {
    white-space: normal;
  }

  .hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .share__row {
    flex-wrap: wrap;
    flex-direction: column;
    align-items: stretch;
  }

  .share__text {
    white-space: normal;
    width: 100%;
  }

  .share__row button {
    width: 100%;
  }
}