:root {
  --bg: #f4f0e8;
  --ink: #24211d;
  --muted: #756d62;
  --line: rgba(36, 33, 29, 0.14);
  --paper: rgba(255, 252, 245, 0.86);
  --paper-strong: #fffaf0;
  --accent: #8f2f4f;
  --accent-2: #1f6f68;
  --gold: #bd8c45;
  --shadow: 0 22px 55px rgba(45, 35, 24, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(143, 47, 79, 0.16), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(31, 111, 104, 0.16), transparent 32%),
    linear-gradient(135deg, #f8f4ed 0%, var(--bg) 48%, #ebe4d8 100%);
  line-height: 1.7;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(248, 244, 237, 0.88);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "M PLUS Rounded 1c", "Noto Sans JP", sans-serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.site-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 252, 245, 0.62);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.site-nav a.is-current {
  color: #fff;
  background: var(--accent);
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search input {
  width: min(300px, 64vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 252, 245, 0.82);
  outline: none;
}

.search input:focus {
  border-color: rgba(31, 111, 104, 0.5);
  box-shadow: 0 0 0 3px rgba(31, 111, 104, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 22px;
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.sidebar,
.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 108px;
  align-self: start;
  max-height: calc(100vh - 132px);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head h2 {
  margin: 0;
  font-size: 16px;
}

#maskCount {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mask-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  max-height: calc(100vh - 188px);
  overflow-y: auto;
}

.mask-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.mask-item:hover,
.mask-item.is-active {
  border-color: rgba(143, 47, 79, 0.24);
  background: rgba(143, 47, 79, 0.08);
}

.mask-item strong {
  font-size: 14px;
}

.mask-item span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail {
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 22px;
  align-items: stretch;
  padding: clamp(20px, 4vw, 36px);
  background:
    linear-gradient(135deg, rgba(143, 47, 79, 0.1), transparent 46%),
    linear-gradient(160deg, var(--paper-strong), rgba(255, 252, 245, 0.62));
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1;
}

.role {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(31, 111, 104, 0.18);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(31, 111, 104, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.visual-panel {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px solid rgba(36, 33, 29, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(189, 140, 69, 0.18), transparent 44%),
    linear-gradient(145deg, rgba(31, 111, 104, 0.08), rgba(143, 47, 79, 0.08));
}

.image-frame {
  width: min(380px, 86%);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 24px rgba(36, 33, 29, 0.22));
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
}

.mask-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 252, 245, 0.72);
}

.mask-section h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.45;
}

.mask-section p {
  margin: 0;
  color: var(--muted);
}

.mask-section p + p {
  margin-top: 8px;
}

.empty {
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .mask-list {
    display: flex;
    overflow-x: auto;
    max-height: none;
  }

  .mask-item {
    min-width: 180px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .layout {
    width: min(100% - 20px, 1280px);
    margin-top: 14px;
  }

  .topbar {
    padding: 16px;
  }

  .search input {
    width: calc(100vw - 32px);
  }

  .visual-panel {
    min-height: 260px;
  }
}

/* Visual upgrade: theatrical mask introduction */
:root {
  --bg: #101010;
  --ink: #f7f0df;
  --muted: rgba(247, 240, 223, 0.72);
  --line: rgba(231, 201, 135, 0.2);
  --paper: rgba(18, 18, 18, 0.72);
  --paper-strong: rgba(255, 248, 231, 0.96);
  --accent: var(--mask-primary, #183a95);
  --accent-2: var(--mask-secondary, #d6b16d);
  --gold: var(--mask-secondary, #d6b16d);
  --mask-primary: #183a95;
  --mask-secondary: #d6b16d;
  --mask-glow: rgba(38, 89, 205, 0.38);
  --mask-skin: url("../images/functional-skins/優等生-skin.png");
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

body {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 16, 16, 0.92), rgba(16, 16, 16, 0.58), rgba(16, 16, 16, 0.96)),
    var(--mask-skin),
    #101010;
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 72%);
}

.topbar {
  border-bottom-color: rgba(231, 201, 135, 0.18);
  background: rgba(10, 10, 10, 0.78);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.eyebrow,
.sidebar-head h2,
#maskCount,
.search {
  color: var(--accent-2);
}

h1 {
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.site-nav a {
  color: rgba(247, 240, 223, 0.74);
  border-color: rgba(231, 201, 135, 0.22);
  background: rgba(255, 248, 231, 0.08);
}

.site-nav a.is-current {
  color: #14110b;
  border-color: color-mix(in srgb, var(--mask-secondary), transparent 40%);
  background: linear-gradient(135deg, var(--mask-secondary), #fff0bf);
}

.search input {
  color: var(--ink);
  background: rgba(255, 248, 231, 0.1);
  border-color: rgba(231, 201, 135, 0.22);
}

.search input::placeholder {
  color: rgba(247, 240, 223, 0.48);
}

.search input:focus {
  border-color: color-mix(in srgb, var(--mask-secondary), white 20%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mask-primary), transparent 76%);
}

.layout {
  width: min(1400px, calc(100% - 32px));
}

.sidebar,
.detail {
  border-color: rgba(231, 201, 135, 0.18);
  background: rgba(11, 11, 12, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar-head {
  border-bottom-color: rgba(231, 201, 135, 0.18);
}

.mask-list {
  gap: 8px;
}

.mask-item {
  min-height: 64px;
  color: var(--ink);
  border-color: rgba(231, 201, 135, 0.08);
  background: rgba(255, 248, 231, 0.045);
}

.mask-item:hover,
.mask-item.is-active {
  border-color: color-mix(in srgb, var(--mask-secondary), transparent 40%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mask-primary), transparent 72%), rgba(255, 248, 231, 0.08));
  box-shadow: inset 3px 0 0 var(--mask-secondary);
}

.mask-item span,
.role,
.mask-section p,
.empty {
  color: var(--muted);
}

.detail {
  overflow: hidden;
}

.hero {
  position: relative;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
  min-height: min(760px, calc(100vh - 150px));
  gap: clamp(18px, 4vw, 54px);
  align-items: center;
  padding: clamp(24px, 5vw, 64px);
  isolation: isolate;
  background:
    linear-gradient(90deg, rgba(8, 8, 9, 0.92), rgba(8, 8, 9, 0.5) 46%, rgba(8, 8, 9, 0.12)),
    var(--mask-skin);
  background-size: cover;
  background-position: center;
  border-bottom-color: rgba(231, 201, 135, 0.16);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 76% 44%, var(--mask-glow), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--mask-primary), transparent 62%), transparent 44%);
}

.hero-copy {
  max-width: 650px;
}

.hero-copy h2 {
  margin-bottom: 18px;
  color: #fff8e6;
  font-size: clamp(42px, 7vw, 96px);
  overflow-wrap: anywhere;
  line-break: strict;
  text-shadow: 0 16px 44px rgba(0, 0, 0, 0.58);
}

.role {
  max-width: 56ch;
  font-size: clamp(15px, 1.7vw, 19px);
}

.keyword {
  min-height: 34px;
  border-color: color-mix(in srgb, var(--mask-secondary), transparent 55%);
  color: #fff3cf;
  background: rgba(255, 248, 231, 0.09);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.symbol-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.symbol-section {
  grid-column: 1 / -1;
}

.symbol-card {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--mask-secondary), transparent 66%);
  border-radius: 14px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 248, 231, 0.12), rgba(255, 248, 231, 0.04)),
    rgba(16, 16, 16, 0.44);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.symbol-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.symbol-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff3cf;
  font-size: 18px;
  line-height: 1.35;
}

