:root {
  --bg: #fff7ed;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #6b7280;
  --line: #fed7aa;
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #fb7185;
  --yellow: #facc15;
  --purple: #a78bfa;
  --orange: #fb923c;
  --shadow: 0 20px 52px rgba(124, 45, 18, 0.16);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: manipulation;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.board {
  width: min(100%, 980px);
  min-height: min(720px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  border: 4px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.stars {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border-radius: 18px;
  background: #fef3c7;
  padding: 12px 18px;
  font-weight: 900;
}

.stars::before {
  content: "⭐";
  font-size: 2.4rem;
}

.stars span {
  font-size: 2.6rem;
  line-height: 1;
}

.stars small {
  color: #92400e;
  font-size: 1.1rem;
}

.small-button {
  min-width: 112px;
  min-height: 68px;
  border-radius: 18px;
  background: var(--purple);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
}

.feedback {
  min-height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  padding: 10px;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 950;
  text-align: center;
}

.feedback.neutral {
  background: #e0f2fe;
  color: #075985;
}

.feedback.good {
  background: #dcfce7;
  color: #166534;
}

.feedback.try {
  background: #ffe4e6;
  color: #9f1239;
}

.task {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.5vw, 28px);
  min-height: 160px;
  border-radius: 24px;
  background: #f8fafc;
  font-size: clamp(3.6rem, 10vw, 7.4rem);
  font-weight: 1000;
  line-height: 1;
}

.answer {
  min-width: 1.55em;
  min-height: 1.2em;
  display: inline-grid;
  place-items: center;
  border-radius: 18px;
  background: #fef08a;
  color: #713f12;
  padding: 0 0.16em;
}

.pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.pad button {
  min-height: clamp(78px, 13vh, 116px);
  border-radius: 22px;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 1000;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.digit:nth-of-type(1),
.digit:nth-of-type(5),
.digit:nth-of-type(9) {
  background: var(--blue);
}

.digit:nth-of-type(2),
.digit:nth-of-type(6),
.digit:nth-of-type(11) {
  background: var(--green);
}

.digit:nth-of-type(3),
.digit:nth-of-type(7) {
  background: var(--orange);
}

.digit:nth-of-type(4),
.digit:nth-of-type(8) {
  background: var(--purple);
}

.tool {
  background: var(--red);
}

.ok {
  background: var(--green);
  grid-column: span 2;
}

.pad button:active,
.small-button:active {
  transform: translateY(4px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.pop {
  animation: pop 220ms ease-out;
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (orientation: landscape) and (min-width: 760px) {
  .board {
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-rows: auto auto 1fr;
    align-items: stretch;
  }

  .top,
  .feedback {
    grid-column: 1 / -1;
  }

  .task {
    min-height: 100%;
  }

  .pad {
    align-self: stretch;
  }
}

@media (max-width: 520px) {
  .app {
    padding: 10px;
  }

  .board {
    min-height: calc(100vh - 20px);
    padding: 14px;
    gap: 12px;
  }

  .pad {
    gap: 10px;
  }
}
