/* ===== Cryptic Conclave — shared minigame achievements =====
   Paired with /js/cc-achievements.js. Matches the How to Play and bug reporter
   widgets so all three read as one set.

   CURSORS: never write a bare `cursor: pointer` here. It would override the
   site's skeleton-hand cursor, set on `button` in cryptic.css. Always use the
   full url() stack below. */

.cc-ach-bar {
  display: flex;
  justify-content: center;
  margin: 14px 0 4px;
}

.cc-ach-trigger,
.cc-ach-done {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: 1px solid #00cccc;
  border-radius: 999px;
  background: rgba(10, 22, 26, 0.92);
  color: #9fdede;
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: color 0.15s ease, border-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;
}

.cc-ach-trigger::before {
  content: '★';
  font-size: 0.9rem;
  line-height: 1;
}

.cc-ach-trigger:hover,
.cc-ach-done:hover {
  color: #00ffff;
  border-color: #00ffff;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.28);
}

/* Everything unlocked. */
.cc-ach-trigger.has-all {
  color: #7ff9ff;
  border-color: #7ff9ff;
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.35);
}

.cc-ach-trigger:focus-visible,
.cc-ach-done:focus-visible,
.cc-ach-x:focus-visible {
  outline: 2px solid #00ffff;
  outline-offset: 3px;
}

/* --- Modal --------------------------------------------------------------- */

.cc-ach-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;   /* level with How to Play, below the bug reporter's modal */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 8, 10, 0.82);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.cc-ach-overlay.is-open { opacity: 1; }

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

.cc-ach-dialog {
  width: min(720px, 100%);
  max-height: min(80vh, 760px);
  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;
}

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

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

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

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

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

.cc-ach-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;
}

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

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

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

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

.cc-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;
}

.cc-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);
}

.cc-ach-item-name {
  font-size: 0.92rem;
  color: #9fdede;
}

.cc-ach-item.is-earned .cc-ach-item-name { color: #7ff9ff; }

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

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

.cc-ach-note {
  margin: 0;
  font-size: 0.78rem;
  color: #6b8688;
  text-align: left;
}

/* --- Unlock toast -------------------------------------------------------- */

.cc-ach-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: min(440px, 88vw);
  padding: 11px 20px;
  border: 1px solid #00ffff;
  border-radius: 9px;
  background: rgba(6, 16, 19, 0.97);
  box-shadow: 0 0 24px rgba(0, 255, 255, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 10000;
}

.cc-ach-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cc-ach-toast-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6fb7b7;
}

.cc-ach-toast-name {
  font-size: 1rem;
  color: #7ff9ff;
}

@media (max-width: 520px) {
  .cc-ach-dialog { max-height: 86vh; }
  .cc-ach-foot { flex-direction: column; align-items: stretch; }
  .cc-ach-note { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-ach-overlay,
  .cc-ach-dialog,
  .cc-ach-toast { transition: none; }
}
