/* ===== Cryptic Conclave — site-wide achievements page =====
   Paired with /js/achievements-page.js. Follows the minigame conventions:
   cyan #00cccc/#00ffff chrome on near-black, the #lbTable bordered-grid look
   for the boards, and the full /images/cursors stack on anything clickable —
   a bare `cursor: pointer` would silently kill the site's skeleton hand. */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.subtitle {
  max-width: 680px;
  margin: 6px auto 24px;
  color: #9fdede;
  font-style: italic;
  font-size: 0.98rem;
}

/* --- Hero ---------------------------------------------------------------- */

.ach-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 28px 44px;
  max-width: 780px;
  margin: 0 auto 26px;
  padding: 22px 26px;
  border: 1px solid #007f7f;
  border-radius: 14px;
  background: rgba(9, 20, 24, 0.9);
}

.ach-hero-ring {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.ach-hero-ring svg { width: 100%; height: 100%; }

.ach-ring-track { stroke: #16333a; }

.ach-ring-fill {
  stroke: #00cccc;
  filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.5));
  transition: stroke-dashoffset 0.9s ease;
}

.ach-ring-fill.is-complete { stroke: #7ff9ff; }

.ach-hero-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 700;
  color: #7ff9ff;
  text-shadow: 0 0 16px rgba(0, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
}

.ach-hero-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 14px 32px;
}

.ach-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.ach-stat-k {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6fb7b7;
}

.ach-stat-v {
  font-size: 1.24rem;
  color: #e8fafa;
  font-variant-numeric: tabular-nums;
}

/* --- Controls ------------------------------------------------------------ */

.ach-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1140px;
  margin: 0 auto 18px;
}

.ach-filter { display: flex; gap: 8px; }

.ach-chip {
  padding: 8px 20px;
  border: 1px solid #007f7f;
  border-radius: 999px;
  background: rgba(10, 22, 26, 0.9);
  color: #9fdede;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-chip:hover { border-color: #00cccc; color: #e8fafa; }

.ach-chip.is-active {
  border-color: #00ffff;
  color: #00ffff;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.25);
}

.ach-search input {
  min-width: 240px;
  font-family: inherit;
  font-size: 0.92rem;
  border-radius: 999px;
  border: 1px solid #007f7f;
  background: #0f1d21;
  color: #e8fafa;
  padding: 8px 16px;
}

.ach-search input:focus-visible,
.ach-identity-row input:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 1px;
}

/* --- Section title -------------------------------------------------------- */

.ach-section-title {
  margin: 30px 0 14px;
  color: #00dede;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

/* --- Game cards -----------------------------------------------------------
   One card per game instead of every achievement stacked down the page. The
   first version was several screens of scrolling and buried the boards at the
   bottom; the full list now opens in a modal. */

.ach-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  max-width: 1140px;
  margin: 0 auto;
}

.ach-loading {
  grid-column: 1 / -1;
  color: #6b8688;
  font-style: italic;
  padding: 28px 0;
}

.ach-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 16px;
  border: 1px solid #1d4147;
  border-radius: 12px;
  background: rgba(9, 18, 21, 0.8);
  color: inherit;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-card:hover {
  border-color: #00cccc;
  background: rgba(15, 34, 40, 0.95);
  transform: translateY(-2px);
}

.ach-card:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 2px;
}

.ach-card.is-complete {
  border-color: #00cccc;
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.16);
}

.ach-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ach-card-name {
  font-size: 1.02rem;
  color: #00dede;
}

.ach-card.is-complete .ach-card-name { color: #7ff9ff; }

.ach-complete-mark {
  color: #7ff9ff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.ach-card-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: #12262b;
  overflow: hidden;
}

.ach-card-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #007f7f, #00ffff);
  transition: width 0.6s ease;
}

.ach-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ach-card-count {
  font-size: 0.9rem;
  color: #9fdede;
  font-variant-numeric: tabular-nums;
}

.ach-card-matches {
  font-size: 0.76rem;
  color: #6b8688;
}

/* --- Achievement tiles (used inside the modal) ---------------------------- */

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.ach-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid #16333a;
  border-radius: 9px;
  background: rgba(9, 18, 21, 0.75);
  opacity: 0.5;
  text-align: left;
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ach-item.is-earned {
  opacity: 1;
  border-color: #00cccc;
  background: rgba(11, 27, 31, 0.95);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.12);
}

