:root {
  --page-bg: #f8faf5;
  --page-bg-deep: #eef3e9;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(64, 102, 66, 0.14);
  --panel-shadow: 0 24px 56px rgba(70, 92, 56, 0.14);
  --text-main: #203022;
  --text-muted: #5a6b59;
  --accent: #2d6a3d;
  --accent-strong: #1f4f2e;
  --accent-soft: #e3eddc;
  --accent-softer: #f4f8f1;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --media-area-width: 70%;
  --shell-padding: clamp(0.85rem, 2.1vh, 1.35rem);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(150, 188, 137, 0.22), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(112, 151, 106, 0.16), transparent 18%),
    linear-gradient(180deg, var(--page-bg) 0%, var(--page-bg-deep) 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(94, 141, 78, 0.18), transparent 45%),
    radial-gradient(circle at 68% 68%, rgba(153, 187, 131, 0.14), transparent 42%);
  filter: blur(8px);
}

body::before {
  top: -6rem;
  left: -7rem;
}

body::after {
  right: -6rem;
  bottom: -8rem;
}

.slide-shell {
  height: 100vh;
  min-height: 100vh;
  padding: var(--shell-padding);
  display: grid;
  place-items: center;
}

.slide-stage {
  width: min(1180px, 100%);
  height: 100%;
  max-height: 100%;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.8rem;
}

.slide-stage::before {
  content: "";
  position: absolute;
  inset: 2.25rem 4rem auto;
  height: 14rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(128, 170, 115, 0.16), rgba(223, 238, 216, 0));
  filter: blur(18px);
  z-index: 0;
}

.deck-header,
.slide-card {
  position: relative;
  z-index: 1;
}

.deck-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem 1.3rem;
  align-items: end;
  margin-bottom: 0;
}

.deck-kicker {
  margin: 0;
  grid-column: 1 / -1;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--accent);
}

.deck-heading h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 0.94;
}

.deck-description {
  margin: 0.35rem 0 0;
  max-width: 55ch;
  color: var(--text-muted);
  line-height: 1.45;
}

.deck-count {
  margin: 0;
  padding: 0.58rem 0.92rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(74, 110, 74, 0.1);
  color: var(--text-muted);
  font-weight: 600;
  justify-self: end;
}

.slide-card {
  padding: clamp(0.9rem, 2vw, 1.35rem);
  border-radius: var(--radius-xl);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.82rem;
  min-height: 0;
}

.slide-card::before {
  content: "";
  position: absolute;
  width: 16rem;
  height: 16rem;
  right: -5rem;
  top: -5rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(128, 170, 115, 0.15), transparent 70%);
}

.slide-main {
  display: grid;
  grid-template-columns: minmax(16rem, calc(100% - var(--media-area-width))) minmax(0, var(--media-area-width));
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: stretch;
  min-height: 0;
}

.slide-details {
  display: grid;
  align-content: start;
  gap: 0.78rem;
  padding: clamp(1rem, 2vw, 1.4rem);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 241, 0.96));
  border: 1px solid rgba(62, 102, 67, 0.08);
  min-height: 0;
  overflow: auto;
}

.detail-block {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(227, 237, 220, 0.7);
  border: 1px solid rgba(69, 102, 68, 0.08);
}

.detail-label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.detail-value {
  display: block;
  margin-top: 0.45rem;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: clamp(2.2rem, 3.4vw, 3.5rem);
  line-height: 0.95;
}

#slideDate,
#slideTime {
  white-space: nowrap;
  font-size: clamp(1.7rem, 2.5vw, 2.8rem);
  line-height: 1;
}

.media-frame {
  position: relative;
  min-height: 0;
  height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(59, 95, 60, 0.12);
  background:
    linear-gradient(135deg, rgba(247, 250, 243, 0.95), rgba(227, 237, 220, 0.92)),
    linear-gradient(160deg, rgba(255, 255, 255, 0.6), rgba(230, 237, 226, 0.45));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(93, 130, 79, 0.16), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(152, 187, 130, 0.16), transparent 24%),
    linear-gradient(135deg, transparent 20%, rgba(118, 153, 104, 0.08) 100%);
  pointer-events: none;
}

.media-frame img,
.media-frame video,
.media-fallback {
  width: 100%;
  height: 100%;
}

.media-frame img,
.media-frame video {
  display: block;
  object-fit: cover;
  background: #dde7d7;
}

.media-fallback {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.6;
}

.media-overlay {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(24, 37, 25, 0.62);
  color: #f7fbf4;
  backdrop-filter: blur(12px);
}

.media-type-badge {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.media-file {
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.slide-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  margin-top: 0;
  align-items: end;
}

.slide-comment {
  min-height: 0;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 246, 236, 0.96));
  border: 1px solid rgba(62, 102, 67, 0.08);
  display: grid;
  align-content: start;
}

.slide-comment p {
  margin: 0.7rem 0 0;
  max-width: 100%;
  line-height: 1.58;
  max-height: 8.2rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.slide-icons-panel {
  margin-top: 0.2rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(62, 102, 67, 0.14);
  display: grid;
  gap: 0.55rem;
}

.slide-icons {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  max-height: 11.6rem;
  overflow: auto;
}

.slide-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.78rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(52, 89, 54, 0.2);
  background: rgba(255, 255, 255, 0.84);
  color: #4f6252;
  user-select: none;
}

.slide-icon::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.72;
  flex: 0 0 auto;
}

.slide-icon--active {
  color: var(--accent-strong);
  border-color: rgba(39, 88, 49, 0.34);
  background: linear-gradient(135deg, rgba(226, 240, 216, 0.98), rgba(244, 250, 239, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.slide-icon--inactive {
  color: rgba(77, 98, 82, 0.86);
  border-color: rgba(80, 110, 83, 0.1);
  background: rgba(255, 255, 255, 0.7);
  opacity: 0.42;
}

.slide-icon--empty {
  color: var(--text-muted);
  border-style: dashed;
  background: rgba(246, 250, 243, 0.9);
  opacity: 1;
}

.slide-controls {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
}

.nav-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.35rem;
  font: inherit;
  font-weight: 700;
  color: #f8fcf6;
  background: linear-gradient(135deg, var(--accent), #4f8757);
  box-shadow: 0 18px 30px rgba(49, 96, 58, 0.2);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.nav-button--secondary {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 106, 61, 0.16);
  box-shadow: none;
}

.nav-button:not(:disabled):hover {
  transform: translateY(-2px);
}

.nav-button:not(:disabled):active {
  transform: translateY(0);
}

.nav-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 940px) {
  .slide-shell {
    height: auto;
  }

  .slide-stage {
    height: auto;
    max-height: none;
    grid-template-rows: auto auto;
  }

  .slide-card {
    grid-template-rows: auto auto;
  }

  .deck-header,
  .slide-footer,
  .slide-main {
    grid-template-columns: 1fr;
  }

  .slide-comment p,
  .slide-icons {
    max-height: none;
  }

  .media-frame {
    min-height: clamp(280px, 46vh, 480px);
  }

  .deck-count {
    justify-self: start;
  }

  .slide-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .slide-shell {
    padding: 0.9rem;
  }

  .slide-card {
    border-radius: 24px;
  }

  .detail-value {
    font-size: clamp(1.9rem, 8vw, 2.8rem);
  }

  .slide-controls {
    flex-wrap: wrap;
  }

  .nav-button {
    flex: 1 1 12rem;
    justify-content: center;
  }

  .media-overlay {
    right: 1rem;
    flex-wrap: wrap;
  }
}