/**
 * Shared completion panel primitives (`pd-c-*`).
 *
 * Games own their score copy and when to show sections; they opt into these
 * classes for a consistent look. Do not restyle from a game stylesheet —
 * extend here instead so spin-out copies stay coherent.
 *
 * Hierarchy: score → trophy → share → stats → utility (actions)
 * → try puzzles.
 */

.pd-complete-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  margin: 2px auto 20px;
  padding: 0 16px 12px;
  text-align: center;
  box-sizing: border-box;
  gap: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s var(--pd-ease-rise), transform 0.45s var(--pd-ease-rise);
  /* UI copy in Source Sans 3; score / stat figures stay Baloo below. */
  font-family: var(--pd-font-ui);
}

.pd-complete-panel.is-shown {
  opacity: 1;
  transform: none;
}

.pd-complete-panel[hidden] {
  display: none !important;
}

/* --- Results: score → trophy → share → stats ---------------------------- */

.pd-c-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
}

.pd-c-score {
  margin: 0 0 20px;
  font-family: var(--pd-font-body);
  font-size: clamp(26px, 7vw, 32px);
  font-weight: var(--pd-weight-black);
  line-height: 1.12;
  color: var(--pd-colour-text);
  letter-spacing: -0.01em;
}

.pd-c-rank {
  margin: 0 0 20px;
  font-family: var(--pd-font-ui);
  font-size: clamp(18px, 4.5vw, 20px);
  font-weight: var(--pd-weight-bold);
  line-height: 1.3;
  color: #616162; /* match .pd-c-try-label */
}

.pd-c-rank:empty {
  display: none;
}

.pd-c-share {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
}

.pd-c-share[hidden] {
  display: none !important;
}

.pd-c-share .pd-btn,
.pd-c-share .btn {
  margin: 0;
  flex: 0 0 auto;
  width: fit-content;
  min-width: 0;
}

.pd-c-share-btn,
button.pd-c-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  padding: 16px 28px;
  min-height: 52px;
  border: none;
  border-radius: var(--pd-radius-pill);
  background: var(--pd-colour-accent);
  color: #fff;
  font-family: var(--pd-font-ui);
  font-weight: var(--pd-weight-black);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  touch-action: manipulation;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
}

.pd-c-share-btn:active {
  transform: scale(0.98);
}

.pd-c-share-btn:focus,
.pd-c-share-btn:focus-visible {
  outline: none;
}

.pd-c-share-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

@media (hover: hover) and (pointer: fine) {
  .pd-c-share-btn:hover {
    background: var(--pd-colour-accent-hover);
  }
}

/* Shared section rhythm: equal gap + hairline before Stats / Try / Words */
.pd-c-stats,
.pd-c-try,
.pd-c-words,
.pd-c-feedback,
.pd-c-thanks,
.pd-c-articles {
  width: 100%;
  margin: 24px 0 0;
  padding-top: 24px;
  border-top: 1px solid color-mix(in srgb, var(--pd-colour-heading, #161613) 14%, transparent);
  box-sizing: border-box;
}

.pd-c-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-bottom: 8px;
}

.pd-c-thanks[hidden],
.pd-c-thanks:empty {
  display: none !important;
}

.pd-c-thanks-title {
  margin: 0;
  font-family: var(--pd-font-heading);
  font-size: clamp(20px, 5vw, 24px);
  font-weight: var(--pd-weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--pd-colour-heading, #161613);
}

.pd-c-thanks-copy {
  margin: 0;
  max-width: 22em;
  font-family: var(--pd-font-ui);
  font-size: 16px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.4;
  color: #616162;
}

.pd-c-feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.pd-c-feedback[hidden],
.pd-c-feedback:empty {
  display: none !important;
}

.pd-c-feedback-copy {
  margin: 0;
  max-width: 22em;
  font-family: var(--pd-font-ui);
  font-size: 16px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.4;
  color: #616162;
}

.pd-c-feedback-btn,
button.pd-c-feedback-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  border: 2px solid #2b2b2b;
  border-radius: 999px;
  background: #2b2b2b;
  color: #fff;
  font-family: var(--pd-font-ui);
  font-size: 16px;
  font-weight: var(--pd-weight-bold);
  cursor: pointer;
}

.pd-c-feedback-btn:active {
  transform: scale(0.98);
}

.pd-c-feedback-btn:focus,
.pd-c-feedback-btn:focus-visible {
  outline: none;
}

.pd-c-articles[hidden],
.pd-c-articles:empty {
  display: none !important;
}

.pd-c-articles .pd-c-try-label {
  margin-bottom: 12px;
}

.pd-c-try .pd-c-try-label,
.pd-c-words .pd-c-try-label {
  margin-bottom: 12px;
}

/* Three-up stats: value + label (other games) */
.pd-c-stats {
  text-align: center;
}

.pd-c-stats[hidden],
.pd-c-stats:empty {
  display: none !important;
}

.pd-c-stats--streak {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 24px;
}

.pd-c-streak {
  margin: 0;
  font-family: var(--pd-font-body); /* Baloo — streak is a score figure */
  font-size: clamp(26px, 7vw, 32px); /* matched to .pd-c-score; games may override both */
  font-weight: var(--pd-weight-black);
  line-height: 1.12;
  color: var(--pd-colour-text);
  letter-spacing: -0.01em;
}

.pd-c-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  padding: 4px 0 0;
  box-sizing: border-box;
  border: 0;
}