.ach-item-name { font-size: 0.92rem; color: #9fdede; }
.ach-item.is-earned .ach-item-name { color: #7ff9ff; }

.ach-item-desc {
  font-size: 0.76rem;
  color: #6b8688;
  line-height: 1.35;
}

/* --- Per-game modal -------------------------------------------------------- */

.ach-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 8, 10, 0.85);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ach-modal.is-open { opacity: 1; }

/* [hidden] is only display:none in the UA stylesheet, and the rule above sets
   display:flex, which outranks it. Without this the modal would sit open. */
.ach-modal[hidden] { display: none; }

.ach-modal-dialog {
  width: min(760px, 100%);
  max-height: min(82vh, 800px);
  display: flex;
  flex-direction: column;
  border: 1px solid #00cccc;
  border-radius: 14px;
  background: linear-gradient(180deg, #0b171b 0%, #060d0f 100%);
  box-shadow: 0 0 46px rgba(0, 255, 255, 0.22);
  transform: translateY(10px);
  transition: transform 0.18s ease;
}

.ach-modal.is-open .ach-modal-dialog { transform: translateY(0); }

.ach-modal-dialog:focus { outline: none; }

.ach-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #1d4147;
}

.ach-modal-title {
  margin: 0;
  flex: 1;
  color: #00dddd;
  font-size: 1.24rem;
  text-align: left;
}

.ach-modal-count {
  font-size: 0.94rem;
  color: #7ff9ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ach-modal-x {
  border: 0;
  background: none;
  color: #6fb7b7;
  font-size: 1.7rem;
  line-height: 1;
  padding: 0 4px;
  font-family: inherit;
  transition: color 0.15s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-modal-x:hover { color: #00ffff; }

.ach-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #00807f rgba(10, 22, 26, 0.6);
}

.ach-modal-body::-webkit-scrollbar { width: 9px; }
.ach-modal-body::-webkit-scrollbar-track { background: rgba(10, 22, 26, 0.6); border-radius: 999px; }
.ach-modal-body::-webkit-scrollbar-thumb { background: #00807f; border-radius: 999px; }

.ach-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid #1d4147;
}

a.ach-ghost { text-decoration: none; display: inline-flex; align-items: center; }

/* --- Divider and boards --------------------------------------------------- */

.ach-divider {
  max-width: 860px;
  height: 1px;
  margin: 38px auto 0;
  border: 0;
  background: linear-gradient(90deg,
    transparent 0%, rgba(0, 204, 204, 0.55) 18%,
    rgba(0, 204, 204, 0.55) 82%, transparent 100%);
}

.leaderboard.ach-board {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 0 0;
  text-align: center;
}

.leaderboard.ach-board h2 {
  margin: 14px 0 12px;
  color: #00dede;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.ach-board-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ach-board-tab {
  padding: 8px 20px;
  border: 1px solid #007f7f;
  border-radius: 999px;
  background: rgba(10, 22, 26, 0.9);
  color: #9fdede;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-board-tab:hover { border-color: #00cccc; color: #e8fafa; }

.ach-board-tab.is-active {
  border-color: #00ffff;
  color: #00ffff;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.25);
}

.ach-board-blurb {
  margin: 0 auto 16px;
  max-width: 620px;
  font-size: 0.88rem;
  color: #9fdede;
}

/* Same #lbTable treatment as Cryptdoku and Bone Furnace. */
#lbTable {
  width: 100%;
  border-collapse: collapse;
  background: rgba(5, 17, 22, 0.86);
  border: 1px solid #008b8b;
  margin-bottom: 16px;
}

#lbTable th,
#lbTable td {
  border: 1px solid rgba(0, 139, 139, 0.75);
  padding: 8px 10px;
  font-size: 0.92rem;
  text-align: left;
}

#lbTable th {
  background: rgba(0, 204, 204, 0.14);
  color: #aefefe;
  letter-spacing: 0.06em;
}

#lbTable td { color: #cfeaea; font-variant-numeric: tabular-nums; }

#lbTable th:first-child,
#lbTable td:first-child { width: 3rem; text-align: center; }

#lbTable td:first-child { color: #4f7d80; }

#lbTable tr.is-you td {
  color: #7ff9ff;
  background: rgba(0, 255, 255, 0.07);
}

#lbTable .empty-cell {
  color: #8fc8c8;
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

/* --- Identity ------------------------------------------------------------- */

.ach-identity {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid #1d4147;
  border-radius: 10px;
  background: rgba(9, 20, 24, 0.8);
  text-align: left;
}

.ach-identity-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7ff9ff;
  margin-bottom: 7px;
}

.ach-identity-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.ach-identity-row input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 0.92rem;
  border-radius: 8px;
  border: 1px solid #007f7f;
  background: #0f1d21;
  color: #e8fafa;
  padding: 8px 12px;
}

.ach-ghost {
  padding: 8px 20px;
  border: 1px solid #007f7f;
  border-radius: 8px;
  background: rgba(10, 22, 26, 0.9);
  color: #9fdede;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, color 0.15s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-ghost:hover { border-color: #00cccc; color: #e8fafa; }

.ach-note {
  margin: 0;
  font-size: 0.8rem;
  color: #6b8688;
  line-height: 1.45;
}

/* --- Narrow screens ------------------------------------------------------- */

@media (max-width: 620px) {
  .ach-hero { gap: 20px; }
  .ach-hero-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
  .ach-controls { flex-direction: column; align-items: stretch; }
  .ach-search input { width: 100%; }
  .ach-game-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .ach-ring-fill,
  .ach-game-bar span { transition: none; }
}

/* --- Board pagination ------------------------------------------------------
   The board holds up to 100 keepers; showing ten at a time keeps it from
   becoming the endless list the catalogue used to be. */

.ach-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 16px;
}

.ach-pager[hidden] { display: none; }

.ach-page-btn {
  padding: 7px 18px;
  border: 1px solid #007f7f;
  border-radius: 999px;
  background: rgba(10, 22, 26, 0.9);
  color: #9fdede;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, color 0.15s ease;
  cursor:
    url('/images/cursors/hover.cur') 11 0,
    url('/images/cursors/hover.png') 11 0,
    pointer;
}

.ach-page-btn:hover:not(:disabled) { border-color: #00cccc; color: #e8fafa; }

.ach-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ach-page-btn:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 3px;
}

.ach-page-status {
  font-size: 0.88rem;
  color: #6fb7b7;
  font-variant-numeric: tabular-nums;
}
