/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  background: #111;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100dvh;
}

/* ── Password gate ────────────────────────────────────────────────── */
.pw-gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0d0d14;
  z-index: 999;
}

.pw-card {
  background: #1a1a2a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 2.2rem 2rem;
  display: flex; flex-direction: column; gap: 0.9rem;
  width: min(340px, 90vw);
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.pw-title { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.03em; }
.pw-sub   { font-size: 0.85rem; color: #888; }

.pw-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #444;
  background: #0d0d14;
  color: #eee;
  font-size: 1rem;
  outline: none;
  text-align: center;
}
.pw-input:focus { border-color: #6a8fff; }

.pw-submit {
  width: 100%;
  padding: 0.65rem;
  border-radius: 8px;
  border: none;
  background: #4a6aff;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pw-submit:hover { background: #6a8fff; }

.pw-err { font-size: 0.8rem; color: #f06; min-height: 1em; }

/* ── Viewer ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.viewer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

.page-header { text-align: center; padding: 1.2rem 0 0.5rem; }
.page-header h1 { font-size: 1.5rem; color: #aaa; font-weight: 300; letter-spacing: 0.06em; }

/* ── Book section ─────────────────────────────────────────────────── */
.book-section { margin-top: 2.4rem; }

.book-section h2 {
  font-size: 1.15rem;
  color: #ddd;
  margin-bottom: 0.3rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #2a2a3a;
}
.book-section h2 small {
  font-size: 0.78rem;
  color: #666;
  font-weight: 400;
  margin-left: 0.4rem;
}

/* ── Character grid ───────────────────────────────────────────────── */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

/* ── Character cell ───────────────────────────────────────────────── */
.char-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

/* Inline SVG figure — scales fluidly inside each grid column */
.char-svg {
  width: 100%;
  height: auto;
  max-height: 200px;
  display: block;
}

/* Name label */
.char-name {
  font-size: 0.7rem;
  color: #bbb;
  text-align: center;
  line-height: 1.2;
  max-width: 110px;
  word-break: break-word;
}
