* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--font); }
#side {
  position: fixed; top: 0; left: 0; right: 0; height: var(--hh); z-index: 1; background: var(--bg);
  display: flex; align-items: center; gap: 48px; padding: 0 var(--mr) 0 var(--ml);
}
#title { font-size: 14px; margin-right: auto; }
#modes { display: flex; gap: 16px; }
#modes svg { display: block; width: 18px; height: 18px; fill: currentColor; }
button { background: none; border: 0; font: bold 14px var(--font); color: var(--sub); cursor: pointer; }
button[aria-pressed="true"] { color: var(--text); }
#menu { list-style: none; display: flex; gap: 32px; font-size: 14px; }
a { color: var(--sub); text-decoration: none; }
a:hover, button:hover { color: var(--text); }
img { display: block; object-fit: cover; cursor: pointer; }

/* 小さく見る: 位置は app.js が整数pxで計算する */
body.small #gallery { position: relative; margin: var(--hh) var(--mr) var(--mb) var(--ml); }
body.small img { position: absolute; }

/* 大きく見る: 高さを揃えて横に流す */
body.large { overflow: hidden; }
body.large #gallery {
  position: fixed; top: var(--hh); left: var(--ml); right: 0;
  display: flex; align-items: flex-start; gap: var(--lg);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
body.large #gallery::after { content: ""; flex: 0 0 max(0px, calc(var(--mr) - var(--lg))); align-self: stretch; }
body.large img { flex: none; }

@media (max-width: 700px) {
  #side { position: static; height: auto; flex-wrap: wrap; gap: 16px; padding: 20px var(--mr) 0 var(--ml); }
  #title { width: 100%; }
  body.small #gallery { margin: 20px var(--mr) var(--mb) var(--ml); }
  body.large #gallery { top: 140px; left: var(--ml); }
}

/* スマホの「大きく見る」: 横幅を合わせて縦スクロール */
body.large.vertical { overflow: auto; }
body.large.vertical #gallery {
  position: static; flex-direction: column; align-items: stretch; overflow: visible;
  margin: var(--hh) var(--mr) var(--mb) var(--ml);
}
body.large.vertical #gallery::after { display: none; }
@media (max-width: 700px) { body.large.vertical #gallery { margin: 20px var(--mr) var(--mb) var(--ml); } }