.symbol-card img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

.symbol-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.visual-panel {
  position: relative;
  min-height: clamp(520px, 62vw, 780px);
  overflow: hidden;
  border-color: rgba(231, 201, 135, 0.24);
  padding: clamp(18px, 2.2vw, 30px);
  background:
    linear-gradient(135deg, rgba(255, 248, 231, 0.08), transparent 18%, rgba(255, 248, 231, 0.05) 82%, transparent),
    linear-gradient(180deg, rgba(255, 248, 231, 0.12), rgba(255, 248, 231, 0.02)),
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--mask-secondary), transparent 56%), transparent 40%),
    rgba(8, 8, 9, 0.34);
}

.visual-panel::before,
.visual-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.visual-panel::before {
  inset: 18px;
  border: 1px solid rgba(231, 201, 135, 0.22);
}

.visual-panel::after {
  right: -14%;
  bottom: -22%;
  width: 64%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--mask-primary), transparent 42%);
  filter: blur(32px);
  opacity: 0.72;
}

.image-frame {
  position: relative;
  z-index: 1;
  width: min(570px, 92%);
  aspect-ratio: 4 / 5;
  padding: clamp(10px, 1.2vw, 16px);
  border: 1px solid color-mix(in srgb, var(--mask-secondary), transparent 42%);
  background:
    linear-gradient(135deg, rgba(255, 250, 232, 0.22), rgba(255, 250, 232, 0.04)),
    rgba(7, 7, 8, 0.34);
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 231, 0.08),
    inset 0 0 0 9px rgba(7, 7, 8, 0.24),
    0 28px 70px rgba(0, 0, 0, 0.34);
}

