@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #EDE4D3;
  --card: #FBF6EC;
  --border: #D8C9AC;
  --ink: #2E2418;
  --muted: #6B5D48;
  --muted-light: #A6957A;
  --accent: #8B4423;
  --gold: #A6822E;
  --header-band: linear-gradient(90deg,#3B2E1F 0%,#5C4630 55%,#8B4423 100%);
  --date-bar: linear-gradient(90deg,#6B4A2A,#8B4423);
  --danger: #A13D2E;
  --moss: #6B7F4F;
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("background.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: brightness(0.9) sepia(0.15);
  opacity: 0.3;
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(139,68,35,0.05) 0px, rgba(139,68,35,0.05) 2px, transparent 2px, transparent 20px),
    repeating-linear-gradient(-45deg, rgba(139,68,35,0.05) 0px, rgba(139,68,35,0.05) 2px, transparent 2px, transparent 20px);
  z-index: -1;
  pointer-events: none;
}

.site-header {
  background: var(--header-band);
  padding: 26px 28px 16px;
  text-align: center;
  border-bottom: 4px solid var(--gold);
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.nav-band {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-link {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.03em;
}
.nav-link:hover { color: var(--accent); }
.nav-helpline { color: var(--danger); font-weight: 700; }
.nav-admin { margin-left: auto; }

.layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.layout-single { max-width: 640px; }
.layout-wide { max-width: 1200px; }

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 30px;
  box-shadow: 0 4px 14px rgba(46,36,24,0.1);
  text-align: center;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.eyebrow::before { content: "✦ "; }
.eyebrow::after { content: " ✦"; }

.info-card h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 32px;
  margin: 0 0 10px;
}

.info-card p {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 14px;
}

.tier-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.tier-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.mini-ball { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px;
  box-shadow: 0 4px 14px rgba(46,36,24,0.1);
}

.card h3 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 19px;
  margin: 0 0 14px;
}

.input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #FFFDF8;
  color: var(--ink);
  font-size: 13px;
  font-family: 'EB Garamond', Georgia, serif;
  margin-bottom: 8px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.field-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 3px;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  font-family: 'EB Garamond', Georgia, serif;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #FBF6EC; }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }

.btn-icon {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 15px;
  opacity: 0.6;
}
.btn-icon:hover { opacity: 1; }

.clear-link {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 8px;
}

.empty-state { text-align: center; padding: 36px 20px; color: var(--muted); }

.search-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.search-inline .input { width: auto; margin-bottom: 0; min-width: 180px; }

.hero-draw {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(46,36,24,0.14);
  position: relative;
  overflow: visible;
}
.hero-draw::before,
.hero-draw::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 13px;
  background-image: radial-gradient(circle, var(--bg) 6px, transparent 6.5px);
  background-size: 20px 20px;
  background-position: center;
  background-repeat: repeat-x;
}
.hero-draw::before { top: -8px; }
.hero-draw::after { bottom: -8px; }

.ribbon-badge {
  position: absolute;
  top: -14px;
  right: 18px;
  background: linear-gradient(135deg, #E4C77A, var(--gold));
  color: #2E2418;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 3px;
  box-shadow: 0 3px 8px rgba(46,36,24,0.35);
  transform: rotate(3deg);
}
.ribbon-badge::before,
.ribbon-badge::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 0;
  height: 0;
  border-style: solid;
}
.ribbon-badge::before {
  left: 0;
  border-width: 6px 6px 0 0;
  border-color: #7A5E1D transparent transparent transparent;
}
.ribbon-badge::after {
  right: 0;
  border-width: 6px 0 0 6px;
  border-color: #7A5E1D transparent transparent transparent;
}

.hero-draw .draw-date {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 27px;
  margin-bottom: 24px;
}

.seal-tier { margin-bottom: 24px; }
.seal-tier:last-child { margin-bottom: 0; }

