:root {
  color-scheme: light;
  --ink: #061a38;
  --muted: #5e728c;
  --line: #d9e5f0;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --accent: #1e66b1;
  --accent-2: #0f8d7b;
  --warm: #d9a441;
  --shadow: 0 18px 60px rgba(6, 26, 56, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 18%, rgba(30, 102, 177, 0.16), transparent 34rem),
    linear-gradient(135deg, #f7fbff 0%, #eef5fb 52%, #ffffff 100%);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

button {
  font: inherit;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(6, 26, 56, 0.08);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.1rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.deck-switcher {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem;
  background: #e7f0f8;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  flex: 0 0 auto;
}

.deck-tab {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 0.35rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  text-align: left;
  min-width: 7.4rem;
}

.deck-tab span {
  display: block;
  color: inherit;
  font-size: 0.7rem;
  font-weight: 700;
}

.deck-tab strong {
  display: block;
  color: inherit;
  font-size: 0.92rem;
  line-height: 1.15;
}

.deck-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: 0 0.35rem 1rem rgba(6, 26, 56, 0.12);
}

.stage-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem);
  gap: clamp(0.9rem, 2vw, 1.5rem);
  padding: clamp(1rem, 3vw, 2.5rem);
  align-items: start;
}

.stage {
  min-width: 0;
}

.slide-shell {
  position: relative;
  border: 1px solid rgba(6, 26, 56, 0.12);
  border-radius: 0.5rem;
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}

.slide-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(2.6rem, 5vw, 3.35rem);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(6, 26, 56, 0.58);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  background: rgba(6, 26, 56, 0.82);
  transform: translateY(-50%) scale(1.04);
}

.nav-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.nav-btn.prev {
  left: clamp(0.6rem, 2vw, 1rem);
}

.nav-btn.next {
  right: clamp(0.6rem, 2vw, 1rem);
}

.nav-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  stroke-width: 2.6;
}

.progress {
  margin-top: 0.9rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #dce8f3;
  overflow: hidden;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms ease;
}

.side-panel {
  border: 1px solid rgba(6, 26, 56, 0.12);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: 0 0.6rem 2rem rgba(6, 26, 56, 0.08);
  padding: 1rem;
  backdrop-filter: blur(18px);
}

.status {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.counter {
  color: var(--accent);
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1;
}

.caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.tool-btn {
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.tool-btn:hover,
.tool-btn:focus-visible {
  border-color: #a8c7e3;
  background: #f8fbff;
}

.tool-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
}

.thumbs {
  display: grid;
  gap: 0.5rem;
  max-height: min(58vh, 34rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.thumb {
  border: 2px solid transparent;
  border-radius: 0.45rem;
  background: #ffffff;
  padding: 0.2rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 4.9rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  color: var(--ink);
}

.thumb[aria-current="true"] {
  border-color: var(--accent);
  box-shadow: 0 0.35rem 1rem rgba(30, 102, 177, 0.16);
}

.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.25rem;
}

.thumb span {
  display: block;
  min-width: 0;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.3;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2.5rem 1.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover,
.footer a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .topbar,
  .stage-wrap,
  .footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .deck-switcher {
    width: 100%;
  }

  .deck-tab {
    flex: 1 1 0;
    min-width: 0;
  }

  .stage-wrap {
    grid-template-columns: 1fr;
  }

  .side-panel {
    order: 2;
  }

  .thumbs {
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    max-height: none;
    padding-right: 0;
  }

  .thumb {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .deck-switcher,
  .tools {
    grid-template-columns: 1fr;
    display: grid;
  }

  .deck-tab {
    text-align: center;
  }

  .slide-shell {
    border-radius: 0.35rem;
  }

  .nav-btn {
    top: auto;
    bottom: 0.65rem;
    transform: none;
  }

  .nav-btn:hover,
  .nav-btn:focus-visible {
    transform: scale(1.04);
  }

  .footer {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .side-panel,
  .footer,
  .progress,
  .nav-btn {
    display: none !important;
  }

  .page,
  .stage-wrap {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .slide-shell {
    border: 0;
    box-shadow: none;
    border-radius: 0;
    page-break-after: always;
  }
}
