@font-face {
  font-family: InterVar;
  src: local("Inter"), local("Segoe UI");
}

:root {
  --bh-green: #00b140;
  --bh-green-dark: #00843d;
  --bh-blue: #001a72;
  --bh-teal: #003f4f;
  --ink: #071126;
  --muted: #5e6a7d;
  --line: rgba(7, 17, 38, .12);
  --soft: #f4f8f7;
  --paper: #ffffff;
  --shadow: 0 26px 70px rgba(7, 17, 38, .14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 2%, rgba(0, 177, 64, .12), transparent 28%),
    radial-gradient(circle at 12% 88%, rgba(0, 26, 114, .08), transparent 30%),
    linear-gradient(135deg, #fbfcfb, #edf5f2 48%, #f7faf9);
  font-family: InterVar, "Segoe UI", Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .34;
  background-image:
    linear-gradient(90deg, rgba(7, 17, 38, .035) 1px, transparent 1px),
    linear-gradient(rgba(7, 17, 38, .03) 1px, transparent 1px),
    radial-gradient(circle at 24px 24px, rgba(0, 177, 64, .05) 1px, transparent 1.5px);
  background-size: 42px 42px, 42px 42px, 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.18));
}

button,
input {
  font: inherit;
}

.deck-app {
  width: min(1840px, calc(100vw - 32px));
  height: calc(100svh - 32px);
  min-height: 720px;
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.topbar,
.presentation-shell,
.podcast-player {
  position: relative;
  border: 1px solid rgba(255, 255, 255, .78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .86)),
    rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-radius: 28px 28px 10px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand img {
  width: 176px;
  height: auto;
  object-fit: contain;
}

.rule {
  width: 1px;
  align-self: stretch;
  background: var(--line);
}

.brand strong {
  display: block;
  color: var(--bh-blue);
  font-size: clamp(1rem, 1.5vw, 1.28rem);
  line-height: 1.15;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .92rem;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.ghost-btn,
.chapter-card,
.slide-controls button,
.play-btn,
.sync-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--bh-blue);
  font-weight: 900;
  cursor: pointer;
}

.ghost-btn {
  padding: 12px 18px;
}

.ghost-btn:hover,
.slide-controls button:hover,
.sync-btn:hover {
  border-color: rgba(0, 177, 64, .4);
  box-shadow: 0 10px 24px rgba(0, 177, 64, .12);
}

.presentation-shell {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 10px 10px 28px 28px;
  overflow: hidden;
}

.presentation-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(0, 177, 64, .08), transparent 34%),
    radial-gradient(circle at 100% 0, rgba(0, 26, 114, .08), transparent 28%);
}

.mobile-slide-menu {
  display: none;
}

.chapter-rail {
  position: relative;
  min-height: 0;
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(249, 252, 251, .84)),
    linear-gradient(135deg, rgba(0, 177, 64, .05), transparent);
  border: 1px solid rgba(7, 17, 38, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  overflow: auto;
}

.rail-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--bh-blue);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-weight: 950;
  font-size: .74rem;
}

.rail-heading strong {
  letter-spacing: .08em;
  color: var(--bh-green-dark);
}

.chapter-list {
  display: grid;
  gap: 9px;
}

.chapter-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px;
  border-radius: 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(250,253,252,.84));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82);
}

.chapter-card .num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 177, 64, .12);
  color: var(--bh-blue);
  font-weight: 950;
}

.chapter-card strong {
  display: block;
  color: var(--bh-blue);
  line-height: 1.15;
}

.chapter-card span:not(.num) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.2;
}

.chapter-card.active {
  border-color: rgba(0, 177, 64, .42);
  background: #fff;
  box-shadow: 0 14px 34px rgba(7, 17, 38, .1);
}

.chapter-card.active .num {
  background: var(--bh-green);
  color: #fff;
}

.stage-wrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 26, 114, .96), rgba(0, 63, 79, .92)),
    var(--bh-blue);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 30px 80px rgba(255, 255, 255, .04),
    0 24px 60px rgba(7, 17, 38, .2);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 20%, rgba(0, 177, 64, .16), transparent 32%),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

.stage img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .18);
  transition: opacity .18s ease, transform .18s ease;
}

.stage.is-changing img {
  opacity: .2;
  transform: scale(.992);
}

.slide-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.slide-controls button {
  padding: 11px 18px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--bh-green);
}

.podcast-player {
  display: grid;
  grid-template-columns: auto minmax(230px, 360px) auto minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-radius: 10px;
  overflow: hidden;
}

.podcast-player::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 177, 64, .08), transparent 26%),
    radial-gradient(circle at 88% 50%, rgba(0, 26, 114, .08), transparent 24%);
}

.audio-mark,
.podcast-copy,
.play-btn,
.progress-wrap,
.sync-btn {
  position: relative;
  z-index: 1;
}

.audio-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .28), transparent 28%),
    linear-gradient(135deg, var(--bh-green), var(--bh-green-dark));
  box-shadow: 0 16px 34px rgba(0, 177, 64, .22);
}

.audio-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.podcast-copy span {
  display: block;
  color: var(--bh-green-dark);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 950;
}

.podcast-copy strong {
  display: block;
  margin-top: 4px;
  color: var(--bh-blue);
  line-height: 1.15;
}

.play-btn {
  min-width: 78px;
  min-height: 42px;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--bh-green), var(--bh-green-dark));
  box-shadow: 0 16px 34px rgba(0, 177, 64, .2);
}

.sync-btn {
  min-width: 96px;
  min-height: 40px;
  padding: 0 14px;
}

