:root {
  --bg: #0b1020;
  --bg-soft: #0e1424;
  --surface: #121827;
  --surface-hover: #182033;
  --surface-elevated: #151d30;
  --surface2: #151d30;
  --border: #273049;
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #f2efe7;
  --muted: #aeb6c8;
  --text-subtle: #7f89a3;
  --accent: #b9a7ff;
  --accent-strong: #aa96f2;
  --soft: rgba(185, 167, 255, 0.14);
  --accent-warm: #d7b77a;
  --accent-warm-soft: rgba(215, 183, 122, 0.14);
  --accent-cool: #8fd3e8;
  --accent-cool-soft: rgba(143, 211, 232, 0.13);
  --tag-bg: #242b3f;
  --tag-bg-hover: #2d3650;
  --tag-text: #d8d2ff;
  --tag-border: #303a57;
  --warn-bg: rgba(215, 183, 122, 0.12);
  --warn-border: rgba(215, 183, 122, 0.42);
  --warn-text: #e5c98e;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(185, 167, 255, 0.08), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(143, 211, 232, 0.05), transparent 30%);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, "Noto Sans JP", sans-serif;
  line-height: 1.65;
}

a {
  color: var(--accent);
}

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

/* ── Navigation ───────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 16, 32, 0.84);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.nav {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
  letter-spacing: 0;
  font-size: 1rem;
}

.brand::after {
  content: " ·";
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 140ms;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links .nav-lang {
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

/* ── Layout ───────────────────────────────── */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.hero {
  padding: 48px 0 36px;
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(340px, 1.04fr);
  gap: 48px;
  align-items: center;
}

.section {
  padding: 36px 0;
  border-top: 1px solid var(--border-soft);
}

/* ── Typography ───────────────────────────── */

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  max-width: 12em;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 16px;
}

h3 {
  font-size: 1.05rem;
}

.lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 640px;
  margin: 16px 0 0;
}

.library-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.library-stat strong {
  color: var(--accent-warm);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.02em;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 0;
}

/* ── Buttons ──────────────────────────────── */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.button {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 16px;
  background: var(--surface-elevated);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  font-family: inherit;
}

.button:hover {
  background: var(--surface-hover);
  border-color: rgba(185, 167, 255, 0.4);
}

.button.primary {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: #161b29;
}

.button.primary:hover {
  background: #e2c58c;
  border-color: #e2c58c;
  transform: translateY(-1px);
}

.button[disabled],
.button.disabled {
  color: var(--muted);
  background: var(--surface);
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Video ────────────────────────────────── */

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #070b16;
  box-shadow: var(--shadow);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.preview-panel {
  display: grid;
  gap: 12px;
}

.preview-status {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  padding: 12px 16px;
  display: grid;
  gap: 4px;
}

.preview-status strong {
  font-size: 1rem;
  color: var(--text);
}

.preview-status span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Notice ───────────────────────────────── */

.notice {
  margin: 28px 0;
  padding: 14px 18px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.92rem;
}

/* ── Work cards ───────────────────────────── */

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.work-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  display: flex;
  flex-direction: column;
}

.work-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(185, 167, 255, 0.34);
}

.work-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}

.work-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.work-card .tag-row {
  margin-top: auto;
  padding-top: 12px;
}

/* ── Tags ─────────────────────────────────── */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 140ms, border-color 140ms, color 140ms;
}

.tag:hover {
  background: var(--tag-bg-hover);
}

.tag.is-active {
  background: var(--soft);
  border-color: rgba(185, 167, 255, 0.62);
  color: var(--text);
}

/* ── License grid ─────────────────────────── */

.license-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.license-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.license-box h2,
.license-box h3 {
  margin-bottom: 10px;
}

.license-box ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.license-box ul li {
  margin-bottom: 6px;
}

/* ── Track list ───────────────────────────── */

.track-list {
  display: grid;
  gap: 10px;
}

.track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 160ms ease, border-color 160ms ease;
}

.track-card:hover {
  background: var(--surface-hover);
  border-color: rgba(185, 167, 255, 0.28);
}

.track-card.is-previewing {
  border-color: rgba(185, 167, 255, 0.72);
  background: var(--soft);
}

.track-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.track-id {
  color: var(--text-subtle);
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.btn-icon {
  min-height: 36px;
  min-width: 36px;
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Work page layout ─────────────────────── */

.work-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
}

.work-main {
  min-width: 0;
}

.hero-text {
  padding: 36px 0 24px;
}

.preview-sticky {
  position: sticky;
  top: 80px;
}

.track-filter,
.work-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.work-filter {
  margin-top: 16px;
}

.filter-empty {
  color: var(--text-subtle);
  margin: 0 0 16px;
}

.filter-tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--muted);
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 140ms, border-color 140ms, color 140ms;
  font-family: inherit;
}

.filter-tag:hover {
  background: var(--tag-bg-hover);
  border-color: rgba(185, 167, 255, 0.5);
  color: var(--text);
}

.filter-tag.is-active {
  background: var(--soft);
  border-color: rgba(185, 167, 255, 0.7);
  color: var(--text);
}

.filter-count {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.75rem;
}

.filter-tag.is-active .filter-count {
  background: rgba(255, 255, 255, 0.25);
}

.track-group-header {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.track-group-header:first-child {
  padding-top: 0;
}

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

  .preview-sticky {
    position: static;
    order: -1;
  }
}

/* ── Footer ───────────────────────────────── */

.footer {
  border-top: 1px solid var(--border-soft);
  color: var(--text-subtle);
  padding: 24px 20px 40px;
  text-align: center;
  font-size: 0.9rem;
}

/* ── Toast ────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  font-size: 0.92rem;
}

.toast.is-visible {
  opacity: 1;
}

/* ── Responsive ───────────────────────────── */

@media (max-width: 760px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav-links {
    flex-wrap: wrap;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 28px;
    gap: 28px;
  }

  .container {
    padding: 28px 16px 64px;
  }

  .work-grid {
    gap: 16px;
  }

  .work-card-body {
    padding: 14px;
  }

  .tag {
    padding: 2px 8px;
    font-size: 0.76rem;
  }

  .filter-tag {
    padding: 4px 10px;
    font-size: 0.78rem;
  }

  .track-card {
    grid-template-columns: 1fr;
  }

  .track-actions {
    justify-content: flex-start;
  }
}