.image-frame img {
  object-fit: cover;
  border: 1px solid rgba(231, 201, 135, 0.34);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.36),
    0 0 90px var(--mask-glow);
  filter: saturate(1.08) contrast(1.04);
}

.image-frame::before,
.image-frame::after {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255, 241, 197, 0.2);
}

.image-frame::after {
  inset: 18px;
  border-color: rgba(0, 0, 0, 0.24);
}

.variant-gallery {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 26px);
  width: min(860px, 100%);
}

.variant-card {
  position: relative;
  display: grid;
  min-height: 0;
  padding: clamp(10px, 1.5vw, 16px);
  border: 1px solid rgba(231, 201, 135, 0.22);
  border-radius: 6px;
  color: #fff3cf;
  background:
    linear-gradient(180deg, rgba(255, 248, 231, 0.18), rgba(255, 248, 231, 0.05)),
    rgba(9, 9, 10, 0.74);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.variant-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255, 248, 231, 0.04);
  filter: saturate(1.02) contrast(1.02);
}

.story-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid rgba(231, 201, 135, 0.16);
  background: rgba(231, 201, 135, 0.16);
}

.story-card {
  min-height: 168px;
  padding: clamp(18px, 3vw, 28px);
  background:
    linear-gradient(135deg, rgba(255, 248, 231, 0.08), rgba(255, 248, 231, 0.02)),
    rgba(10, 10, 10, 0.82);
}

.story-card span {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--mask-secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-card p {
  margin: 0;
  color: rgba(247, 240, 223, 0.82);
}

.section-grid {
  gap: 1px;
  padding: 0;
  background: rgba(231, 201, 135, 0.14);
}

.mask-section {
  min-height: 220px;
  border: 0;
  border-radius: 0;
  padding: clamp(18px, 3vw, 30px);
  background: rgba(14, 14, 15, 0.84);
}

.mask-section h3 {
  color: #fff1c5;
  font-size: 18px;
}

.eye-mask-section {
  display: grid;
  align-content: start;
  gap: 14px;
}

.eye-mask-frame {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px solid rgba(231, 201, 135, 0.2);
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--mask-secondary), transparent 74%), transparent 48%),
    rgba(255, 248, 231, 0.05);
}

.eye-mask-frame img {
  display: block;
  width: min(420px, 92%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.34))
    saturate(1.04)
    contrast(1.02);
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .story-rail {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    min-height: auto;
  }

  .variant-gallery {
    width: min(820px, 100%);
    margin: 0;
  }
}

@media (max-width: 560px) {
  .layout {
    width: min(100% - 18px, 1400px);
  }

  .hero {
    padding: 20px;
  }

  .hero-copy h2 {
    font-size: clamp(36px, 13vw, 54px);
  }

  .visual-panel {
    min-height: auto;
    padding: 14px;
  }

  .variant-gallery {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0;
  }

  .symbol-row {
    grid-template-columns: 1fr;
  }

  .variant-card {
    min-height: auto;
  }

  .story-card,
  .mask-section {
    min-height: auto;
  }
}
