:root {
  --navy: #071c46;
  --navy-2: #0b3157;
  --blue: #1554d1;
  --blue-soft: #eaf1ff;
  --ink: #183453;
  --muted: #65758a;
  --line: #dce5f0;
  --paper: #f7f9fc;
  --white: #fff;
  --shadow: 0 16px 45px rgba(7, 28, 70, .08);
  --container: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.library-container { width: min(var(--container), calc(100% - 64px)); margin-inline: auto; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-family: "Montserrat", "Noto Sans JP", sans-serif;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .16em;
}

.library-header {
  position: sticky;
  z-index: 100;
  top: 0;
  height: 76px;
  border-bottom: 1px solid rgba(7, 28, 70, .08);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
}
.library-header__inner {
  display: flex;
  width: min(1360px, calc(100% - 48px));
  height: 100%;
  margin-inline: auto;
  align-items: center;
  gap: 32px;
}
.library-logo { flex: 0 0 auto; line-height: 0; }
.library-logo img { width: auto; height: 42px; }
.library-nav { display: flex; margin-left: auto; align-items: center; gap: 36px; }
.library-nav a { font-size: .875rem; font-weight: 600; }
.library-nav a:hover { color: var(--blue); }
.proposal-trigger {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
}
.proposal-trigger b, .proposal-fab b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: .72rem;
}

.library-hero {
  position: relative;
  overflow: hidden;
  padding: 104px 0 88px;
  background:
    radial-gradient(circle at 80% 10%, rgba(21, 84, 209, .12), transparent 28%),
    linear-gradient(135deg, #fff 0%, #f7f9fc 62%, #eef4ff 100%);
}
.library-hero::before, .library-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.library-hero::before {
  top: -320px;
  right: -180px;
  width: 720px;
  height: 720px;
  border: 1px solid rgba(21, 84, 209, .13);
  border-radius: 50%;
}
.library-hero::after {
  bottom: -200px;
  left: -120px;
  width: 520px;
  height: 350px;
  border: 1px solid rgba(21, 84, 209, .1);
  border-radius: 50%;
}
.library-hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .72fr);
  align-items: end;
  gap: 80px;
}
.library-hero h1 {
  max-width: 720px;
  margin: 0;
  color: var(--navy);
  font-family: "Noto Serif JP", serif;
  font-size: clamp(3.25rem, 5vw, 4.75rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.045em;
}
.library-hero h1 em { color: var(--blue); font-style: normal; }
.library-hero__lead { max-width: 690px; margin: 32px 0 0; font-size: 1rem; line-height: 2; }
.library-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 28px 30px;
  border: 1px solid rgba(7, 28, 70, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.library-stats > div { min-width: 0; padding-inline: 20px; border-left: 1px solid var(--line); }
.library-stats > div:first-child { padding-left: 0; border-left: 0; }
.library-stats > div:last-child { padding-right: 0; }
.library-stats dt { color: var(--muted); font-size: .72rem; font-weight: 600; }
.library-stats dd { display: flex; margin: 7px 0 0; align-items: baseline; gap: 4px; color: var(--navy); }
.library-stats strong { font-family: "Noto Serif JP", serif; font-size: 2.35rem; line-height: 1; }
.library-stats span { font-size: .72rem; font-weight: 600; }

.library-search-section { position: relative; z-index: 5; margin-top: -38px; }
.search-panel { padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.search-panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.search-panel__heading h2, .section-heading h2, .library-guide h2, .proposal-drawer h2, .asset-dialog h2 {
  margin: 0;
  color: var(--navy);
  font-family: "Noto Serif JP", serif;
  font-size: 2rem;
  line-height: 1.45;
}
.search-panel__heading > p { margin: 0 0 3px; color: var(--muted); font-size: .8rem; }
.search-field {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  min-height: 68px;
  margin-top: 24px;
  padding: 0 18px;
  align-items: center;
  gap: 14px;
  border: 2px solid #cad8e8;
  border-radius: 10px;
  background: #fbfcfe;
  transition: border-color .2s, box-shadow .2s;
}
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(21, 84, 209, .1); }
.search-field svg { width: 25px; fill: none; stroke: var(--blue); stroke-width: 1.8; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--navy); font-size: 1rem; }
.search-field input::placeholder { color: #8795a6; }
.search-field button { min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--blue); font-size: .78rem; font-weight: 700; cursor: pointer; }
.search-suggestions { display: flex; margin-top: 18px; align-items: center; flex-wrap: wrap; gap: 9px; }
.search-suggestions span { margin-right: 5px; color: var(--muted); font-size: .72rem; }
.search-suggestions button, .category-tabs button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
}
.search-suggestions button:hover { border-color: var(--blue); color: var(--blue); }

