/* ===========================================================================
 *  Scripturedle — styled to match "The Bible Challenge" stained-glass theme.
 * ===========================================================================*/

:root {
  --bg:        #100818;
  --panel:     rgba(29, 15, 39, 0.94);
  --panel-lt:  rgba(58, 25, 69, 0.88);
  --blue:      #3268c8;
  --cyan:      #8dd8e8;
  --gold:      #ffc943;
  --gold-2:    #ff9d1c;
  --ruby:      #a82f54;
  --emerald:   #258471;
  --violet:    #7447a8;
  --lead:      #170f1b;
  --white:     #fff9ec;
  --muted:     #c9b9c9;

  --match:       #26d980;  /* green — value matches the answer */
  --match-ink:   #03170d;
  --nomatch:     #ff496a;  /* red   — value does not match     */
  --nomatch-ink: #21040a;

  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(118, 72, 132, 0.16), transparent 52%),
    linear-gradient(160deg, #211327 0%, var(--bg) 58%, #09070c 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(4, 3, 7, 0.34) 100%);
}

.hidden { display: none !important; }

/* ---- Header --------------------------------------------------------------- */

header.site {
  text-align: center;
  padding: 34px 16px 6px;
  position: relative;
  z-index: 1;
}
header.site h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff7c7, var(--gold) 55%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 24px rgba(255, 201, 67, 0.12);
}
header.site p.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  letter-spacing: 0.04em;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 40px) 24px;
  position: relative;
  /* Above the footer (z-index 1) so the search dropdown is never overlapped
     by the footer hint text, which comes later in the DOM. */
  z-index: 2;
}

#landing > p {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

/* ---- Landing cards -------------------------------------------------------- */

.quiz-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin-top: 20px;
}

.quiz-card {
  flex: 0 1 320px;
  max-width: 380px;
  font: inherit;
  color: var(--white);
  text-align: left;
  cursor: pointer;
  padding: 26px 24px 22px;
  border: 3px solid var(--lead);
  border-radius: 64px 64px 18px 18px;      /* arched "stained-glass" top */
  background:
    linear-gradient(120deg, rgba(168, 47, 84, 0.16), transparent 34%),
    linear-gradient(300deg, rgba(50, 104, 200, 0.16), transparent 36%),
    linear-gradient(180deg, var(--panel-lt), var(--panel));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(244, 199, 98, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.quiz-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(244, 199, 98, 0.5),
              0 0 34px rgba(255, 201, 67, 0.14);
}
.quiz-card h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--gold);
}
.quiz-card p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}
.quiz-card .count {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}

/* ---- Game bar & buttons --------------------------------------------------- */

.game-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.game-bar h2 {
  margin: 0;
  flex: 1 1 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--white);
}

button.btn {
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--muted);
  padding: 11px 18px;
  border: 1px solid rgba(168, 178, 219, 0.24);
  border-radius: 999px;
  background: rgba(32, 16, 40, 0.82);
  transition: 180ms ease;
}
button.btn:hover {
  color: var(--white);
  border-color: rgba(84, 220, 255, 0.5);
}
button.btn.primary {
  color: #171006;
  font-weight: 900;
  text-transform: uppercase;
  border: 0;
  background: linear-gradient(135deg, #fff1a8, var(--gold) 48%, var(--gold-2));
  box-shadow: 0 8px 32px rgba(255, 174, 31, 0.3);
}
button.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 38px rgba(255, 174, 31, 0.42);
}
button.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- Searchable select ---------------------------------------------------- */

.guess-area {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.search-select {
  position: relative;
  flex: 1 1 auto;
  max-width: 460px;
}
.search-select input {
  width: 100%;
  font: inherit;
  color: var(--white);
  padding: 13px 18px;
  border: 3px solid var(--lead);
  border-radius: 16px;
  background:
    linear-gradient(120deg, rgba(168, 47, 84, 0.18), transparent 34%),
    rgba(40, 20, 49, 0.97);
  box-shadow: inset 0 0 0 1px rgba(244, 199, 98, 0.24);
}
.search-select input::placeholder { color: rgba(201, 185, 201, 0.7); }
.search-select input:focus {
  outline: none;
  border-color: var(--gold);
}
.search-select input:disabled { opacity: 0.6; }

.options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid rgba(244, 199, 98, 0.3);
  border-radius: 14px;
  background: #24142d;
  box-shadow: var(--shadow);
}
.options .option {
  padding: 11px 16px;
  cursor: pointer;
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.options .option:last-child { border-bottom: 0; }
.options .option:hover,
.options .option.active {
  background: linear-gradient(120deg, rgba(116, 71, 168, 0.55), rgba(50, 104, 200, 0.4));
  color: var(--white);
}
.options .option.disabled {
  color: var(--muted);
  text-decoration: line-through;
  cursor: not-allowed;
  opacity: 0.6;
}
.options .empty {
  padding: 11px 16px;
  color: var(--muted);
}

.attempts {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---- Guess table ---------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  /* Break out of main's max-width so the wide clue table can use the full
     window; horizontal scrolling only kicks in when the window is too narrow. */
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 clamp(16px, 3vw, 40px);
}

table.guesses {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 8px;
}
table.guesses th {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 4px;
  white-space: nowrap;
}
table.guesses td {
  text-align: center;
  padding: 14px 12px;
  border: 3px solid var(--lead);
  border-radius: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--white);
  background:
    linear-gradient(120deg, rgba(168, 47, 84, 0.2), transparent 32%),
    rgba(40, 20, 49, 0.97);
  box-shadow: inset 0 0 0 1px rgba(244, 199, 98, 0.2);
}
table.guesses td.name-cell {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  background:
    linear-gradient(135deg, rgba(116, 71, 168, 0.5), rgba(50, 104, 200, 0.4)),
    rgba(30, 16, 40, 0.97);
}
table.guesses td.match {
  color: var(--match-ink);
  border-color: #b3ffdc;
  background: linear-gradient(135deg, #7ff2ba, var(--match));
  box-shadow: none;
}
table.guesses td.nomatch {
  color: var(--nomatch-ink);
  border-color: #ffb1bf;
  background: linear-gradient(135deg, #ff879d, var(--nomatch));
  box-shadow: none;
}
td .hint { font-weight: 900; margin-left: 5px; }

@keyframes pop {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
table.guesses tbody tr { animation: pop 0.2s ease; }

/* ---- Answer banner -------------------------------------------------------- */

.answer-banner {
  margin-top: 18px;
  padding: 18px 20px;
  text-align: center;
  border: 1px solid rgba(255, 201, 67, 0.45);
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(244, 199, 98, 0.18), transparent 40%),
    linear-gradient(135deg, rgba(168, 47, 84, 0.2), transparent 45%),
    #24142d;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  color: var(--muted);
  font-size: 1.05rem;
}
.answer-banner strong {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(20px);
  padding: 15px 26px;
  border-radius: 999px;
  color: var(--match-ink);
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #7ff2ba, var(--match));
  box-shadow: 0 12px 40px rgba(38, 217, 128, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

footer.site {
  position: relative;
  z-index: 1;
  text-align: center;
  color: rgba(201, 185, 201, 0.7);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 26px 16px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
