* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: #fdf8ee;
  color: #2b2320;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: 100vh;
}
h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
  color: #7a3b12;
}
.subtitle {
  color: #6b5d4f;
  margin: 0 0 24px;
  font-size: 1.05rem;
}
.screen { display: none; }
.screen.active { display: block; }

label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 18px 0 8px;
}
input[type="text"] {
  width: 100%;
  padding: 14px;
  font-size: 1.2rem;
  border: 2px solid #d8c9ae;
  border-radius: 10px;
  background: white;
}

button {
  font-size: 1.15rem;
  font-weight: 600;
  padding: 16px 20px;
  border-radius: 12px;
  border: none;
  width: 100%;
  margin-top: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; }

.btn-primary { background: #b5541a; color: white; }
.btn-secondary { background: #efe3cc; color: #5a3d1e; }
.btn-danger { background: #a33a2c; color: white; }
.btn-record { background: #c23b3b; color: white; }
.btn-record.recording { background: #7a1f1f; }

.card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.book-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid #eee1c9;
  font-size: 1.1rem;
}
.book-item:last-child { border-bottom: none; }
.book-item button { width: auto; margin: 0; padding: 10px 16px; font-size: 1rem; }

.page-badge {
  display: inline-block;
  background: #7a3b12;
  color: white;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.photo-preview {
  width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  display: none;
  border: 2px solid #d8c9ae;
}
.photo-preview.has-image { display: block; }

.status-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  font-size: 1rem;
  color: #6b5d4f;
}
.status-ok { color: #2f7a2f; font-weight: 700; }

.hidden { display: none !important; }

.spinner {
  border: 5px solid #efe3cc;
  border-top: 5px solid #b5541a;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  animation: spin 1s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.center { text-align: center; }
audio { width: 100%; margin-top: 10px; }

.link-back {
  display: inline-block;
  margin-bottom: 10px;
  color: #7a3b12;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 500;
}
.checkbox-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

#crop-stage {
  position: relative;
  display: inline-block;
  touch-action: none;
}
#crop-canvas {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  touch-action: none;
}