.library-recommend, .library-results { padding: 96px 0 0; }
.section-heading { margin-bottom: 32px; }
.section-heading--row { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.section-heading--row > p { margin: 0 0 5px; color: var(--muted); font-size: .84rem; }
.section-heading--row > p strong { color: var(--blue); font-size: 1.35rem; }
.recommend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.recommend-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  min-width: 0;
  padding: 16px;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(7, 28, 70, .05);
}
.recommend-card img { width: 108px; height: 82px; border-radius: 8px; object-fit: cover; }
.recommend-card small { color: var(--blue); font-size: .68rem; font-weight: 700; }
.recommend-card h3 { margin: 5px 0 0; color: var(--navy); font-size: .96rem; line-height: 1.6; }

.results-heading { margin-bottom: 24px; }
.category-tabs { display: flex; margin-bottom: 32px; flex-wrap: wrap; gap: 10px; }
.category-tabs button { min-height: 46px; padding-inline: 20px; }
.category-tabs button.is-active { border-color: var(--navy); background: var(--navy); color: #fff; }
.works-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.work-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(7, 28, 70, .055);
  transition: transform .25s, box-shadow .25s;
}
.work-card:hover { transform: translateY(-4px); box-shadow: 0 18px 42px rgba(7, 28, 70, .1); }
.work-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #eaf0f7; }
.work-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.work-card:hover .work-card__media img { transform: scale(1.025); }
.work-card__format { position: absolute; top: 12px; right: 12px; padding: 5px 9px; border-radius: 6px; background: rgba(7, 28, 70, .86); color: #fff; font-size: .62rem; font-weight: 700; backdrop-filter: blur(8px); }
.work-card__body { display: flex; flex: 1; flex-direction: column; padding: 22px; }
.work-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--blue); font-size: .68rem; font-weight: 700; }
.work-card__meta span:last-child { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.work-card h3 { margin: 11px 0 0; color: var(--navy); font-size: 1.15rem; line-height: 1.6; }
.work-card__summary { margin: 10px 0 0; color: #41566e; font-size: .82rem; line-height: 1.8; }
.work-card__tags { display: flex; margin: 16px 0 0; flex-wrap: wrap; gap: 6px; }
.work-card__tags span { padding: 4px 8px; border-radius: 5px; background: var(--blue-soft); color: #28558d; font-size: .62rem; font-weight: 600; }
.work-card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 22px; }
.work-card__actions a, .work-card__actions button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #cbd8e7;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}
.work-card__actions .is-primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.work-card__actions button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.empty-state { padding: 64px 24px; border: 1px dashed #c6d3e3; border-radius: 12px; text-align: center; }
.empty-state p { margin: 0 0 18px; }
.empty-state button, .load-more { min-height: 48px; padding: 0 24px; border: 1px solid var(--navy); border-radius: 8px; background: #fff; color: var(--navy); font-weight: 700; cursor: pointer; }
.load-more-wrap { display: flex; margin-top: 36px; justify-content: center; }

.library-guide { margin-top: 112px; padding: 88px 0; background: var(--navy); color: #fff; }
.library-guide .eyebrow { color: #9fc3ff; }
.library-guide h2 { color: #fff; font-size: 2.45rem; }
.library-guide__grid { display: grid; grid-template-columns: .7fr 1.3fr; gap: 80px; }
.library-guide ol { display: grid; margin: 0; padding: 0; gap: 0; list-style: none; }
.library-guide li { display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 24px 0; align-items: start; gap: 20px; border-top: 1px solid rgba(255, 255, 255, .16); }
.library-guide li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .16); }
.library-guide li > span { color: #7fb0ff; font-family: "Montserrat", sans-serif; font-size: .82rem; font-weight: 700; }
.library-guide strong { font-size: 1.05rem; }
.library-guide li p { margin: 6px 0 0; color: rgba(255, 255, 255, .72); font-size: .82rem; }

.library-footer { padding: 48px 0 28px; background: #fff; }
.library-footer__inner { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 28px; }
.library-footer img { width: auto; height: 38px; }
.library-footer p { margin: 9px 0 0; color: var(--muted); font-size: .72rem; }
.library-footer__inner > div:nth-child(2) { display: flex; gap: 24px; font-size: .78rem; font-weight: 600; }
.library-footer small { grid-column: 1 / -1; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .65rem; }

.proposal-fab { display: none; }
.drawer-overlay { position: fixed; z-index: 198; inset: 0; background: rgba(4, 16, 41, .48); backdrop-filter: blur(3px); }
.proposal-drawer {
  position: fixed;
  z-index: 200;
  top: 0;
  right: 0;
  display: flex;
  width: min(430px, 100%);
  height: 100svh;
  padding: 28px;
  flex-direction: column;
  border: 0;
  background: #fff;
  box-shadow: -24px 0 60px rgba(4, 16, 41, .2);
  transform: translateX(102%);
  transition: transform .28s ease;
}
.proposal-drawer.is-open { transform: translateX(0); }
.proposal-drawer__header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.proposal-drawer h2 { font-size: 1.7rem; }
.icon-button { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--navy); font-size: 1.5rem; cursor: pointer; }
.proposal-purpose { display: grid; margin: 28px 0 18px; gap: 8px; }
.proposal-purpose label { color: var(--muted); font-size: .7rem; font-weight: 700; }
.proposal-purpose select { min-height: 48px; padding: 0 12px; border: 1px solid #cbd8e7; border-radius: 8px; background: #fff; color: var(--navy); }
.proposal-list { display: grid; min-height: 0; flex: 1; align-content: start; gap: 10px; overflow-y: auto; }
.proposal-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) 38px; padding: 10px; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; }
.proposal-item img { width: 64px; height: 52px; border-radius: 6px; object-fit: cover; }
.proposal-item strong { display: block; color: var(--navy); font-size: .78rem; line-height: 1.5; }
.proposal-item small { color: var(--muted); font-size: .62rem; }
.proposal-item button { display: grid; width: 38px; height: 38px; place-items: center; border: 0; background: transparent; color: #9a4d4d; cursor: pointer; }
.proposal-empty { margin-block: auto; padding: 30px 18px; color: var(--muted); font-size: .82rem; text-align: center; }
.proposal-drawer__footer { display: grid; margin-top: 18px; gap: 10px; }
.copy-proposal, .clear-proposal { min-height: 52px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.copy-proposal { border: 1px solid var(--navy); background: var(--navy); color: #fff; }
.clear-proposal { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.copy-proposal:disabled, .clear-proposal:disabled { opacity: .42; cursor: default; }
.proposal-drawer__footer p { min-height: 22px; margin: 0; color: var(--blue); font-size: .72rem; text-align: center; }

.asset-dialog { width: min(1120px, calc(100% - 40px)); max-height: calc(100svh - 40px); padding: 0; overflow: hidden; border: 0; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 35px 90px rgba(4, 16, 41, .3); }
.asset-dialog::backdrop { background: rgba(4, 16, 41, .72); backdrop-filter: blur(6px); }
.asset-dialog__header { display: flex; padding: 20px 24px; align-items: start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.asset-dialog h2 { font-size: 1.45rem; }
.asset-stage { display: grid; height: min(70svh, 680px); padding: 20px; place-items: center; overflow: auto; background: #edf2f8; }
.asset-stage img { max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain; box-shadow: 0 12px 32px rgba(7, 28, 70, .12); }
.asset-dialog__footer { display: grid; grid-template-columns: 120px 1fr 120px; padding: 14px 20px; align-items: center; gap: 16px; border-top: 1px solid var(--line); }
.asset-dialog__footer button { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font-size: .76rem; font-weight: 700; cursor: pointer; }
.asset-dialog__footer button:disabled { opacity: .35; }
.asset-dialog__footer p { display: flex; margin: 0; justify-content: center; gap: 12px; color: var(--muted); font-size: .74rem; }
.asset-dialog__footer strong { color: var(--navy); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(21, 84, 209, .35); outline-offset: 3px; }

@media (max-width: 1100px) {
  .library-hero__grid { grid-template-columns: 1fr; gap: 48px; }
  .library-stats { max-width: 700px; }
  .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recommend-grid { grid-template-columns: 1fr; }
  .recommend-card { grid-template-columns: 132px minmax(0, 1fr); }
  .recommend-card img { width: 132px; }
  .library-guide__grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 900px) {
  .search-panel__heading { display: block; }
  .search-panel__heading > p { margin-top: 8px; }
}

@media (max-width: 767px) {
  .library-container { width: calc(100% - 32px); }
  .library-header { height: 62px; }
  .library-header__inner { width: calc(100% - 28px); gap: 12px; }
  .library-logo img { height: 34px; }
  .library-nav { display: none; }
  .proposal-trigger { min-height: 44px; margin-left: auto; padding: 0 12px; }
  .proposal-trigger span { font-size: .72rem; }
  .library-hero { padding: 68px 0 74px; }
  .library-hero h1 { font-size: 2.4rem; line-height: 1.42; }
  .library-hero__lead { margin-top: 24px; font-size: .94rem; line-height: 1.9; }
  .library-stats { padding: 20px 16px; }
  .library-stats > div { padding-inline: 12px; }
  .library-stats strong { font-size: 1.8rem; }
  .library-stats dt, .library-stats span { font-size: .62rem; }
  .library-search-section { margin-top: -30px; }
  .search-panel { padding: 22px 18px; border-radius: 12px; }
  .search-panel__heading, .section-heading--row { display: block; }
  .search-panel__heading h2, .section-heading h2, .library-guide h2 { font-size: 1.6rem; }
  .search-panel__heading > p, .section-heading--row > p { margin-top: 8px; }
  .search-field { min-height: 60px; padding: 0 12px; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; }
  .search-field input { font-size: .88rem; }
  .search-suggestions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .search-suggestions::-webkit-scrollbar { display: none; }
  .search-suggestions span, .search-suggestions button { flex: 0 0 auto; }
  .library-recommend, .library-results { padding-top: 72px; }
  .recommend-card { grid-template-columns: 100px minmax(0, 1fr); padding: 12px; gap: 14px; }
  .recommend-card img { width: 100px; height: 76px; }
  .category-tabs { margin-right: -16px; padding-right: 16px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .category-tabs::-webkit-scrollbar { display: none; }
  .category-tabs button { flex: 0 0 auto; }
  .works-grid { grid-template-columns: 1fr; gap: 16px; }
  .work-card__body { padding: 20px; }
  .work-card__summary { font-size: .88rem; }
  .library-guide { margin-top: 80px; padding: 68px 0; }
  .library-guide li { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
  .library-footer__inner { grid-template-columns: 1fr; align-items: start; }
  .library-footer__inner > div:nth-child(2) { flex-wrap: wrap; }
  .library-footer small { grid-column: auto; }
  .proposal-fab { display: none; }
  .proposal-drawer { padding: 22px 18px; }
  .asset-dialog { width: calc(100% - 20px); max-height: calc(100svh - 20px); }
  .asset-stage { height: 60svh; padding: 10px; }
  .asset-dialog__header { padding: 16px; }
  .asset-dialog h2 { font-size: 1.1rem; }
  .asset-dialog__footer { grid-template-columns: 84px 1fr 84px; padding: 10px; gap: 8px; }
  .asset-dialog__footer p { display: grid; gap: 0; text-align: center; }
}

@media (max-width: 374px) {
  .library-hero h1 { font-size: 2.08rem; }
  .search-panel__heading h2 { font-size: 1.42rem; }
  .search-field button { padding-inline: 4px; }
  .work-card__actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
