:root {
  --ink: #2b2320;
  --ink-soft: #5c5049;
  --paper: #fdf9ef;
  --paper-edge: #e9dfc9;
  --accent: #a8492d;
  --accent-dark: #7f3620;
  --accent-soft: #f1e2d3;
  --good: #3f7d4f;
  --good-bg: #e6f2e8;
  --bad: #b23a3a;
  --bad-bg: #fbe9e9;
  --bg-top: #f3ece0;
  --bg-bottom: #e7dcc7;
  --shadow: 0 6px 16px rgba(60, 40, 20, 0.14);
  --radius: 14px;
  font-size: 17px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  min-height: 100vh;
  background-attachment: fixed;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  margin: 0 0 6px;
}

.header h1 {
  font-size: 2rem;
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.15;
}

.passage-tag {
  display: inline-block;
  margin: 0;
  padding: 4px 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* Instructions */
.instructions {
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
}

.instructions__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  padding: 14px 18px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

.instructions__toggle .chev {
  transition: transform 0.2s ease;
  color: var(--accent-dark);
  flex-shrink: 0;
}

.instructions__toggle[aria-expanded="false"] .chev {
  transform: rotate(-90deg);
}

.instructions__body {
  padding: 0 20px 18px 20px;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.instructions__body[hidden] { display: none; }

.instructions__body ol {
  margin: 0;
  padding-left: 1.2em;
}

.instructions__body li + li { margin-top: 6px; }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.team-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.team-name label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}

.team-name input {
  font: inherit;
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1rem;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
  min-width: 220px;
  color: var(--ink);
}

.team-name input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toolbar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(168, 73, 45, 0.35);
}
.btn--primary:hover { background: var(--accent-dark); }

.btn--outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent-dark);
}
.btn--outline:hover { background: var(--accent-soft); }

.btn--ghost {
  background: rgba(255,255,255,0.6);
  border-color: var(--paper-edge);
  color: var(--ink-soft);
}
.btn--ghost:hover { background: #fff; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Status */
.status {
  text-align: center;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 1.4em;
  margin: 4px 0 18px;
}

.status.status--good { color: var(--good); font-weight: 700; }
.status.status--info { color: var(--accent-dark); font-weight: 600; }

/* Strip list */
.strip-list {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  position: relative;
}

.strip {
  --rot: 0deg;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  transform: rotate(var(--rot));
  touch-action: pan-y;
}

.strip.dragging {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 50;
  box-shadow: 0 14px 30px rgba(60,40,20,0.28);
  transform: rotate(0deg) scale(1.015);
  transition: none;
  cursor: grabbing;
}

.strip:not(.dragging) {
  transition: transform 0.18s ease;
}

.strip.placeholder-slot {
  background: repeating-linear-gradient(45deg, rgba(168,73,45,0.06), rgba(168,73,45,0.06) 8px, rgba(168,73,45,0.11) 8px, rgba(168,73,45,0.11) 16px);
  border: 2px dashed var(--paper-edge);
  box-shadow: none;
}

.strip.correct {
  background: var(--good-bg);
  border-color: var(--good);
}

.strip.incorrect {
  background: var(--bad-bg);
  border-color: var(--bad);
}

.strip__handle {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  cursor: grab;
  touch-action: none;
  border-right: 1px dashed var(--paper-edge);
  user-select: none;
  -webkit-user-select: none;
}

.strip__handle:active { cursor: grabbing; }

.strip__badge {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  margin: auto 0 auto 10px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.strip__body {
  flex: 1;
  padding: 14px 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.strip__ref {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 1em;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.strip__ref.visible { opacity: 1; }

.strip__text {
  font-size: 1.12rem;
  line-height: 1.42;
}

.strip__result {
  flex-shrink: 0;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-right: 4px;
}

.strip__reorder {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-right: 8px;
}

.strip__reorder button {
  width: 26px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--paper-edge);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.7rem;
}

.strip__reorder button:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.strip__reorder button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Questions */
.questions {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
}

.questions h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.questions__hint {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}

.context-block {
  background: rgba(168, 73, 45, 0.05);
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.context-block p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.insight-box {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.insight-box p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--accent-dark);
}

.insight-box strong {
  color: var(--ink);
}

.question {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.question:last-of-type { margin-bottom: 16px; }

.question__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 2px;
}

.question__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.question__text {
  font-size: 1.05rem;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 1.5em;
}

.question__text:focus {
  outline: none;
  border-color: var(--paper-edge);
  background: #fff;
}

.verse-example {
  font-size: 0.88rem;
}

.verse-example summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 2px 12px;
  list-style: none;
}

.verse-example summary::-webkit-details-marker { display: none; }

.verse-example summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.verse-example[open] summary::before {
  transform: rotate(90deg);
}

.verse-example blockquote {
  margin: 8px 12px 4px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.02);
  border-left: 2px dashed var(--paper-edge);
  border-radius: 0 8px 8px 0;
}

.verse-example cite {
  display: block;
  font-style: normal;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.verse-example blockquote p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 30px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

/* Password modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 35, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--paper-edge);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  padding: 24px 26px 22px;
  width: 100%;
  max-width: 340px;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.modal__hint {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}

#passwordInput {
  width: 100%;
  font: inherit;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--paper-edge);
  background: #fff;
  color: var(--ink);
  letter-spacing: 0.04em;
}

#passwordInput:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.modal__error {
  color: var(--bad);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  margin: 10px 0 0;
}

.modal__error[hidden] { display: none; }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 480px) {
  :root { font-size: 16px; }
  .header h1 { font-size: 1.5rem; }
  .strip__text { font-size: 1.02rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar__actions { justify-content: stretch; }
  .toolbar__actions .btn { flex: 1; justify-content: center; }
}
