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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1a;
  color: #e8e8e8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 16px 24px;
  border-bottom: 1px solid #333;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  gap: 20px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.file-btn {
  display: inline-block;
  padding: 10px 20px;
  background: #4a90d9;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}

.file-btn:hover {
  background: #3a7bc8;
}

.voice-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #aaa;
}

.voice-wrap select {
  background: #2a2a2a;
  color: #e8e8e8;
  border: 1px solid #444;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.875rem;
  cursor: pointer;
  max-width: 260px;
}

.voice-wrap select:focus {
  outline: none;
  border-color: #4a90d9;
}

/* ── Viewer ──────────────────────────────────────────────────────────────── */

.viewer {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

#emptyState {
  color: #666;
  font-size: 0.95rem;
}

#errorState {
  color: #e07070;
  font-size: 0.9rem;
  padding: 16px;
  text-align: center;
}

#pdfCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Controls ────────────────────────────────────────────────────────────── */

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
  gap: 12px;
}

.page-counter {
  font-size: 0.875rem;
  color: #888;
  min-width: 100px;
}

.buttons {
  display: flex;
  gap: 12px;
}

button {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#playPauseBtn {
  background: #4a90d9;
  color: #fff;
  min-width: 100px;
}

#playPauseBtn:hover:not(:disabled) {
  background: #3a7bc8;
}

#nextPageBtn {
  background: #333;
  color: #e8e8e8;
}

#nextPageBtn:hover:not(:disabled) {
  background: #3d3d3d;
}
