:root {
  --ink: #0e0e0d;
  --paper: #f3efe6;
  --paper-dim: #e7e0d1;
  --line: rgba(14, 14, 13, 0.14);
  --accent: #8a1f11;
  --muted: #6b665c;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.mono {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wrap {
  max-width: 560px;
  width: 100%;
  padding: 2.5rem;
  text-align: center;
}

.wordmark {
  font-size: 2.6rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.intro {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--paper-dim);
  max-width: 420px;
  margin: 0 auto 2.5rem;
}

.intro em {
  color: var(--paper);
  font-style: italic;
}

.app-body .intro {
  color: var(--muted);
}

.app-body .intro em {
  color: var(--ink);
}

.stage {
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1.4s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  animation: rise 0.6s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.9rem 1.4rem;
  border: 1px solid var(--paper);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.btn.primary {
  background: var(--paper);
  color: var(--ink);
}

.btn.primary:hover {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.fine {
  margin-top: 1.75rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.error {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #d98a7c;
  min-height: 1.2em;
}

/* Gated app page */
.app-body {
  background: var(--paper);
  color: var(--ink);
  align-items: flex-start;
  display: block;
  overflow-y: auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(243, 239, 230, 0.92);
  backdrop-filter: blur(8px);
}

.app-logo {
  font-style: italic;
  font-size: 1.4rem;
}

.member-tag {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}

.app-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.app-lede {
  text-align: center;
  max-width: 520px;
  margin: 0 auto 3rem;
}

.app-lede h1 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: 1rem;
}

.app-lede p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.98rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  border: 1px solid var(--line);
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.4);
}

.card .tag {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.card h2 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.logout {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 0.4rem;
}

@media (max-width: 600px) {
  .wordmark { font-size: 2rem; }
  .app-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}

/* Application form */
.question {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.question legend {
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.6rem;
  padding: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.text-answer {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

/* Admin roster */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.78rem;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}

.admin-table td:last-child, .admin-table th:last-child {
  white-space: normal;
  min-width: 260px;
}

.admin-table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

.admin-status {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
}

.admin-status-approved { color: #2e5c3a; border-color: #2e5c3a; }
.admin-status-pending_review { color: var(--accent); border-color: var(--accent); }
.admin-status-awaiting_application { color: var(--muted); }

.admin-due {
  color: var(--accent);
  font-size: 0.68rem;
}

.admin-answers {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-answers li {
  margin-bottom: 0.3rem;
}

.admin-q {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.admin-delete-btn {
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.admin-delete-btn:hover {
  background: var(--accent);
  color: var(--paper);
}
