:root {
  --bg: #fff;
  --fg: #000;
  --muted: rgba(0, 0, 0, 0.65);
  --line: rgba(0, 0, 0, 0.9);
  --soft: rgba(0, 0, 0, 0.08);
  --shadow: rgba(0, 0, 0, 0.14);
  --radius: 16px;
  --border: 1px solid rgba(0, 0, 0, 0.22);

  --ok: #14a44d;
  --bad: #dc3545;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100svh;
}

.langTopRight {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 80;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.wrap {
  width: min(880px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.timer {
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-size: 64px;
  line-height: 1;
  user-select: none;
}
.timer small {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-left: 8px;
}

.leftTimer {
  margin-top: -6px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: 28px;
  line-height: 1;
  user-select: none;
  opacity: 0.85;
}

.leftTimer small {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.18em;
  margin-left: 10px;
  opacity: 0.7;
}
.card {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.top {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 12px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.brand .h {
  font-weight: 950;
  letter-spacing: 0.02em;
  font-size: 16px;
  margin: 0;
}
.brand .s {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  max-width: 56ch;
}
.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.langBtn {
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

.langBtn.active {
  opacity: 1;
}

.score {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
}
.score .k {
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 950;
  opacity: 0.9;
}
.score .v {
  font-variant-numeric: tabular-nums;
  font-size: 32px;
  line-height: 1;
  font-weight: 950;
}
.score.ok {
  color: var(--ok);
}
.score.bad {
  color: var(--bad);
}
.pill {
  border: var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
}
.pill .k {
  color: rgba(0, 0, 0, 0.7);
  letter-spacing: 0.12em;
  font-size: 11px;
}
.pill .v {
  font-variant-numeric: tabular-nums;
}

.staffBox {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.progression {
  border: var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}
.slot {
  border: var(--border);
  border-radius: 12px;
  padding: 18px 10px;
  font-weight: 950;
  font-size: 36px;
  letter-spacing: 0.02em;
  text-align: center;
  user-select: none;
}
.slot.q {
  opacity: 0.7;
  cursor: pointer;
}

.slot.q:hover {
  background: rgba(0, 0, 0, 0.03);
}

.row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.msg {
  border: var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 950;
  font-size: 78px;
  letter-spacing: 0.08em;
  user-select: none;
  display: none;
  opacity: 0;
  position: fixed;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 50;
  pointer-events: none;
}
.msg.show {
  display: inline-flex;
}
.msg.anim {
  animation: msgFade 1500ms ease forwards;
}
.msg.ok {
  background: var(--ok);
  color: #fff;
}
.msg.bad {
  background: var(--bad);
  color: #fff;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
}
.overlay.show {
  display: block;
}
.overlay.ok {
  background: rgba(20, 164, 77, 0.9);
}
.overlay.bad {
  background: rgba(220, 53, 69, 0.9);
}

.pill.subtle {
  opacity: 0.55;
}

@keyframes msgFade {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px));
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 6px));
  }
}

.choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 740px;
  margin: 18px auto 0;
}
@media (max-width: 760px) {
  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timer {
    font-size: 54px;
  }
}

/* Short screens (iPhone Safari address bar, landscape, etc.) */
@media (max-height: 740px) {
  body {
    align-items: flex-start;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .wrap {
    gap: 12px;
  }

  .timer {
    font-size: 48px;
  }
}

@media (max-height: 660px) {
  .timer {
    font-size: 44px;
  }

  .choices {
    margin-top: 12px;
  }
}
@media (max-width: 440px) {
  body {
    padding: 18px;
  }
  .timer {
    font-size: 46px;
  }
  .choice {
    min-height: 120px;
  }
  .choice .title .t {
    font-size: 24px;
  }
}

.choice {
  border: var(--border);
  border-radius: 14px;
  padding: 18px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--soft);
  transition: transform 0.05s ease, background 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 138px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.choice:hover {
  background: rgba(0, 0, 0, 0.06);
}
.choice:active {
  transform: translateY(1px);
}
.choice[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.choice .sub {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.16em;
  opacity: 0.7;
}

.choice .title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.choice .title .t {
  font-weight: 950;
  font-size: 28px;
  letter-spacing: 0.02em;
}
.choice .title .kbd {
  border: var(--border);
  border-radius: 10px;
  padding: 4px 8px;
  font-weight: 950;
  font-size: 12px;
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.footer {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.footer b {
  color: #000;
  font-weight: 950;
}
a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid #000;
  font-weight: 950;
}

.ghLink {
  border-bottom: none;
}

.ghIcon {
  display: block;
}
.tap {
  border: var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 950;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tap.start {
  padding: 16px 22px;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.row.startRow {
  justify-content: center;
}

.endCard {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  width: min(560px, calc(100% - 32px));
  border: var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  background: #fff;
  display: none;
  text-align: center;
}

.endCard.show {
  display: block;
}

.endTitle {
  font-weight: 950;
  letter-spacing: 0.18em;
  font-size: 12px;
  opacity: 0.7;
}

.endScore {
  margin-top: 10px;
  font-size: 44px;
  font-weight: 950;
  letter-spacing: -0.01em;
}

.endShareLabel {
  margin-top: 10px;
  font-weight: 950;
  letter-spacing: 0.14em;
  font-size: 12px;
  opacity: 0.7;
}

.endShareRow {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
