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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: #fff;
  color: #121212;
  font-family: "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button {
  font: inherit;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.play-shell {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  flex: 1;
  margin: 0 auto;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
}

.play-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 0 8px;
  border-bottom: 1px solid #e2e2e2;
}

.wordmark {
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.play-header > .icon-button {
  justify-self: stretch;
  width: auto;
  justify-content: flex-start;
  padding-left: 8px;
}

.header-actions {
  display: flex;
  justify-self: stretch;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #121212;
  text-decoration: none;
  cursor: pointer;
}

.icon-button svg {
  display: block;
  width: 26px;
  height: 26px;
}

.play-main {
  flex: 0 0 auto;
}

.question {
  margin: 4px 0 18px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-align: center;
}

.practice-note {
  margin: 0 0 14px;
  color: #5a5a5a;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.practice-note a {
  color: inherit;
}

.inline-hint {
  margin: 0;
  color: #6a6a6a;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.guess-line {
  display: grid;
  grid-template-columns: 1fr min(408px, calc(100% - 32px)) 1fr;
  column-gap: 16px;
  align-items: center;
  padding: 0 16px;
}

.guess-line > .guess {
  grid-column: 2;
}

.guess-line > .inline-hint {
  grid-column: 3;
  justify-self: start;
  max-width: 240px;
}

.notice {
  margin: 0 0 8px;
  color: #121212;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.notice:empty {
  display: none;
}

.guesses {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.guess {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: 0;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.guess.is-empty {
  border-color: #dedede;
  background: #fff;
}

.guess.is-active {
  border-color: #121212;
  background: #fff;
}

.guess.is-gray {
  background: #6f6f6f;
  color: #fff;
}

.guess.is-yellow {
  background: #f5c400;
  color: #121212;
}

.guess.is-green {
  background: #2f9e44;
  color: #fff;
}

.guess-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.guess-arrow {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 500;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  background: #121212;
  animation: blink 1.05s step-end infinite;
}

.guess.is-shake {
  animation: shake 0.32s linear;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-3px);
  }
}

.result {
  margin-top: 22px;
}

.answer-value {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.answer-source,
.answer-explanation,
.next-question {
  margin: 8px 0 0;
  color: #4d4d4d;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.answer-source {
  text-align: center;
}

.answer-explanation {
  color: #121212;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 0;
}

.stat {
  margin: 0;
  padding: 12px;
  border: 1px solid #121212;
}

.stat dt {
  color: #5a5a5a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat dd {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.next-question {
  margin-top: 14px;
}

.share {
  width: 100%;
  height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 0;
  background: #121212;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.share:hover {
  background: #2a2a2a;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 48px;
  padding-top: 8px;
  background: #fff;
}

.key {
  height: 56px;
  border: 0;
  border-radius: 0;
  background: #ececec;
  color: #121212;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.key:hover {
  background: #e0e0e0;
}

.key:active {
  background: #d0d0d0;
}

.key-enter {
  background: #121212;
  color: #fff;
}

.key-enter:hover,
.key-enter:active {
  background: #2a2a2a;
}

.key:focus-visible,
.share:focus-visible,
.wordmark:focus-visible,
.icon-button:focus-visible,
.sheet-close:focus-visible {
  outline: 2px solid #121212;
  outline-offset: 2px;
}

.sheet {
  width: min(360px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid #121212;
  border-radius: 0;
  color: #121212;
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.sheet h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.sheet p {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}

.swatch {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.swatch.is-green {
  background: #2f9e44;
}

.swatch.is-yellow {
  background: #f5c400;
}

.swatch.is-gray {
  background: #6f6f6f;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  text-align: center;
}

.stat-grid dd {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-grid dt {
  margin-top: 6px;
  color: #5a5a5a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sheet-close {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  border: 0;
  border-radius: 0;
  background: #121212;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.sheet-close:hover {
  background: #2a2a2a;
}

@media (max-width: 720px) {
  .guess-line {
    grid-template-columns: 1fr min(408px, 62%) 1fr;
    column-gap: 10px;
    padding: 0 10px;
  }

  .inline-hint {
    font-size: 12px;
  }
}

@media (min-width: 720px) {
  .play-shell {
    padding-top: 12px;
  }
}
