:root {
  --font-base: 1.125rem;
  --font-large: 1.35rem;
  --font-title: clamp(1.5rem, 4vw, 2.25rem);
  --line: 1.7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: var(--font-base);
  line-height: var(--line);
  color: #1a1a1a;
  background: #f5f4f0;
  min-height: 100vh;
}

main {
  max-width: 75rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.content-area {
  min-width: 0;
}

.toc-mobile-toggle {
  display: none;
}

.toc-backdrop {
  display: none;
}

.toc-panel {
  position: sticky;
  top: 1rem;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 0.75rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.toc-close {
  display: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
}

.toc-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.toc-list li + li {
  margin-top: 0.35rem;
}

.toc-link {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.5rem 0.6rem;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  background: #fff;
}

.toc-link.is-active {
  background: #1a1a1a;
  color: #fff;
}

h1 {
  font-size: var(--font-title);
  font-weight: 700;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
}

strong,
b {
  font-weight: 700;
}

.landing-lead {
  font-size: var(--font-large);
  font-weight: 700;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1.5rem 0;
}

button {
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border: 2px solid #1a1a1a;
  background: #fff;
  cursor: pointer;
  border-radius: 2px;
}

button:hover {
  background: #1a1a1a;
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.progress {
  font-weight: 700;
  font-size: 0.95rem;
}

.slide-panel {
  background: #fff;
  border: 1px solid #ccc;
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.slide-body {
  font-size: var(--font-base);
}

.slide-body.large {
  font-size: var(--font-large);
}

.attachments {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.attachments figure {
  margin: 0;
}

.attachments img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
}

.attach-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.pdf-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid #ccc;
  background: #fafafa;
}

.audio-row audio {
  width: 100%;
  max-width: 28rem;
}

.hidden {
  display: none !important;
}

.font-tools {
  margin: 1rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid #ddd;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.font-tools label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ccc;
  font-size: 0.85rem;
  font-weight: 700;
  color: #444;
}

/* パスワードゲート（gate-home.js / gate-admin.js） */
.gate-screen {
  max-width: 22rem;
  margin: 3rem auto;
  padding: 1.5rem;
  background: #fff;
  border: 2px solid #1a1a1a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.gate-screen .gate-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.gate-screen input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border: 2px solid #1a1a1a;
}

.gate-screen button {
  font: inherit;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border: 2px solid #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

.gate-screen button:hover {
  background: #fff;
  color: #1a1a1a;
}

.gate-error {
  color: #a00;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

@media (max-width: 1023px) {
  body.toc-lock {
    overflow: hidden;
  }

  .layout {
    display: block;
  }

  .toc-mobile-toggle {
    display: inline-block;
    margin: 0 0 0.75rem;
  }

  .toc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 20;
  }

  .toc-backdrop.open {
    display: block;
  }

  .toc-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: min(84vw, 19rem);
    height: 100vh;
    max-height: 100vh;
    border-right: 1px solid #aaa;
    border-top: none;
    border-left: none;
    border-bottom: none;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease-out;
    box-shadow: 6px 0 18px rgba(0, 0, 0, 0.2);
  }

  .toc-panel.open {
    transform: translateX(0);
  }

  .toc-close {
    display: inline-block;
  }
}