.pd-c-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 10px;
  border: 0;
}

.pd-c-stat-value {
  font-family: var(--pd-font-body); /* Baloo — stats numbers */
  font-size: clamp(32px, 7.5vw, 40px);
  font-weight: var(--pd-weight-black);
  line-height: 1.1;
  color: var(--pd-colour-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.pd-c-stat-label {
  font-family: var(--pd-font-ui);
  font-size: 13px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.2;
  color: #8a8a8b;
  letter-spacing: 0.01em;
  text-transform: none;
}

.pd-c-signin {
  margin: 0 0 14px;
  font-family: var(--pd-font-ui);
  font-size: 16px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: center;
  color: #616162;
}

.pd-c-signin-link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: var(--pd-weight-bold);
  color: var(--pd-colour-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pd-c-signin-link:hover {
  color: var(--pd-colour-accent-hover);
}

.pd-c-signin-link:focus,
.pd-c-signin-link:focus-visible {
  outline: none;
}

.pd-c-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin: 16px 0 0;
}

.pd-c-actions .pd-btn,
.pd-c-actions .btn {
  margin: 0;
  width: 100%;
  max-width: none;
}

.pd-c-action-secondary,
button.pd-c-action-secondary,
a.pd-c-action-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 12px 16px;
  min-height: 44px;
  width: 100%;
  border-radius: 12px;
  border: none;
  background: rgba(28, 28, 30, 0.06);
  color: #2c2c2e;
  font-family: var(--pd-font-ui);
  font-weight: var(--pd-weight-bold);
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.pd-c-action-secondary:active {
  transform: scale(0.98);
  background: rgba(28, 28, 30, 0.1);
}

.pd-c-action-secondary:focus,
.pd-c-action-secondary:focus-visible {
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .pd-c-action-secondary:hover {
    background: rgba(28, 28, 30, 0.1);
    color: var(--pd-colour-text);
  }
}

.pd-c-actions.is-single,
.pd-c-actions:has(> :only-child) {
  grid-template-columns: 1fr;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.pd-c-actions .pd-c-action-secondary[hidden] {
  display: none !important;
}

@media (max-width: 360px) {
  .pd-c-actions {
    grid-template-columns: 1fr;
  }

  .pd-c-actions.is-single,
  .pd-c-actions:has(> :only-child) {
    max-width: none;
  }
}

/* --- Try another puzzle ------------------------------------------------- */

.pd-c-try[hidden] {
  display: none !important;
}

.pd-c-try-label {
  margin: 0 0 10px;
  font-family: var(--pd-font-ui);
  font-size: 16px;
  font-weight: var(--pd-weight-bold);
  color: #616162;
  letter-spacing: 0.01em;
  text-align: center;
}

.pd-c-try-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 6px;
  width: 100%;
  align-items: start;
}

.pd-c-try-card,
a.pd-c-try-card,
button.pd-c-try-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 2px;
  min-height: 112px;
  text-decoration: none;
  color: var(--pd-colour-text);
  border-radius: 12px;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  box-sizing: border-box;
}

.pd-c-try-card:focus,
.pd-c-try-card:focus-visible {
  outline: none;
}

/* Equal wells; artwork fits inside with inset — never cropped */
.pd-c-try-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.pd-c-try-card img,
.pd-c-try-icon img {
  width: 100%;
  height: 100%;
  max-width: 56px;
  max-height: 56px;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  background: transparent;
}

.pd-c-try-name {
  display: block;
  width: 100%;
  min-height: 2.4em;
  font-family: var(--pd-font-heading); /* Baloo — game titles */
  font-size: 13px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.25;
  text-align: center;
  color: #3a3a3c;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (hover: hover) and (pointer: fine) {
  .pd-c-try-card:hover {
    background: rgba(0, 0, 0, 0.04);
  }
}

/* Today's words — inline under try grid */
.pd-c-words {
  text-align: left;
}

.pd-c-words[hidden] {
  display: none !important;
}

/* Word list */
.pd-c-word-list {
  width: 100%;
  text-align: left;
}

.pd-c-word-list.is-empty {
  padding: 8px 0 4px;
  font-family: var(--pd-font-ui);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #8a8a8b;
  text-align: center;
}

.pd-c-word-list .def-item {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 12px;
  margin: 0;
  padding: 11px 2px;
  border-bottom: 1px solid color-mix(in srgb, var(--pd-colour-heading, #161613) 10%, transparent);
}

/* 18 Words timed table: word | % | avg | yours */
.pd-c-word-list--timed .def-item {
  grid-template-columns: minmax(0, 1.4fr) 0.7fr 0.85fr 0.85fr;
  align-items: center;
  gap: 8px 10px;
}

.pd-c-word-list--timed .def-head {
  padding-top: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--pd-colour-heading, #161613) 16%, transparent);
}

.pd-c-word-list--timed .def-head span {
  font-family: var(--pd-font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8a8a8b;
  text-transform: uppercase;
}

.pd-c-word-list--timed .def-pct-col,
.pd-c-word-list--timed .def-avg-col,
.pd-c-word-list--timed .def-yours-col {
  font-family: var(--pd-font-ui);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: #8a8a8b;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: right;
}

.pd-c-word-list--timed .def-yours-col.is-fast {
  color: var(--pd-colour-accent, #2e9e5b);
}

.pd-c-word-list--timed .def-yours-col.is-mid {
  color: #c9852a;
}

.pd-c-word-list--timed .def-yours-col.is-slow {
  color: var(--pd-colour-danger, #f22f2c);
}

.pd-c-word-list--timed .def-item.missed .def-yours-col {
  color: #c0c0c2;
}

.pd-c-word-list .def-item:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.pd-c-word-list .def-num {
  font-family: var(--pd-font-ui);
  font-size: 12px;
  font-weight: var(--pd-weight-bold);
  line-height: 1.3;
  color: #b0b0b2;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding-top: 3px;
}

.pd-c-word-list .def-main {
  min-width: 0;
}

.pd-c-word-list .def-word {
  font-family: var(--pd-font-ui);
  font-weight: var(--pd-weight-black);
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--pd-colour-text);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pd-c-word-list .def-word.bonus {
  color: #c47a2c;
}

.pd-c-word-list .def-alt {
  display: inline-block;
  margin-left: 8px;
  font-weight: var(--pd-weight-bold);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #8a8a8b;
}

.pd-c-word-list .def-meta {
  margin: 3px 0 0;
  font-family: var(--pd-font-ui);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.3;
  color: #8a8a8b;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.pd-c-word-list .def-time {
  font-family: var(--pd-font-ui);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  color: #8a8a8b;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  flex: 0 0 auto;
  text-align: right;
  min-width: 3.2em;
  padding-top: 3px;
}

.pd-c-word-list .def-item.missed .def-word {
  color: #a8a8a8;
  font-weight: var(--pd-weight-bold);
}

.pd-c-word-list .def-item.missed .def-time,
.pd-c-word-list .def-item.missed .def-meta {
  color: #c0c0c2;
}

.pd-c-word-list .def-text {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #616162;
}

.pd-c-bonus-head,
.pd-c-word-list .c-bonus-head,
.pd-c-word-list .pd-c-bonus-head {
  margin: 18px 0 6px;
  font-family: var(--pd-font-ui);
  font-size: 13px;
  font-weight: var(--pd-weight-bold);
  color: #8a8a8b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

@media (max-width: 380px) {
  .pd-c-stats-row {
    padding: 14px 0;
  }

  .pd-c-stat {
    padding: 2px 6px;
  }

  .pd-c-stat-value {
    font-size: 30px;
  }

  .pd-c-stat-label {
    font-size: 12px;
  }

  .pd-c-try-grid {
    gap: 6px 4px;
  }

  .pd-c-try-icon {
    width: 60px;
    height: 60px;
    padding: 0;
  }

  .pd-c-try-card img,
  .pd-c-try-icon img {
    max-width: 50px;
    max-height: 50px;
  }

  .pd-c-try-card,
  a.pd-c-try-card,
  button.pd-c-try-card {
    min-height: 104px;
    padding: 6px 2px;
  }

  .pd-c-try-name {
    font-size: 12px;
  }

  .pd-c-action-secondary,
  button.pd-c-action-secondary,
  a.pd-c-action-secondary {
    font-size: 13px;
    padding: 11px 12px;
  }
}
