/* ==========================================================
   neur0doku-components.css

   Reusable UI pieces shared across 2+ neur0doku pages. Colors
   come from neur0doku-theme.css (--nd-*) exclusively — nothing
   here should hardcode a color.

   RULE OF THUMB: something belongs here once it's actually used
   on more than one page. A pattern that's only used by one page
   today (even if it *might* get reused later) stays in that
   page's own section of neur0doku-pages.css until a second page
   actually needs it — promote it here at that point, not before.

   LOAD ORDER: after neur0doku-theme.css, before
   neur0doku-modals.css and neur0doku-pages.css (or
   neur0doku-play.css on the Play page).
   ========================================================== */

/* ---------- icon button ----------
   Round/square icon-only button: back arrows, settings gear,
   guild badge slot. 2.75rem is the size currently in use by
   Home, Dailies, and Quests. Leaderboards/Play/Random use a
   smaller 2.5rem variant of the same idea — that becomes a
   .nd-icon-btn--sm modifier here once those pages migrate, so
   as not to declare a modifier with zero current callers. */
.nd-icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  box-shadow: 0 3px 8px var(--nd-shadow);
  cursor: pointer;
  font-size: 1.3rem;
  text-decoration: none;
  color: var(--nd-text);
  overflow: hidden;
}
.nd-icon-btn:hover { transform: translateY(-1px); text-decoration: none; }
.nd-icon-btn:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }
.nd-icon-btn img { width: 60%; height: 60%; object-fit: contain; pointer-events: none; }

/* Smaller variant — Leaderboards, Random, and Play all use 2.5rem
   instead of the 2.75rem default above. Inherits the 60%/contain
   img sizing above as-is. */
.nd-icon-btn--sm {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  font-size: 1.2rem;
}

/* ---------- split action row (large pill + small square button) ----------
   e.g. "Play" + Custom-puzzle icon, or "Quirk Café™" + Dailies icon. */
.nd-action-row {
  display: flex;
  gap: 0.6rem;
}

.nd-play-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.4rem;
  border-radius: 1.1rem;
  background: var(--nd-button-bg);
  border: 1px solid var(--nd-button-border);
  color: var(--nd-button-ink);
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: 0 4px 10px var(--nd-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.nd-play-btn:hover {
  background: var(--nd-button-bg-hover);
  transform: translateY(-1px);
  text-decoration: none;
}
.nd-play-btn:active { transform: translateY(0); }
.nd-play-btn:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }

.nd-side-btn {
  flex: 0 0 3.4rem;
  height: 3.4rem;
  border-radius: 1.1rem;
  background: var(--nd-button-bg);
  border: 1px solid var(--nd-button-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  text-decoration: none;
  box-shadow: 0 4px 10px var(--nd-shadow);
  color: var(--nd-button-ink);
  transition: transform 0.15s ease, background 0.15s ease;
}
.nd-side-btn:hover {
  background: var(--nd-button-bg-hover);
  transform: translateY(-1px);
  text-decoration: none;
}
.nd-side-btn img { width: 55%; height: 55%; object-fit: contain; pointer-events: none; }
.nd-side-btn:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .nd-icon-btn, .nd-play-btn, .nd-side-btn {
    transition: none;
  }
}

/* ---------- "picker" page shell ----------
   Back-button-only topbar + title + subtitle + a list of mode-cards
   + a footer note. Originally Dailies-only; promoted here now that
   Quirk Café reuses the whole shape (not just mode-card in
   isolation) via the SAME class names, including the outer
   .neur0doku-dailies wrapper. The class names still read as
   "dailies" for now — rename later if a third page adopts this
   shell and the name starts to feel wrong, but not worth a
   multi-file rename for two pages. */

.neur0doku-dailies {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nd-dailies-topbar {
  width: 100%;
  display: flex;
  margin-bottom: 1.25rem;
}

.nd-dailies-title {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--nd-accent);
  margin: 0 0 0.5rem;
  text-align: center;
}

.nd-dailies-subtitle {
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--nd-text-soft);
  max-width: 30ch;
  margin: 0 0 1.75rem;
}

.nd-mode-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nd-mode-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 1.1rem;
  background: var(--nd-button-bg);
  border: 1px solid var(--nd-button-border);
  color: var(--nd-button-ink);
  text-decoration: none;
  box-shadow: 0 4px 10px var(--nd-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.nd-mode-card:hover {
  background: var(--nd-button-bg-hover);
  transform: translateY(-1px);
  text-decoration: none;
}
.nd-mode-card:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }

.nd-mode-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--nd-surface);
  border-radius: 0.8rem;
}