.seal-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.seal-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.seal {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 19px;
  color: #FBF6EC;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  box-shadow:
    inset -5px -7px 9px rgba(0,0,0,0.4),
    inset 4px 5px 7px rgba(255,255,255,0.4),
    0 3px 6px rgba(46,36,24,0.35);
  border: 1px solid rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}
.seal::after {
  content: "";
  position: absolute;
  top: 14%;
  left: 20%;
  width: 32%;
  height: 22%;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  filter: blur(1.5px);
  transform: rotate(-25deg);
}

.seal-sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.countdown-strip {
  background: var(--header-band);
  color: #FBF6EC;
  border-radius: 6px;
  padding: 16px 20px;
  text-align: center;
}
.countdown-strip .eyebrow { color: #E4C77A; }
.countdown-strip .timer {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.03em;
}
.countdown-strip .sub { font-size: 12px; opacity: 0.75; margin-top: 4px; }

.section-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  text-align: center;
  margin: 0 0 4px;
  position: relative;
  padding-bottom: 12px;
}
.section-title::after {
  content: "❖";
  display: block;
  margin-top: 8px;
  color: var(--gold);
  font-size: 13px;
}

.card,
.hero-draw,
.notice-parchment,
.letter-body,
.charter-parchment,
.ledger,
.countdown-strip {
  outline: 1px solid var(--gold);
  outline-offset: 5px;
}
.section-sub {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ledger {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.ledger-entry {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.ledger-entry:last-child { border-bottom: none; }

.ledger-date {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 12px;
}

.ledger-tier { margin-bottom: 12px; }
.ledger-tier:last-child { margin-bottom: 0; }

.ledger-tier-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.see-all-link {
  display: block;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 0 2px;
}
.see-all-link:hover { text-decoration: underline; }

.login-card { max-width: 380px; margin: 40px auto 0; text-align: center; }
.lock-icon { font-size: 24px; margin-bottom: 8px; }
.login-card h2 { font-family: 'Cinzel', serif; font-weight: 700; font-size: 19px; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.muted code { font-family: 'IBM Plex Mono', monospace; color: var(--accent); }

.error-text { color: var(--danger); font-size: 13px; margin: 8px 0; }
.success-text { color: var(--moss); font-size: 13px; margin: 8px 0; }

.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.draws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.draws-table th {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}
.draws-table th:last-child { text-align: center; }
.draws-table td {
  padding: 12px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.draws-table td:first-child { font-weight: 600; white-space: nowrap; }
.draws-table td:last-child { text-align: center; white-space: nowrap; }
.draws-table tbody tr:nth-child(even) { background: var(--bg); }
.number-pill-row { display: flex; flex-wrap: nowrap; gap: 4px; }
.number-pill {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}

.helpline-card {
  background: linear-gradient(150deg,#F3E3C8,#EAD7D2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 28px;
  scroll-margin-top: 24px;
}
.helpline-card h2 { margin-top: 0; font-family: 'Cinzel', serif; font-size: 18px; }
.helpline-number {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 23px;
  color: var(--accent);
  margin: 6px 0;
}

.terms-wrap { max-width: 760px; margin: 0 auto; padding: 30px 24px 60px; }
.terms-wrap h1 { font-family: 'Cinzel', serif; font-weight: 700; font-size: 28px; margin: 0 0 6px; }
.terms-wrap .updated { font-size: 12.5px; color: var(--muted); margin-bottom: 28px; }
.terms-section { margin-bottom: 26px; scroll-margin-top: 24px; }
.terms-section h2 { font-family: 'Cinzel', serif; font-weight: 700; font-size: 18px; margin: 0 0 10px; }
.terms-section p, .terms-section li { font-size: 14px; line-height: 1.65; color: var(--muted); }
.terms-section ul { margin: 8px 0; padding-left: 20px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  font-size: 11px;
  color: var(--muted-light);
  font-family: 'IBM Plex Mono', monospace;
  text-align: center;
}

.site-footer-rich { margin-top: 10px; }

.footer-top {
  background: var(--header-band);
  border-top: 4px solid var(--gold);
  padding: 28px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer-logo { height: 52px; width: auto; }

.footer-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav-link {
  color: #FBF6EC;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
  opacity: 0.85;
}
.footer-nav-link:hover { opacity: 1; }
.footer-nav-helpline { color: #E9A98B; font-weight: 700; opacity: 1; }

.footer-columns {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-col { max-width: 340px; text-align: center; }
.footer-col h4 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--ink);
}
.footer-col p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 12px;
}

.footer-bottom {
  background: var(--bg);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 14px 24px;
  font-size: 11px;
  color: var(--muted-light);
  font-family: 'IBM Plex Mono', monospace;
}

@media (max-width: 640px) {
  .info-card h1 { font-size: 26px; }
  .hero-draw .draw-date { font-size: 22px; }
  .seal { width: 40px; height: 40px; font-size: 16px; }
}

.notice-board {
  max-width: 620px;
  margin: 34px auto 60px;
  padding: 0 24px;
}
.notice-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #E4C77A, #7A5E1D 100%);
  margin: 0 auto -7px;
  position: relative;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
.notice-parchment {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 42px 38px 34px;
  text-align: center;
  transform: rotate(-0.5deg);
  box-shadow: 0 10px 24px rgba(46,36,24,0.16);
}
.notice-parchment h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 28px;
  margin: 0 0 14px;
}
.schedule-list {
  text-align: left;
  margin-top: 26px;
  border-top: 1px dashed var(--border);
}
.schedule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px dashed var(--border);
}
.schedule-row-label {
  font-weight: 600;
  font-size: 13.5px;
  flex: 1;
}
.schedule-note {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.03em;
}

.letter-panel {
  max-width: 540px;
  margin: 56px auto 60px;
  padding: 0 24px;
}
.letter-body {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 48px 40px 36px;
  position: relative;
  text-align: center;
  box-shadow: 0 10px 24px rgba(46,36,24,0.16);
}
.wax-seal {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, var(--accent), #5C2E15 100%);
  color: #FBF6EC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  position: absolute;
  top: -29px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.25), inset 0 -4px 6px rgba(0,0,0,0.3), 0 3px 8px rgba(0,0,0,0.3);
}
.letter-greeting {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 16px 0 10px;
}
.letter-body h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 25px;
  margin: 0 0 12px;
}
.letter-signoff {
  text-align: center;
  font-style: italic;
  color: var(--muted-light);
  margin-top: 22px;
  font-size: 12.5px;
}

.charter {
  max-width: 760px;
  margin: 30px auto 60px;
  padding: 0 24px;
}
.charter-parchment {
  background: var(--card);
  padding: 44px 46px;
  position: relative;
  box-shadow: 0 8px 22px rgba(46,36,24,0.12);
}
.charter-parchment::before,
.charter-parchment::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  background-image:
    linear-gradient(135deg, var(--bg) 50%, transparent 50%),
    linear-gradient(225deg, var(--bg) 50%, transparent 50%);
  background-size: 18px 18px;
  background-repeat: repeat-x;
  background-position: bottom left;
}
.charter-parchment::before { top: -11px; }
.charter-parchment::after { bottom: -11px; transform: rotate(180deg); }
.charter h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 26px;
  text-align: center;
  margin: 0 0 4px;
}
.charter .updated {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 32px;
}
.charter-clauses { counter-reset: clause; }
.charter-clause {
  counter-increment: clause;
  margin-bottom: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
}
.charter-clause:first-of-type { border-top: none; padding-top: 0; }
.charter-clause h2 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.charter-clause h2::before {
  content: counter(clause, upper-roman);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.decree-box {
  background: linear-gradient(150deg,#F3E3C8,#EAD7D2);
  border: 1px solid var(--gold);
  padding: 26px;
  text-align: center;
  margin-bottom: 34px;
  scroll-margin-top: 24px;
}
.decree-crest {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, var(--gold), #7A5E1D 100%);
  margin: 0 auto 12px;
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.3), inset 0 -3px 5px rgba(0,0,0,0.3);
}
.decree-box h2 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  margin: 0 0 8px;
}