:root {
  color-scheme: dark;
  --bg: #0c0b0d;
  --panel: #151216;
  --panel-strong: #1d191e;
  --line: #2b242b;
  --line-strong: #4a3035;
  --text: #eee7dc;
  --muted: #9b9299;
  --quiet: #6c636a;
  --red: #e23636;
  --red-deep: #9d1f29;
  --gold: #b89a5a;
  --cyan: #63a8ad;
  --white: #f7f2ea;
  --black: #050505;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "BIZ UDPMincho", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(75, 33, 40, 0.22), rgba(12, 11, 13, 0) 380px),
    var(--bg);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.045;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 42px 42px;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 1000;
  transform: translateY(-150%);
  padding: 8px 12px;
  background: var(--white);
  color: #111;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 14px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 11, 13, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 38px;
}

.language-nav {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  background: var(--panel);
}

.language-nav a {
  min-width: 72px;
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.language-nav a[aria-current="page"] {
  background: var(--red);
  color: #fff;
}

.home-body main {
  padding-top: 86px;
}

.hero {
  padding: clamp(32px, 6vw, 68px) clamp(16px, 4vw, 46px) clamp(20px, 4vw, 34px);
  text-align: center;
}

.hero-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(48px, 9vw, 70px);
  font-weight: 800;
  line-height: 1.02;
}

.filter-bar {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 25;
  padding: 13px clamp(16px, 4vw, 46px);
  border-block: 1px solid var(--line);
  background: rgba(12, 11, 13, 0.9);
  backdrop-filter: blur(14px);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--red);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 0 14px 0 40px;
  background: var(--panel);
  color: var(--text);
}

.search-box input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(226, 54, 54, 0.16);
}

.segmented {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  background: var(--panel);
}

.segmented button,
.chip-row button,
.icon-button {
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.segmented button {
  min-width: 74px;
  height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

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

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 11px;
  padding-bottom: 4px;
}

.chip-row button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 13px;
  background: #121014;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chip-row button[aria-pressed="true"] {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.character-grid-wrap {
  padding: 16px clamp(16px, 4vw, 46px) 56px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: clamp(10px, 1.5vw, 18px);
}

.character-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  color: inherit;
  text-align: center;
  text-decoration: none;
  transition: transform 0.16s ease;
}

.character-card:hover,
.character-card:focus-visible {
  transform: translateY(-3px);
}

.portrait-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.character-card:hover .portrait-frame,
.character-card:focus-visible .portrait-frame {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(226, 54, 54, 0.16);
}

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

.character-card-overlay {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  text-align: left;
}

.character-card-name-overlay {
  top: 0;
  padding: 8px 8px 28px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.62) 54%, rgba(0, 0, 0, 0));
}

.character-card-origin-overlay {
  bottom: 0;
  padding: 22px 8px 7px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.42) 58%, rgba(0, 0, 0, 0));
}

.character-name {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.22;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.78);
  white-space: nowrap;
}

.character-meta {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-sentinel {
  min-height: 60px;
  padding: 34px 0 8px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.empty-state {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
}

.detail-main {
  padding: clamp(14px, 3vw, 32px);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 64%) minmax(360px, 36%);
  grid-template-areas:
    "profile standing"
    "works standing";
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.detail-profile {
  grid-area: profile;
  display: grid;
  grid-template-columns: minmax(220px, 48%) minmax(0, 1fr);
  grid-template-areas: "face title";
  gap: clamp(16px, 2.5vw, 30px);
  align-items: start;
}

.detail-face {
  grid-area: face;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.detail-face img,
.standing-stage img,
.work-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-title-block {
  grid-area: title;
  min-width: 0;
  align-self: start;
}

.origin-title {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 900;
}

.detail-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.7vw, 64px);
  line-height: 1.08;
}

.standing-carousel {
  min-width: 0;
}

.standing-column {
  position: sticky;
  top: 90px;
  grid-area: standing;
  min-width: 0;
}

.standing-stage {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  height: min(76vh, 820px);
  min-height: 520px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.standing-stage img {
  position: absolute;
  inset: 0;
  object-fit: contain;
  opacity: 0;
  transition: opacity 420ms ease;
}

.standing-stage img.is-active {
  opacity: 1;
}

.standing-stage:focus-visible {
  outline: 3px solid rgba(226, 54, 54, 0.72);
  outline-offset: 3px;
}

.standing-carousel.is-user-control .standing-stage img {
  transition: none;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--red);
  background: #21171b;
}

.carousel-dots {
  display: flex;
  gap: 7px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: var(--line-strong);
  cursor: pointer;
}

.carousel-dot.is-active {
  background: var(--red);
}

.section-stack {
  grid-area: works;
  margin-top: 0;
}

.work-section {
  padding-block: 0 24px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin: 14px 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 38px);
}

.section-title strong {
  color: var(--red);
}

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

.work-card {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.work-card:hover,
.work-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--red);
  background: var(--panel-strong);
}

.work-main-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.work-card-video {
  display: flex;
  flex-direction: column;
}

.work-video-link {
  display: flex;
  flex-direction: column;
}

.work-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  overflow: hidden;
  background: #000;
}

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

.work-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.work-video-title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  padding: 10px 12px;
  color: var(--white);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.work-video-title strong {
  overflow-wrap: anywhere;
}

