* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  color: #222;
}

.app {
  min-height: 100vh;
  padding: 16px;
}

h1 {
  margin: 0 0 12px 0;
  text-align: center;
  font-size: 1.6rem;
}

.scan-text {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 12px;
  color: #444;
  font-weight: 600;
}

#scanner {
  width: 100%;
  height: 240px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  margin-bottom: 22px;
  cursor: pointer;
  border: 3px solid #c62828;
}

#scanner video,
#scanner canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.scan-line {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 3px;
  background: red;
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
  z-index: 10;
  pointer-events: none;
}

.scan-frame {
  position: absolute;
  top: 22%;
  left: 4%;
  width: 92%;
  height: 56%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  z-index: 9;
  pointer-events: none;
}

.manual-input {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin-bottom: 18px;
}

.manual-input input {
  flex: 1;
  min-width: 0;
  height: 58px;
  padding: 0 16px;
  font-size: 1.15rem;
  border: 2px solid #ccc;
  border-radius: 12px;
  background: #fff;
}

.manual-input input:focus {
  outline: none;
  border-color: #c62828;
}

.manual-input button {
  flex: 0 0 64px;
  width: 64px;
  height: 58px;
  border: none;
  border-radius: 12px;
  background: #c62828;
  color: #fff;
  font-size: 1.6rem;
  font-weight: bold;
  cursor: pointer;
}

.manual-input button:active {
  transform: scale(0.98);
}

.output {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  min-height: 160px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}

.output.success {
  background: #e8f5e9;
  border-color: #2e7d32;
}

.output.error {
  background: #ffebee;
  border-color: #c62828;
}

.label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
}

#result {
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-word;
}

.book-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.book-subtitle {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
}

.book-row {
  margin-bottom: 6px;
}

.book-row strong {
  display: inline-block;
  min-width: 95px;
}

.status-success {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 600;
}

.status-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffebee;
  color: #b71c1c;
  font-weight: 600;
}

#restartCountdown {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.actions {
  margin-top: 16px;
}

.download-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 12px;
  background: #2e7d32;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
}