:root {
  --ink: #08110d;
  --panel: #0e1913;
  --bone: #e4e8d9;
  --muted: #99a795;
  --green: #a6ffd0;
  --green-dim: #57bd8c;
  --line: rgba(166, 255, 208, .19);
  --font-display: "Cinzel", Georgia, serif;
  --font-mono: "Share Tech Mono", monospace;
}

body {
  color: var(--bone);
  background:
    radial-gradient(ellipse at 50% 8%, rgba(31, 92, 60, .2), transparent 45%),
    radial-gradient(rgba(166,255,208,.035) .7px, transparent .7px),
    var(--ink);
  background-size: auto, 5px 5px, auto;
  font-family: var(--font-display), system-ui, sans-serif;
  
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.brand-glyph { font-size: 2.65rem; }

.brand strong, .brand small { display: block; }
.brand strong { font: 1rem "IM Fell English SC", Georgia, serif; }
.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .16em;
}

.topbar nav { display: flex; gap: 22px; }
.topbar nav a {
  padding: 22px 0 18px;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .15em;
  text-decoration: none;
  text-transform: uppercase;
}
.topbar nav a.active, .topbar nav a:hover {
  color: var(--green);
  border-bottom: 1px solid var(--green);
}

.ritual-page {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.opening {
  padding: 62px 12px 36px;
  text-align: center;
}

.date-line {
  margin: 0 0 11px;
  color: var(--green);
  font-size: .67rem;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.opening h1 {
  margin: 0;
  color: var(--bone);
  font: clamp(2.5rem, 7vw, 4.4rem)/1.05 "IM Fell English SC", Georgia, serif;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.opening-copy {
  margin: 14px 0 0;
  color: #bdc8bb;
  font-size: .98rem;
}

.opening-copy em { color: var(--bone); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  min-height: 112px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(20,38,27,.88), rgba(9,18,13,.92));
}

.stat-card {
  display: grid;
  grid-template-rows: 1.5em 1fr 2em;
  justify-items: center;
  align-items: center;
  text-align: center;
}

.stat-number {
  align-self: center;
  margin: 0;
  font-size: 2.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  align-self: start;
  text-align: center;
}


.stat-label, .stat-foot { display: block; }
.stat-label {
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .19em;
  text-transform: uppercase;
}

.stat-number {
  display: block;
  margin: 5px 0 2px;
  color: var(--green);
  font: 2.4rem/1 "IM Fell English SC", Georgia, serif;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(83, 224, 151, .22);
}

.stat-number small {
  margin-left: 4px;
  font: .9rem "Source Sans 3", sans-serif;
}

.stat-foot {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.measure-card {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 30px 20px 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(13,29,20,.95), rgba(8,17,13,.96));
  text-align: center;
}

.measure-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(166,255,208,.07);
}

.measure-copy { position: relative; z-index: 1; }
.measure-copy h2, .section-heading h2 {
  margin: 0;
  color: var(--green);
  font: 1.55rem "IM Fell English SC", Georgia, serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.measure-copy > p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .08em;
}

.flask-stage {
  width: 180px;
  height: 250px;
  margin-top: 14px;
  filter: drop-shadow(0 0 16px rgba(87, 230, 151, .16));
}

.flask { width: 100%; height: 100%; overflow: visible; }
.flask-liquid {
  y: calc(100% - var(--fill, 0%));
  height: var(--fill, 0%);
  fill: url(#green-liquid);
  transition: y 1s ease, height 1s ease;
}
.flask-outline, .flask-rim, .flask-glint {
  fill: rgba(12, 25, 17, .35);
  stroke: rgba(201, 225, 194, .78);
  stroke-width: 2.2;
}
.flask-rim { fill: none; stroke-width: 4; }
.flask-glint {
  fill: none;
  stroke: rgba(221, 255, 226, .34);
  stroke-width: 1.2;
}
.flask-bubbles circle {
  fill: #c8ffdc;
  filter: url(#flame-glow);
  animation: rise 3s infinite ease-in;
}
.flask-bubbles circle:nth-child(2) { animation-delay: 1s; }
.flask-bubbles circle:nth-child(3) { animation-delay: 2s; }

@keyframes rise {
  from { transform: translateY(10px); opacity: .05; }
  25% { opacity: .8; }
  to { transform: translateY(-62px); opacity: 0; }
}

.leaderboard-section { padding-top: 34px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-heading .date-line { margin-bottom: 4px; }
.section-heading h2 { color: var(--bone); font-size: 1.8rem; }

.action-button {
  min-height: 40px;
  padding: 8px 15px;
  color: var(--ink);
  border: 1px solid var(--green);
  background: var(--green);
  font-weight: 700;
}
.action-button:hover { background: #c6ffe0; }
.action-button.button-blood {
  color: var(--green);
  border-color: var(--green-dim);
  background: transparent;
}
.action-button.button-blood:hover { background: rgba(87,189,140,.12); }

.leaderboard-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(12, 23, 16, .88);
}

.leaderboard-shell table { width: 100%; border-collapse: collapse; text-align: left; }
.leaderboard-shell th, .leaderboard-shell td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(166,255,208,.1);
}
.leaderboard-shell th {
  color: var(--muted);
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.leaderboard-shell tbody tr:last-child td { border-bottom: 0; }
.leaderboard-shell tbody tr:hover { background: rgba(166,255,208,.035); }

@media (max-width: 600px) {
  .opening { padding-top: 44px; }
  .stat-grid { gap: 7px; }
  .stat-card { min-height: 100px; padding: 12px 9px; }
  .stat-label { font-size: .55rem; letter-spacing: .1em; }
  .stat-foot { font-size: .58rem; }
  .stat-number { font-size: 2rem; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .leaderboard-shell th, .leaderboard-shell td { padding: 11px 9px; }
}
/* new stuff starts here */
#auth-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 28px;
  color: var(--bone);
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(31, 92, 60, .22), transparent 65%),
    linear-gradient(145deg, rgba(20, 38, 27, .98), rgba(8, 17, 13, .99));
  box-shadow: 0 20px 70px rgba(0, 0, 0, .65), 0 0 28px rgba(87, 230, 151, .08);
  font-family: var(--font-display), Georgia, serif;
}

#auth-dialog::backdrop {
  background: rgba(2, 7, 4, .78);
  backdrop-filter: blur(3px);
}

#auth-dialog h2 {
  margin: 0 0 20px;
  color: var(--green);
  font: 1.45rem "IM Fell English SC", Georgia, serif;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}

#auth-dialog > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

#auth-dialog button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--green);
  border: 1px solid var(--green-dim);
  background: rgba(8, 17, 13, .75);
  font: .68rem var(--font-mono), monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

#auth-dialog button:hover {
  color: var(--ink);
  border-color: var(--green);
  background: var(--green);
}

