:root {
  --bg: #eef1f5;
  --ink: #33404d;
  --accent: #2f6fa3;
  --accent-dark: #1f4f78;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid #dde3ea;
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
}

header.top-bar h1 {
  margin: 0;
  font-size: 16px;
  color: var(--accent-dark);
}
header.top-bar .subtitle {
  font-size: 11px;
  color: #7c8a99;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-bar-track {
  width: 120px;
  height: 7px;
  background: #dde3ea;
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.progress-label { font-size: 11px; color: #7c8a99; white-space: nowrap; }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 14px;
  min-height: 0;
  gap: 10px;
}

.page-frame {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;
  min-height: 0;
}

.page-frame img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  object-fit: contain;
  display: block;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--accent-dark);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-arrow:hover { background: #fff; }
.nav-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-arrow.prev { left: 14px; }
.nav-arrow.next { right: 14px; }

.resource-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
}
.resource-link:hover { background: var(--accent-dark); }
.resource-hint {
  flex-shrink: 0;
  font-size: 11px;
  color: #7c8a99;
}

footer.bottom-bar {
  flex-shrink: 0;
  padding: 12px 18px 16px;
  background: #ffffff;
  border-top: 1px solid #dde3ea;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dots {
  display: flex;
  gap: 7px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ccd6e0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.dot.active { background: var(--accent-dark); width: 22px; border-radius: 5px; transition: width 0.2s; }
.dot.visited:not(.active) { background: #93b3cc; }

.controls-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

button.action-btn {
  background: var(--accent-dark);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
button.action-btn:hover { background: #163d5c; }
button.action-btn.secondary {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid #c7d4e0;
}
button.action-btn.secondary:hover { background: #f1f5f9; }
button.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.finish-banner {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

@media (max-width: 640px) {
  .nav-arrow { width: 36px; height: 36px; font-size: 16px; }
  header.top-bar h1 { font-size: 14px; }
  .progress-bar-track { width: 80px; }
}
