:root {
  --bg: #0b0e0f;
  --panel: #0f1214;
  --ink: #eaecec;
  --shadow: rgba(0, 0, 0, .35);

  /* ← ここだけいじればサイズ調整できる */
  --viewer-max-width: 960px;
  --image-max-width: 900px;
  --image-max-height: 80vh;
}

/* ------------------------------
   Reset / Base
------------------------------ */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, "Noto Sans JP", sans-serif;
}

/* ------------------------------
   Stage layout
------------------------------ */

.stage {
  max-width: var(--viewer-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-top: 24px;
  padding-bottom: 120px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ------------------------------
   Image container
------------------------------ */

#imageWrap {
  width: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;  /* お好みで 8px, 24px などに調整 */
}

/* 実際の画像要素 */
#img {
  display: block;
  width: auto;
  /* max-width: min(var(--image-max-width), 100%);
  max-height: var(--image-max-height); */
    max-width: 100%;
  max-height: none;
  height: auto;
  object-fit: contain;
  border-radius: 16px;  /* お好みで 8px, 24px などに調整 */
}

/* ------------------------------
   Caption
------------------------------ */

#cap {
  margin-top: 8px;
  width: 100%;
  max-width: var(--image-max-width);
  padding: 12px 14px;
  text-align: left;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  white-space: pre-line;
}

/* ------------------------------
   Bottom tap area
------------------------------ */

#bottomTap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  z-index: 5;
}

/* ------------------------------
   Navigation panel
------------------------------ */

#nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -140px;
  background: rgba(12, 14, 15, .96);
  border-top: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 -16px 44px var(--shadow);
  transition: bottom .22s ease;
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}

#nav.is-open {
  bottom: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.badge {
  font-size: 12px;
  color: #cfd6d6;
  background: rgba(0, 0, 0, .25);
  padding: 4px 8px;
  border-radius: 10px;
}

input[type="range"] {
  appearance: none;
  width: 62vw;
  max-width: 460px;
  height: 14px;
  border-radius: 12px;
  background: #1b2123;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

button.icon {
  appearance: none;
  border: none;
  background: #1b2123;
  color: #e5ecec;
  padding: 8px 10px;
  border-radius: 12px;
}

button.icon:active {
  transform: translateY(1px);
}

#vol {
  width: 38vw;
  max-width: 260px;
}

/* ------------------------------
   Image transition animation
------------------------------ */

.img-swap {
  animation-name: imgSwap;
  animation-duration: .22s;
  animation-timing-function: ease;
}

@keyframes imgSwap {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .img-swap {
    animation: none;
  }
  
}
/* スマホではヘッダートグルボタン非表示 */
@media (max-width: 768px) {
  .header-toggle {
    display: none;
  }
}
/* ------------------------------
   Header toggle button
------------------------------ */

.header-toggle {
  position: fixed;

  z-index: 40;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  cursor: pointer;
}

.header-toggle:hover {
  background: rgba(30, 64, 175, 0.95);
}

/* ------------------------------
   Header hide animation
   （.nav は header.css で定義済み）
------------------------------ */

.nav {
  transition: transform .25s ease-out, opacity .2s ease-out;
}

.nav.is-hidden {
  transform: translateY(-100%);
  opacity: 0;
}
