:root {
  --cyan: #00b4e4;
  --orange: #f58a1f;
  --ink: #07111f;
  --panel: #111827;
  --panel-soft: #1f2937;
  --white: #ffffff;
  --muted: #a8b3c4;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --active-slide: url("slides/Slide1.PNG");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at top left, rgba(0, 180, 228, 0.2), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(245, 138, 31, 0.16), transparent 28rem),
    var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.deck-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: min(86vw, 320px);
  min-height: 0;
  flex-direction: column;
  background: rgba(17, 24, 39, 0.96);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo span {
  color: var(--orange);
}

.thumbnail-list {
  display: grid;
  gap: 0.85rem;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.thumbnail {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.5rem;
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.thumbnail:hover,
.thumbnail:focus-visible,
.thumbnail.active {
  border-color: var(--cyan);
  background: rgba(0, 180, 228, 0.14);
}

.thumbnail img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
}

.thumbnail span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stage {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.stage::before {
  position: absolute;
  inset: -40px;
  content: "";
  background:
    linear-gradient(rgba(7, 17, 31, 0.5), rgba(7, 17, 31, 0.72)),
    var(--active-slide) center / cover no-repeat;
  filter: blur(24px) saturate(1.08);
  transform: scale(1.08);
  opacity: 0.74;
}

.stage::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 180, 228, 0.28), transparent 25rem),
    radial-gradient(circle at 88% 82%, rgba(245, 138, 31, 0.22), transparent 24rem);
  pointer-events: none;
}

.topbar,
.bottom-controls {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  backdrop-filter: blur(14px);
}

.topbar {
  top: 0;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.72), rgba(7, 17, 31, 0));
}

.bottom-controls {
  bottom: 0;
  background: linear-gradient(0deg, rgba(7, 17, 31, 0.78), rgba(7, 17, 31, 0));
}

.deck-title {
  display: grid;
  gap: 0.1rem;
  text-align: center;
}

.deck-title strong {
  font-size: 0.98rem;
}

.deck-title span {
  color: var(--muted);
  font-size: 0.84rem;
}

.icon-button,
.control-button,
.nav-button {
  border: 1px solid var(--line);
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-button:hover,
.icon-button:focus-visible,
.control-button:hover,
.control-button:focus-visible,
.nav-button:hover,
.nav-button:focus-visible {
  border-color: rgba(0, 180, 228, 0.65);
  background: rgba(0, 180, 228, 0.18);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.5rem;
}

.icon-button span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 2px 0;
  border-radius: 99px;
  background: currentColor;
}

.sidebar-close {
  display: inline-grid;
}

.control-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 1.15rem;
  font-weight: 800;
}

.slide-frame {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100vh;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.slide-frame img {
  display: block;
  width: min(94vw, calc((100vh - 72px) * 16 / 9));
  max-height: calc(100vh - 72px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: clamp(8px, 1.4vw, 18px);
  background: #000;
  box-shadow: var(--shadow);
}

.nav-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(42px, 5vw, 58px);
  height: clamp(42px, 5vw, 58px);
  transform: translateY(-50%);
  border-radius: 999px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

.nav-prev {
  left: clamp(0.75rem, 2vw, 2rem);
}

.nav-next {
  right: clamp(0.75rem, 2vw, 2rem);
}

#slideRange {
  flex: 1;
  accent-color: var(--orange);
}

.hint {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

body.presenting .sidebar,
body.presenting .topbar,
body.presenting .bottom-controls {
  display: none;
}

body.presenting .deck-app {
  display: block;
}

body.presenting .stage {
  display: grid;
  height: 100vh;
}

body.presenting .slide-frame {
  height: 100vh;
  padding: 0;
  background: #000;
}

body.presenting .slide-frame img {
  width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 900px) {
  .slide-frame img {
    width: min(94vw, calc((100vh - 72px) * 16 / 9));
    max-height: calc(100vh - 72px);
  }

  .hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar,
  .bottom-controls {
    padding: 0.75rem;
  }

  .deck-title strong {
    font-size: 0.9rem;
  }

  .deck-title span {
    font-size: 0.76rem;
  }

  .control-button {
    padding: 0 0.8rem;
  }

  .nav-button {
    top: auto;
    bottom: 1.25rem;
    transform: none;
  }
}