.sync-btn.active {
  color: #fff;
  border-color: transparent;
  background: var(--bh-blue);
}

.progress-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.deck-app.fullscreen {
  width: 100vw;
  min-height: 100svh;
  margin: 0;
  padding: 10px;
}

.deck-app.fullscreen .topbar,
.deck-app.fullscreen .presentation-shell,
.deck-app.fullscreen .podcast-player {
  box-shadow: none;
}

@media (max-width: 980px) {
  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
  }

  .deck-app {
    width: min(100vw - 18px, 980px);
    height: auto;
    min-height: 100svh;
    margin: 9px auto;
    gap: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 22px 22px 10px 10px;
  }

  .brand {
    width: 100%;
    gap: 12px;
  }

  .brand img {
    width: 142px;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand span {
    font-size: .82rem;
  }

  .top-actions {
    width: 100%;
  }

  .ghost-btn {
    flex: 1;
    min-height: 42px;
    padding: 10px 12px;
  }

  .presentation-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .chapter-rail {
    border-radius: 18px;
    padding: 12px;
    overflow: hidden;
  }

  .rail-heading {
    margin-bottom: 10px;
  }

  .chapter-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .chapter-card {
    flex: 0 0 min(74vw, 310px);
    grid-template-columns: 34px 1fr;
    border-radius: 16px;
    scroll-snap-align: start;
  }

  .chapter-card .num {
    width: 34px;
    height: 34px;
  }

  .stage {
    aspect-ratio: 11 / 8.5;
    border-radius: 18px;
  }

  .slide-controls {
    grid-template-columns: 62px 1fr 62px;
    gap: 8px;
  }

  .slide-controls button {
    min-height: 42px;
    padding: 9px 10px;
  }

  .podcast-player {
    position: sticky;
    top: 0;
    z-index: 10;
    grid-template-columns: auto 1fr auto;
    gap: 10px 12px;
    padding: 12px;
    border-radius: 10px;
  }

  .podcast-copy {
    min-width: 0;
  }

  .podcast-copy strong {
    font-size: .95rem;
  }

  .play-btn {
    min-width: 74px;
    min-height: 42px;
  }

  .progress-wrap {
    grid-column: 1 / -1;
  }

  .sync-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 40px;
  }
}

@media (max-width: 620px) {
  .deck-app {
    width: 100%;
    margin: 0;
    min-height: 100svh;
    background: #fff;
  }

  .topbar,
  .presentation-shell,
  .podcast-player {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .brand {
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  .brand img {
    width: 122px;
  }

  .rule {
    display: none;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .ghost-btn {
    font-size: .82rem;
    white-space: nowrap;
  }

  .presentation-shell {
    padding: 10px;
    border-radius: 0 0 18px 18px;
  }

  .chapter-rail {
    padding: 10px;
    border-radius: 16px;
  }

  .rail-heading {
    font-size: .68rem;
    letter-spacing: .14em;
  }

  .chapter-card {
    flex-basis: 82vw;
    padding: 9px;
  }

  .chapter-card strong {
    font-size: .92rem;
  }

  .chapter-card span:not(.num) {
    font-size: .78rem;
  }

  .stage {
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 10px 28px rgba(7, 17, 38, .12);
  }

  .slide-controls {
    grid-template-columns: 56px 1fr 56px;
  }

  .podcast-player {
    padding: 10px 12px;
  }

  .audio-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .audio-mark svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 420px) {
  .brand img {
    width: 108px;
  }

  .brand strong {
    font-size: .92rem;
  }

  .brand span {
    font-size: .76rem;
  }

  .ghost-btn,
  .slide-controls button,
  .play-btn,
  .sync-btn {
    font-size: .78rem;
  }
}

/* Mobile hamburger slide navigation */

@media (max-width: 760px) {
  .presentation-shell {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .mobile-slide-menu {
    position: relative;
    z-index: 8;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 10px 14px;
    border: 1px solid rgba(0, 177, 64, .28);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    color: var(--bh-blue);
    box-shadow: 0 12px 28px rgba(7, 17, 38, .08);
    text-align: left;
  }

  .mobile-slide-menu strong,
  .mobile-slide-menu small,
  .mobile-slide-menu em {
    display: block;
  }

  .mobile-slide-menu strong {
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
  }

  .mobile-slide-menu small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
  }

  .mobile-slide-menu em {
    color: var(--bh-green-dark);
    font-size: .76rem;
    font-style: normal;
    font-weight: 950;
    letter-spacing: .08em;
  }

  .hamburger {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    gap: 0;
    border-radius: 14px;
    background: var(--bh-green);
    box-shadow: 0 12px 28px rgba(0, 177, 64, .22);
  }

  .hamburger span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
  }

  .chapter-rail {
    position: absolute;
    z-index: 20;
    top: 78px;
    left: 10px;
    right: 10px;
    max-height: min(68svh, 520px);
    padding: 12px;
    border-radius: 18px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity .16s ease, transform .16s ease;
    overflow: auto;
  }

  .slide-menu-open .chapter-rail {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .rail-heading {
    margin-bottom: 10px;
  }

  .chapter-list {
    display: grid;
    gap: 8px;
    overflow: visible;
    padding: 0;
    scroll-snap-type: none;
  }

  .chapter-card {
    width: 100%;
    flex: initial;
    grid-template-columns: 38px 1fr;
  }

  .chapter-card .num {
    width: 38px;
    height: 38px;
  }

  .stage-wrap {
    min-height: 0;
  }
}