#auth-dialog button:focus-visible,
#auth-dialog input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

#auth-dialog form {
  display: grid;
  gap: 14px;
}

#auth-dialog form[hidden] {
  display: none;
}

#auth-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

#auth-dialog input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 9px 11px;
  color: var(--bone);
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(4, 11, 7, .8);
  font: .9rem var(--font-mono), monospace;
  letter-spacing: normal;
  text-transform: none;
}

#auth-dialog form button[type="submit"] {
  margin-top: 4px;
  color: var(--ink);
  border-color: var(--green);
  background: var(--green);
  font-weight: 700;
}

#auth-dialog form button[type="submit"]:hover {
  background: #c6ffe0;
}

#auth-message {
  min-height: 1.2em;
  margin: 16px 0 0;
  color: #ffb7a9;
  font: .8rem var(--font-mono), monospace;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 480px) {
  #auth-dialog {
    padding: 22px 18px;
  }

  #auth-dialog > div {
    gap: 6px;
  }

  #auth-dialog > div button {
    padding-inline: 9px;
    font-size: .62rem;
  }
}

#auth-dialog {
  position: relative;
}

#auth-dialog .dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font: 1.6rem/1 var(--font-mono), monospace;
  letter-spacing: 0;
}

#auth-dialog .dialog-close:hover {
  color: var(--green);
  border: 0;
  background: transparent;
}

/* progress dialogue styling starts here */
#progress-dialog {
  position: relative;
  width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  box-sizing: border-box;
  overflow-y: auto;
  padding: 28px;
  color: var(--bone);
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(31, 92, 60, .22), transparent 65%),
    linear-gradient(145deg, rgba(20, 38, 27, .98), rgba(8, 17, 13, .99));
  box-shadow:
    0 20px 70px rgba(0, 0, 0, .65),
    0 0 28px rgba(87, 230, 151, .08);
  font-family: var(--font-display), Georgia, serif;
}

#progress-dialog::backdrop {
  background: rgba(2, 7, 4, .78);
  backdrop-filter: blur(3px);
}

#progress-dialog h2 {
  margin: 0 0 10px;
  color: var(--green);
  font: 1.45rem "IM Fell English SC", Georgia, serif;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}

#progress-message {
  margin: 0 0 18px;
  color: var(--muted);
  font: .8rem var(--font-mono), monospace;
  line-height: 1.5;
  text-align: center;
}

#progress-form {
  display: grid;
  gap: 16px;
}

#story-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  width: 100%;
  max-height: min(55vh, 480px);
  box-sizing: border-box;
  overflow-y: auto;
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(4, 11, 7, .55);
}

#story-list label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 4px;
  color: var(--bone);
  border-bottom: 1px solid rgba(166, 255, 208, .08);
  font-size: .78rem;
  line-height: 1.45;
  cursor: pointer;
}

#story-list input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--green-dim);
  cursor: pointer;
}

#progress-dialog button {
  min-height: 40px;
  padding: 8px 14px;
  color: var(--green);
  border: 1px solid var(--green-dim);
  background: rgba(8, 17, 13, .75);
  font: .68rem var(--font-mono), monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

#progress-dialog button:hover {
  color: var(--ink);
  border-color: var(--green);
  background: var(--green);
}

#progress-form button[type="submit"] {
  justify-self: center;
  min-width: 180px;
  color: var(--ink);
  border-color: var(--green);
  background: var(--green);
  font-weight: 700;
}

#progress-form button[type="submit"]:hover {
  background: #c6ffe0;
}

#progress-dialog > button:first-child {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font: 1.6rem/1 var(--font-mono), monospace;
  letter-spacing: 0;
}

#progress-dialog > button:first-child:hover {
  color: var(--green);
  border: 0;
  background: transparent;
}

#progress-dialog button:focus-visible,
#story-list input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  #progress-dialog {
    padding: 24px 18px;
  }

  #story-list {
    grid-template-columns: 1fr;
    max-height: 58vh;
    padding-inline: 10px;
  }
}
/* progress dialogue styling ends here */