:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #0f766e;
  --primary-dark: #0b5f58;
  --danger: #b91c1c;
  --border: #dbe2ea;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #eef5ff 0%, #f7fafc 100%);
  color: var(--text);
}

body.player-active {
  overflow: hidden;
  height: 100vh;
  touch-action: none;
}

#app {
  min-height: 100vh;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.pageHeader {
  margin-bottom: 20px;
}

.pageHeader h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.2vw, 2.2rem);
}

.pageHeader p {
  margin: 0;
  color: var(--muted);
}

#dashboardView {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 28px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.panel h2 {
  margin-top: 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
}

input[type="text"],
input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button.primary:hover {
  background: var(--primary-dark);
}

button.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.status {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: #065f46;
  font-weight: 600;
}

.status.error {
  color: var(--danger);
}

.projectsList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.projectCard {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.projectCardHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.projectCardHead h3 {
  margin: 0;
  font-size: 1.05rem;
}

.projectCardHead small {
  color: var(--muted);
  font-size: 0.8rem;
}

.progressBar {
  width: 100%;
  height: 12px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

.progressBar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #22c55e);
}

.projectActions {
  display: flex;
  justify-content: flex-end;
}

.empty {
  color: var(--muted);
}

#playerView {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% -10%, #2b3447 0%, #141a24 58%, #0b111b 100%);
}

.playerTopBar {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.projectName {
  background: rgba(8, 13, 22, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5edf7;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.playerLayout {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
}

.navZone {
  width: 20%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navHint {
  pointer-events: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #dbf7ef;
  background: rgba(15, 118, 110, 0.28);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 999px;
  padding: 8px 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.navZone:hover .navHint {
  opacity: 1;
  transform: translateY(0);
}

.navZone.left:hover {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.15), rgba(15, 118, 110, 0));
}

.navZone.right:hover {
  background: linear-gradient(270deg, rgba(15, 118, 110, 0.15), rgba(15, 118, 110, 0));
}

.playerCenter {
  width: 60%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 16px;
}

.stepMeta {
  text-align: center;
  margin-bottom: 8px;
}

.counter {
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 800;
  color: #f8fafc;
}

.bookPage {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #c4d0df;
}

#foldCanvas {
  width: min(100%, 920px);
  height: auto;
  max-height: 56vh;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: #0f1724;
  box-shadow: 0 16px 42px rgba(2, 6, 23, 0.45);
}

.foldNumbers {
  margin-top: 14px;
  display: flex;
  gap: 18px;
}

.numBlock {
  background: rgba(8, 13, 22, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 12px 18px;
  text-align: center;
}

.numBlock span {
  display: block;
  font-size: 0.95rem;
  color: #c4d0df;
}

.numBlock strong {
  font-size: clamp(1.25rem, 2.4vw, 1.95rem);
  color: #f8fafc;
}

.stepScrubber {
  width: min(100%, 680px);
  margin-top: 12px;
  background: rgba(8, 13, 22, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 10px 12px;
}

.stepScrubber label {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: #c4d0df;
}

.scrubberRow {
  display: flex;
  align-items: center;
  gap: 12px;
}

#stepRange {
  width: 100%;
  margin: 0;
  touch-action: pan-y;
}

#stepRangeLabel {
  min-width: 70px;
  text-align: right;
  font-weight: 700;
  color: #e5edf7;
}

@media (max-width: 900px) {
  .playerCenter {
    width: 100%;
    padding-top: 70px;
  }

  .navZone {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
  }

  .navZone.left {
    left: 0;
  }

  .navZone.right {
    right: 0;
  }

  .navHint {
    opacity: 1;
    transform: none;
    font-size: 0.8rem;
  }

  .foldNumbers {
    flex-direction: column;
    width: min(94%, 420px);
    gap: 10px;
  }

  .numBlock {
    width: 100%;
  }

  .stepScrubber {
    width: min(94%, 420px);
  }
}
