.game-root { min-height: 28rem; }

.ap-time,
.ap-found-stat,
.ap-streak,
.ap-fast {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.ap-time { min-width: 4ch; }
.ap-found-stat { min-width: 5ch; }
.ap-streak { min-width: 3ch; }
.ap-fast { min-width: 6.5ch; }

.ap-stage {
  display: flex;
  justify-content: center;
}

.ap-card {
  width: min(100%, 36rem);
  padding: 1.15rem 1.15rem 1.05rem;
  border: 2px solid #b8923a;
  border-radius: 16px;
  background: #fffdf7;
  color: #1d2433;
}

.ap-row {
  display: grid;
  grid-template-columns: repeat(var(--letters, 5), minmax(0, 1fr));
  gap: 0.4rem;
  width: min(100%, calc(var(--letters, 5) * 3.25rem + (var(--letters, 5) - 1) * 0.4rem));
  height: 3.5rem;
  margin: 0 auto 0.7rem;
}

.ap-found-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: min(100%, 22rem);
  height: 2.6rem;
  margin: 0.15rem auto 0.75rem;
}

.ap-found {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  height: 100%;
  min-width: 0;
  border: 2px dashed #c4a24a;
  border-radius: 8px;
  background: rgba(184, 146, 58, 0.08);
  color: #9a8b6e;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.ap-found.is-filled {
  border-style: solid;
  border-color: #2e6b4e;
  background: #f4f8f4;
  color: #1d2433;
}

.ap-found.is-reveal {
  border-style: solid;
  border-color: #8a6230;
  background: #fbf6ea;
  color: #1d2433;
}

.ap-tile,
.ap-slot {
  box-sizing: border-box;
  height: 100%;
  min-width: 0;
  border-radius: 8px;
}

.ap-tile {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 2px solid #b8923a;
  background: #fffdf7;
  color: #1d2433;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.05rem, 4.6vw, 1.6rem);
  line-height: 1;
  user-select: none;
  touch-action: manipulation;
}

button.ap-tile { cursor: pointer; }

button.ap-tile:hover:not(:disabled) { background: #fff6e0; }

button.ap-tile:focus-visible {
  outline: 2px solid #8a6230;
  outline-offset: 2px;
}

button.ap-tile:disabled { cursor: default; }

.ap-tile.is-used {
  visibility: hidden;
}

.ap-slot {
  border: 2px dashed #c4a24a;
  background: rgba(184, 146, 58, 0.08);
}

.ap-row.is-solved .ap-tile {
  border-color: #2e6b4e;
  background: #f4f8f4;
}

.ap-note {
  height: 2.8em;
  margin: 0.15rem 0 0.85rem;
  overflow: hidden;
  text-align: center;
  line-height: 1.4;
  font-size: 0.98rem;
  color: #6d6456;
}

.ap-note.is-good { color: #8a6230; }

.ap-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.ap-actions .btn {
  width: 100%;
  white-space: nowrap;
  padding-inline: 0.4rem;
}

@container (max-width: 36rem) {
  .ap-card { padding: 0.95rem 0.7rem 0.85rem; }
  .ap-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .ap-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    width: 100%;
    height: calc(3.25rem * 2 + 0.45rem);
    gap: 0.45rem;
  }

  .ap-tile,
  .ap-slot {
    width: 3rem;
    height: 3.25rem;
    flex: 0 0 3rem;
  }

  .ap-found-row {
    width: 100%;
  }
}
