
:root {
  color-scheme: dark;
  --ink: #071513;
  --panel: #0b1d19;
  --line: rgba(191, 255, 226, 0.14);
  --green: #31d67b;
  --green-soft: #8ff1b8;
  --white: #f3fbf7;
  --muted: #8fa69d;
}

* { box-sizing: border-box; }

html,
body { margin: 0; min-height: 100%; background: var(--ink); }

body {
  color: var(--white);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
a { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

.presentation-shell {
  position: relative;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 68px;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(49, 214, 123, 0.09), transparent 34%),
    radial-gradient(circle at 12% 12%, rgba(33, 119, 83, 0.13), transparent 26%),
    linear-gradient(145deg, #06100e 0%, #091814 54%, #050d0b 100%);
}

.presentation-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.26;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 74%);
}

.topbar,
.bottombar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 clamp(18px, 3.2vw, 54px);
}

.topbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 16, 13, 0.58);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: clamp(132px, 12vw, 174px);
  height: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid rgba(143, 241, 184, .36);
  border-radius: 50%;
  color: var(--white);
  background: radial-gradient(circle at 28% 22%, #64f2a3, #13864a 62%, #075a32);
  box-shadow: 0 0 24px rgba(49, 214, 123, .2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.08em;
}

.brand strong,
.brand small { display: block; }

.brand strong { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .03em; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.text-action,
.icon-action {
  display: inline-grid;
  place-items: center;
  height: 38px;
  border: 1px solid var(--line);
  color: var(--white);
  background: rgba(255, 255, 255, .035);
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.text-action { padding: 0 16px; border-radius: 999px; font-size: 12px; }
.icon-action { width: 38px; border-radius: 50%; cursor: pointer; font-size: 19px; }

.text-action:hover,
.icon-action:hover { border-color: rgba(143, 241, 184, .5); background: rgba(49, 214, 123, .1); }
.text-action:active,
.icon-action:active { transform: scale(.96); }

.stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(52px, 1fr) minmax(0, auto) minmax(52px, 1fr);
  align-items: center;
  min-height: 0;
  padding: clamp(10px, 1.7vh, 18px) clamp(10px, 2vw, 30px);
}

.page-perspective {
  position: relative;
  width: min(76vw, calc((100svh - 168px) * .7071));
  aspect-ratio: 210 / 297;
  perspective: 2400px;
  touch-action: pan-y;
  user-select: none;
}

.page-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(220, 255, 237, .18);
  border-radius: clamp(4px, .6vw, 8px);
  background: #eff5f1;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, .58),
    0 4px 16px rgba(0, 0, 0, .42),
    0 0 0 1px rgba(0, 0, 0, .22);
  transform-style: preserve-3d;
}

.page-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 18px rgba(2, 19, 13, .09);
}

.page-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.base-page { z-index: 1; }

.turn-sheet {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
  transition: transform 820ms cubic-bezier(.64, .02, .26, 1);
}

.turn-sheet[hidden] { display: none; }

.turn-sheet.forward { transform-origin: left center; transform: rotateY(0deg); }
.turn-sheet.forward.active { transform: rotateY(-180deg); }
.turn-sheet.backward { transform-origin: left center; transform: rotateY(-180deg); }
.turn-sheet.backward.active { transform: rotateY(0deg); }

.turn-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.3));
  transition: opacity 410ms ease;
}

.turn-sheet.active .turn-shade { opacity: .5; }

.side-control {
  position: relative;
  z-index: 8;
  display: grid;
  place-items: center;
  justify-self: center;
  width: clamp(44px, 4.7vw, 62px);
  height: clamp(44px, 4.7vw, 62px);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--white);
  background: rgba(13, 37, 30, .74);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease, opacity .2s ease;
}

.side-control span { display: block; margin-top: -4px; font-size: clamp(34px, 4vw, 46px); font-weight: 200; line-height: 1; }
.side-control:hover:not(:disabled) { color: #07150f; background: var(--green-soft); border-color: var(--green-soft); transform: scale(1.06); }
.side-control:active:not(:disabled) { transform: scale(.95); }
.side-control:disabled { opacity: .22; cursor: default; }

.bottombar {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  gap: 18px;
  border-top: 1px solid var(--line);
  background: rgba(5, 16, 13, .54);
  backdrop-filter: blur(16px);
}

.page-counter { display: flex; align-items: baseline; min-width: 64px; font-variant-numeric: tabular-nums; }
.page-counter strong { color: var(--green-soft); font-size: 19px; font-weight: 700; }
.page-counter span { margin-left: 5px; color: var(--muted); font-size: 11px; }

.progress-track { overflow: hidden; height: 2px; border-radius: 999px; background: rgba(255,255,255,.1); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #158d4b, #77efab); box-shadow: 0 0 10px rgba(49,214,123,.5); transition: width .45s ease; }

.hint { margin: 0; color: var(--muted); font-size: 11px; }

.empty-state {
  position: relative;
  z-index: 2;
  display: grid;
  place-content: center;
  padding: 40px;
  text-align: center;
}

.empty-state h1 { margin: 0 0 10px; font-size: 28px; }
.empty-state p { margin: 0; color: var(--muted); }

@media (max-width: 720px) {
  .presentation-shell { grid-template-rows: 58px minmax(0, 1fr) 60px; }
  .topbar,
  .bottombar { padding-inline: 14px; }
  .text-action { display: none; }
  .brand-logo { width: 136px; }
  .stage { grid-template-columns: 1fr; padding: 10px 8px; }
  .page-perspective { width: min(92vw, calc((100svh - 144px) * .7071)); }
  .side-control { position: absolute; top: 50%; width: 42px; height: 42px; transform: translateY(-50%); background: rgba(4, 19, 14, .72); }
  .side-control:hover:not(:disabled) { transform: translateY(-50%); }
  .side-control.previous { left: 10px; }
  .side-control.next { right: 10px; }
  .side-control span { font-size: 32px; }
  .bottombar { grid-template-columns: auto minmax(70px, 1fr); gap: 14px; }
  .hint { display: none; }
}

@media (max-height: 570px) and (orientation: landscape) {
  .presentation-shell { grid-template-rows: 48px minmax(0, 1fr) 46px; }
  .text-action,
  .hint { display: none; }
  .brand-logo { width: 126px; }
  .page-perspective { width: min(34vw, calc((100svh - 116px) * .7071)); }
  .bottombar { grid-template-columns: auto 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