.video-work-body {
  min-height: 100vh;
  background: var(--ink);
}

.video-work-main {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 58px) clamp(16px, 4vw, 44px) 64px;
}

.video-work-back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-bottom: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 7px 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.video-work-back:hover,
.video-work-back:focus-visible {
  border-color: var(--gold);
  background: rgba(184, 154, 90, 0.1);
}

.video-work-title {
  margin: 0 0 clamp(18px, 3vw, 30px);
  color: var(--white);
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.15;
}

.video-work-player {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

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

.work-thumb {
  position: relative;
  overflow: hidden;
  height: 100%;
  aspect-ratio: 1 / 1;
  background: var(--white);
}

.work-info {
  position: absolute;
  inset: 0 0 auto;
  padding: 12px 12px 44px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0));
  color: #fff;
}

.work-info strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.work-actions {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  flex-wrap: wrap;
  gap: 7px;
  padding: 36px 12px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0));
}

.work-external-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
}

.work-external-link:hover,
.work-external-link:focus-visible {
  border-color: var(--gold);
  background: rgba(184, 154, 90, 0.12);
}

.viewer-body {
  overflow: hidden;
  background: #000;
}

.viewer-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
  user-select: none;
  touch-action: pan-y;
}

.viewer-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 260ms ease;
}

.viewer-image.is-active {
  opacity: 1;
}

.viewer-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.viewer-root.is-video {
  user-select: auto;
  touch-action: auto;
}

.viewer-root.is-video .viewer-bottom {
  display: none;
}

.viewer-top,
.viewer-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 220ms ease, opacity 220ms ease;
}

.viewer-top {
  top: 0;
  justify-content: space-between;
  padding: 14px clamp(14px, 3vw, 28px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0));
}

.viewer-bottom {
  bottom: 0;
  padding: 18px clamp(14px, 3vw, 28px) 22px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
}

.viewer-root.is-idle .viewer-top {
  opacity: 0;
  transform: translateY(-100%);
}

.viewer-root.is-idle .viewer-bottom {
  opacity: 0;
  transform: translateY(100%);
}

.viewer-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.viewer-title strong {
  display: block;
  overflow: hidden;
  color: var(--white);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-title span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.viewer-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.viewer-links {
  display: flex;
  gap: 8px;
}

.viewer-links:empty {
  display: none;
}

.viewer-links a {
  border: 1px solid rgba(184, 154, 90, 0.56);
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(61, 42, 24, 0.48);
  color: #f0d68f;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.viewer-close {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.viewer-slider {
  flex: 1 1 auto;
  width: 100%;
  accent-color: var(--red);
}

.viewer-message {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 12;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.8;
  text-align: center;
}

@media (max-width: 860px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "profile standing"
      "works works";
    gap: 12px 10px;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .home-body main {
    display: flex;
    flex-direction: column;
    padding-top: 0;
  }

  .hero {
    order: 2;
    padding: 12px clamp(16px, 4vw, 46px) 8px;
    text-align: center;
  }

  .hero-title {
    font-size: clamp(22px, 6vw, 34px);
    line-height: 1.12;
  }

  .filter-bar {
    order: 1;
    position: sticky;
    top: 64px;
  }

  .character-grid-wrap {
    order: 3;
  }

  .segmented {
    overflow-x: auto;
  }

  .segmented button {
    flex: 1 0 auto;
  }

  .detail-profile {
    grid-template-columns: 1fr;
    grid-template-areas:
      "face"
      "title";
    gap: 10px;
  }

  .standing-column {
    position: static;
  }

  .standing-stage {
    height: auto;
    min-height: 0;
    aspect-ratio: 2 / 3;
  }

  .section-stack {
    margin-top: 2px;
  }
}

@media (max-width: 520px) {
  .site-header {
    gap: 10px;
    min-height: 52px;
    padding: 8px 12px;
  }

  .brand-logo {
    height: 32px;
  }

  .language-nav a {
    min-width: auto;
    padding: 7px 8px;
    font-size: 11px;
  }

  .filter-bar {
    top: 52px;
    padding: 8px 10px 7px;
  }

  .hero {
    padding: 8px 10px 6px;
  }

  .hero-title {
    font-size: 24px;
  }

  .filter-row {
    flex-direction: row;
    gap: 8px;
  }

  .search-box {
    flex-basis: auto;
  }

  .search-box input {
    height: 40px;
  }

  .segmented button {
    height: 32px;
    min-width: 64px;
  }

  .chip-row {
    gap: 6px;
    margin-top: 7px;
    padding-bottom: 2px;
  }

  .chip-row button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .character-grid-wrap {
    padding: 10px 10px 40px;
  }

  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  }

  .character-card-name-overlay {
    padding: 6px 6px 22px;
  }

  .character-card-origin-overlay {
    padding: 18px 6px 6px;
  }

  .character-name {
    font-size: 12px;
  }

  .character-meta {
    font-size: 9px;
  }

  .detail-main {
    padding: 12px 10px 28px;
  }

  .detail-profile {
    gap: 10px;
  }

  .detail-title {
    font-size: clamp(30px, 10vw, 42px);
  }

  .origin-title {
    margin-bottom: 6px;
  }

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

  .viewer-top {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .viewer-actions {
    max-width: 56vw;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .viewer-bottom {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

}