.nd-mode-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.nd-mode-title {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.nd-mode-desc {
  font-size: 0.75rem;
  opacity: 0.75;
}

.nd-mode-chevron {
  flex-shrink: 0;
  font-size: 1.4rem;
  opacity: 0.55;
}

.nd-dailies-note {
  margin-top: 1.75rem;
  font-size: 0.75rem;
  color: var(--nd-text-soft);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .nd-mode-card {
    transition: none;
  }
}

/* ---------- account-style card + form row ----------
   Originally Account-only; promoted now that Custom Puzzle reuses
   it for its grid-size/difficulty pickers. */

.neur0doku-account {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.nd-account-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.nd-account-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--nd-border);
  box-shadow: 0 3px 8px var(--nd-shadow);
}
.nd-account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nd-account-header h1 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--nd-text);
}
.nd-account-header p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--nd-text-soft);
}

.nd-account-card {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 3px 8px var(--nd-shadow);
}
.nd-account-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  color: var(--nd-text);
}
.nd-account-card p.nd-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--nd-text-soft);
}

.nd-account-form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.nd-account-form-row select,
.nd-account-form-row input {
  flex: 1;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid var(--nd-border);
  background: var(--nd-bg);
  color: var(--nd-text);
  font-size: 0.9rem;
}
.nd-account-form-row button {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  border-radius: 0.6rem;
  border: 1px solid var(--nd-button-border);
  background: var(--nd-button-bg);
  color: var(--nd-button-ink);
  font-weight: 700;
  cursor: pointer;
}
.nd-account-form-row button:hover { background: var(--nd-button-bg-hover); }

/* ---------- titled topbar (back button + centered title + spacer) ----------
   Originally duplicated almost verbatim between Leaderboards
   (.nd-lb-topbar/.nd-lb-title/.nd-lb-topbar-spacer) and Random
   (.nd-rx-topbar/.nd-rx-title/.nd-rx-topbar-spacer) — same rules
   under different names. Consolidated to one set; Random's markup
   now uses these classes directly instead of its own copies. */

.neur0doku-leaderboards {
  max-width: 460px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.nd-lb-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.nd-lb-title {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--nd-accent);
  margin: 0;
  text-align: center;
  flex: 1;
}

/* Balances the back button so the title stays visually centered. */
.nd-lb-topbar-spacer { width: 2.5rem; flex-shrink: 0; }

/* ---------- snapshot notice ----------
   Used by both Leaderboards and Random. */
.nd-lb-snapshot-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--nd-text-soft);
  background: var(--nd-surface-soft);
  border: 1px solid var(--nd-border);
  border-radius: 0.7rem;
  padding: 0.5rem 0.7rem;
  margin-bottom: 1rem;
}
.nd-lb-snapshot-note .nd-lb-emoji { font-size: 0.95rem; }

/* ---------- standings list ----------
   Used by both Leaderboards and Random. */
.nd-lb-board {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: 1rem;
  box-shadow: 0 4px 12px var(--nd-shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

.nd-lb-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem;
}
.nd-lb-row + .nd-lb-row { border-top: 1px solid var(--nd-border); }

.nd-lb-row.is-you {
  background: color-mix(in srgb, var(--nd-accent) 10%, transparent 90%);
}

.nd-lb-rank {
  width: 1.75rem;
  flex-shrink: 0;
  text-align: center;
  font-weight: 800;
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--nd-text-soft);
}
.nd-lb-rank.gold { color: #c9971f; }
.nd-lb-rank.silver { color: #93a0ac; }
.nd-lb-rank.bronze { color: #b3702f; }

.nd-lb-avatar {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  border-radius: 0.6rem;
  background: var(--nd-bg);
  border: 1px solid var(--nd-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nd-lb-name-wrap {
  flex: 1;
  min-width: 0;
}
.nd-lb-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--nd-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nd-lb-name.you::after {
  content: "you";
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--nd-accent);
  border: 1px solid var(--nd-accent);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  vertical-align: middle;
}
.nd-lb-sub {
  font-size: 0.72rem;
  color: var(--nd-text-soft);
}

.nd-lb-score {
  flex-shrink: 0;
  text-align: right;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--nd-text);
}
.nd-lb-score .nd-lb-lives {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--nd-text-soft);
}

.nd-lb-ineligible-flag {
  flex-shrink: 0;
  font-size: 0.95rem;
}

.nd-lb-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--nd-text-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- archive panel (frozen "Yesterday" / "Last Week" / "Last Month") ----------
   Used by both Leaderboards and Random. */
.nd-lb-archive {
  background: var(--nd-surface-soft);
  border: 1px dashed var(--nd-border);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}
.nd-lb-archive summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--nd-text-soft);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nd-lb-archive summary::-webkit-details-marker { display: none; }
.nd-lb-archive summary .nd-lb-caret {
  transition: transform 0.15s ease;
  font-size: 0.75rem;
}
.nd-lb-archive[open] summary .nd-lb-caret { transform: rotate(90deg); }

.nd-lb-archive-list {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.nd-lb-archive-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--nd-text-soft);
}
.nd-lb-archive-row .nd-lb-badge { font-size: 1rem; }
.nd-lb-archive-row .nd-lb-archive-name { flex: 1; color: var(--nd-text); font-weight: 600; }