/* ------------------------------------------------------------------ *
 * Cards pinned to the page: topics, puzzle lists, the vocabulary slips.
 * ------------------------------------------------------------------ */

.card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* A strip of washi tape, because this is a scrapbook, not a dashboard. */
.taped::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 26px;
  width: 74px;
  height: 22px;
  transform: rotate(-3.5deg);
  background: color-mix(in srgb, var(--accent) 30%, white);
  border-left: 1px dashed color-mix(in srgb, var(--accent) 45%, white);
  border-right: 1px dashed color-mix(in srgb, var(--accent) 45%, white);
  opacity: 0.85;
  box-shadow: 0 1px 2px rgb(38 56 79 / 10%);
}

/* ------------------------------------------------------------------ *
 * Panels: a card with room to breathe. Used by both the home page and the
 * board, so it lives here rather than in the board's own stylesheet.
 * ------------------------------------------------------------------ */

.panel {
  padding: 26px 28px 24px;
  margin-bottom: 26px;
}

/* A quiet strip of a heading, for sections that label themselves. */
.panel__label {
  margin: 0 0 16px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pencil);
}

/* A heading with presence, for a panel that is the point of the page. */
.panel__title {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
}

@media (max-width: 620px) {
  .panel {
    padding: 22px 20px 20px;
  }
}

/* ------------------------------------------------------------------ *
 * Topic grid
 * ------------------------------------------------------------------ */

/* Flex rather than grid: with four topics an auto-fill grid left one card
   dangling on its own row. Here a full row still stretches edge to edge, and
   only an incomplete last row centres itself. */
.topic-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-grid > li {
  display: flex;
  flex: 1 1 236px;
  max-width: 330px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 26px 24px 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.topic-card:nth-child(even) {
  rotate: 0.35deg;
}

.topic-card:nth-child(odd) {
  rotate: -0.3deg;
}

.topic-card:hover,
.topic-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.topic-card__emoji {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}

.topic-card__name {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 0;
}

.topic-card__blurb {
  margin: 6px 0 0;
  font-family: var(--font-hand);
  font-size: 1.24rem;
  line-height: 1.3;
  color: var(--accent);
  flex: 1;
}

.progress-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--edge);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, white);
}

.dot.is-done {
  background: var(--accent);
  border-color: var(--accent);
}

.progress-dots__count {
  margin-left: auto;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pencil);
}

/* ------------------------------------------------------------------ *
 * Puzzle list
 * ------------------------------------------------------------------ */

.puzzle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.puzzle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.puzzle-row:hover,
.puzzle-row:focus-visible {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--edge));
  box-shadow: var(--shadow-soft);
}

.puzzle-row__mark {
  font-size: 1.1rem;
  color: var(--accent);
}

.puzzle-row__body {
  flex: 1;
  min-width: 0;
}

.puzzle-row__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 600;
}

.puzzle-row__meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--pencil);
}

.puzzle-row__state {
  font-size: 1.1rem;
  color: var(--correct);
  min-width: 1.3em;
  text-align: center;
}

.puzzle-row__state--resume {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ *
 * Vocabulary slips (post-game review)
 * ------------------------------------------------------------------ */

.vocab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.vocab {
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--highlight) 14%, white);
}

.vocab__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.vocab__word {
  font-family: var(--font-serif);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.vocab__ipa {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.vocab__pos {
  font-size: 0.74rem;
  font-style: italic;
  color: var(--pencil);
}

.vocab__meaning {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.vocab__example {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ *
 * Skeleton while the API answers
 * ------------------------------------------------------------------ */

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--edge) 40%, white) 30%,
    color-mix(in srgb, var(--edge) 70%, white) 50%,
    color-mix(in srgb, var(--edge) 40%, white) 70%
  );
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -20% 0;
  }
}

/* ------------------------------------------------------------------ *
 * How-to-play steps: three columns, so the card earns its width instead of
 * stretching one sentence across 130 characters.
 * ------------------------------------------------------------------ */

.how-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.how-steps__num {
  flex: none;
  font-family: var(--font-hand);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 0.9;
  color: var(--accent);
}

.how-steps p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.how-steps strong {
  color: var(--ink);
}

/* ------------------------------------------------------------------ *
 * Toast
 * ------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  translate: -50% 0;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.24s ease, toast-out 0.3s ease 2.4s forwards;
}

.toast--good {
  background: var(--correct);
}

.toast--bad {
  background: var(--wrong);
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: -50% 12px;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    translate: -50% 12px;
  }
}
