:root {
  color-scheme: light;
  --ink: #1c2128;
  --muted: #5e6772;
  --line: #e6e8ec;
  --bg: #f4f5f7;
  --paper: #ffffff;
  --accent: #1f5f73;
  --accent-soft: #e7f2f5;
  --shadow: 0 10px 28px rgba(28, 33, 40, 0.08);
  --shadow-soft: 0 6px 18px rgba(28, 33, 40, 0.06);
  --sidebar: 248px;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", Meiryo, "WenQuanYi Micro Hei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100%;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: white;
  padding: 8px 12px;
  border-radius: 10px;
  z-index: 80;
}

.skip:focus { top: 12px; }

h1, h2, h3, p { margin: 0; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar);
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 40;
  padding: 20px 14px 32px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
}

.sidebar-close {
  display: none;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
}

.nav-group { margin-top: 18px; }

.nav-label {
  margin: 0 8px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 10px;
}

.nav-btn:hover { background: #f3f5f7; }
.nav-btn[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

.nav-count {
  flex: none;
  min-width: 26px;
  text-align: center;
  background: #eef0f3;
  color: var(--muted);
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 7px;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  border: 0;
  background: rgba(28, 33, 40, 0.28);
  color: transparent;
}

.main {
  margin-left: var(--sidebar);
  min-width: 0;
  padding: 22px 28px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 14px 0 12px;
}

.burger {
  width: 16px;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.burger span {
  display: block;
  height: 1.5px;
  border-radius: 2px;
  background: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  flex: none;
  box-shadow: inset 0 -10px 0 rgba(255, 255, 255, 0.18);
}

h1 {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.brand p { color: var(--muted); font-size: 13px; }

.demo-badge {
  flex: none;
  margin: 0;
  border: 1px solid #c5d5db;
  color: var(--accent);
  background: white;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
}

.search-slot { margin-top: 20px; }

.search-slot label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  min-height: 48px;
  box-shadow: var(--shadow-soft);
}

.search-field svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 46px;
  padding: 0;
}

.search-field input:focus { outline: none; }

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 115, 0.15);
}

.search-note, .demo-banner, .site-footer, .peek-caption-meta, .meta-label {
  color: var(--muted);
}

.search-note { margin-top: 6px; font-size: 13px; }

.demo-banner {
  margin-top: 14px;
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.toolbar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: flex-end;
}

.toolbar-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: white;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  min-width: min(100%, 280px);
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  min-height: 40px;
  padding: 8px 12px;
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}

.status {
  margin-top: 16px;
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
}

.status[hidden] { display: none; }

.status-error {
  background: #fff6f6;
  color: #8d2b2b;
}

.gallery-section { margin-top: 32px; }

.gallery-section h2 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.group-block { margin-bottom: 28px; }

.group-block h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.peek {
  position: relative;
  outline: none;
}

.peek-viewport {
  overflow: clip;
  width: 100%;
  max-width: 100%;
}

.peek-track {
  display: flex;
  align-items: stretch;
  transition: transform 0.45s ease;
  will-change: transform;
}

.peek-slide {
  flex: none;
  min-width: 0;
}

.peek-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #eceff3;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}

.peek-media-slot,
.peek-media-slot img,
.peek-media-slot video {
  width: 100%;
  height: 100%;
}

.peek-media-slot img,
.peek-media-slot video {
  display: block;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  background: #eceff3;
}

.peek-hit {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.peek-slide.is-video.is-current .peek-hit { bottom: 48px; }

.peek-count {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  box-shadow: 0 2px 8px rgba(28, 33, 40, 0.12);
}

.peek-count[hidden] { display: none; }

.peek-arrow {
  position: absolute;
  top: 38%;
  z-index: 4;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(28, 33, 40, 0.16);
  font-size: 20px;
  line-height: 1;
}

.peek-prev { left: 10px; }
.peek-next { right: 10px; }

.peek-arrow[hidden] { display: none; }

.peek-caption {
  display: block;
  width: min(70%, 640px);
  margin: 12px auto 0;
  border: 0;
  background: transparent;
  text-align: center;
  padding: 0;
}

.peek-caption-title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
}

.peek-caption-meta {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 20px;
}

.work-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.work-tile .thumb {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #eceff3;
  box-shadow: var(--shadow);
}

.work-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-tile-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
}

.empty {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--line);
}

.site-footer {
  margin-top: 40px;
  font-size: 13px;
}

.site-footer code {
  background: white;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
}

.detail {
  width: min(1080px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  border: 0;
  padding: 18px;
  background: var(--bg);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(28, 33, 40, 0.18);
  overflow: auto;
}

.detail::backdrop { background: rgba(28, 33, 40, 0.45); }

.detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: -18px;
  margin: -18px -18px 14px;
  padding: 14px 18px;
  background: var(--bg);
  z-index: 2;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.detail-close {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.detail-visual img,
.detail-visual video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  background: #eceff3;
  box-shadow: var(--shadow);
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel {
  background: white;
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
}

.panel h2 {
  font-size: 1.45rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.detail-desc {
  margin-top: 10px;
  white-space: pre-wrap;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.meta-label {
  font-size: 13px;
  min-width: 5.5em;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #f3f5f7;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
}

.action-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.action-btn, .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.action-btn.primary, .arcade-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.arcade-btn:disabled {
  opacity: 0.7;
}

.arcade-frame {
  width: 100%;
  height: min(420px, 60vh);
  border: 0;
  border-radius: 12px;
  background: white;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 30px rgba(28, 33, 40, 0.12);
  }

  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }

  .sidebar-close { display: inline-flex; }
  .backdrop:not([hidden]) { display: block; }

  .main { margin-left: 0; padding: 14px 14px 48px; }

  .menu-toggle { display: inline-flex; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(244, 245, 247, 0.94);
    padding-bottom: 8px;
  }

  .brand p { display: none; }

  .gallery-section, .group-block { scroll-margin-top: 72px; }

  .peek-caption { width: min(84%, 640px); }
}

@media (max-width: 560px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .segmented { min-width: 0; width: 100%; }
  .toolbar-group { width: 100%; }
  .peek-arrow { width: 36px; height: 36px; }

  .topbar { flex-wrap: wrap; }
  .menu-toggle { order: 1; }
  .demo-badge { order: 2; margin-left: auto; }
  .brand { order: 3; flex: 1 0 100%; }
  .brand-mark { width: 28px; height: 28px; }
  h1 { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .peek-track { transition: none; }
  * { scroll-behavior: auto !important; }
}
