:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #24211e;
  background: #f8f7f3;
  --paper: #f8f7f3;
  --matte: #eeece6;
  --ink: #24211e;
  --muted: #655e55;
  --line: #dcd8cf;
  --accent: #a93824;
  --accent-soft: #f2e4dc;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --header-height: 62px;
  --tools-height: 59px;
  --gutter: clamp(18px, 4vw, 62px);
}

* { box-sizing: border-box; }
body { min-width: 300px; margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(1280px, calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 5; top: 9px; left: var(--gutter); padding: 10px 16px; transform: translateY(-160%); background: var(--ink); color: var(--paper); }
.skip-link:focus { transform: none; }

.topbar { position: sticky; z-index: 3; top: 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-inner { height: calc(var(--header-height) - 1px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #c08270; color: var(--accent); }
.brand-icon .icon { width: 21px; height: 21px; }
.brand strong { color: var(--ink); font-size: 15px; font-weight: 780; letter-spacing: .14em; white-space: nowrap; }
.brand strong span { color: var(--muted); font-weight: 520; }
.favorites { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .18s, border-color .18s, color .18s; }
.favorites .icon { width: 16px; height: 16px; color: var(--accent); }
.favorites:hover { border-color: #b5a79b; background: #efede6; }
.favorites[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.favorites[aria-pressed="true"] .icon { color: #f1baaa; fill: currentColor; }
.favorite-count { min-width: 19px; padding-left: 8px; border-left: 1px solid var(--line); color: var(--muted); font: 12px/1.2 var(--mono); text-align: center; }
.favorites[aria-pressed="true"] .favorite-count { color: var(--paper); border-color: #746d63; }

.main { padding-top: clamp(18px, 2.4vw, 36px); }
.hero { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); align-items: center; column-gap: clamp(24px, 6vw, 100px); margin-bottom: 24px; }
.hero-text { padding-block: 6px; }
.hero-kicker { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--accent); font-size: 12px; font-weight: 620; letter-spacing: .14em; }
.hero-kicker span { width: 22px; height: 1px; background: currentColor; }
.hero h1 { display: flex; align-items: baseline; gap: .13em; margin: 9px 0 8px; font: 700 clamp(45px, 6.05vw, 86px)/1.15 var(--serif); letter-spacing: -.065em; white-space: nowrap; }
.hero h1 span { display: inline-block; width: .105em; height: .105em; background: var(--accent); }
.hero-description { max-width: 34em; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; text-wrap: pretty; }
.hero-stats { display: flex; gap: 20px; margin: 20px 0 0; }
.hero-stats div { display: flex; align-items: baseline; gap: 6px; }
.hero-stats div + div { border-left: 1px solid var(--line); padding-left: 20px; }
.hero-stats dd { margin: 0; font: 500 clamp(23px, 2.9vw, 36px)/1 Georgia, var(--serif); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.055em; }
.hero-stats dt { color: var(--muted); font-size: 11px; white-space: nowrap; }

.hero-plate {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  height: clamp(222px, 18.7vw, 275px);
  overflow: hidden;
  padding: 9px 45px 18px;
  border: 1px solid #d9d3c9;
  border-radius: 3px;
  background-color: var(--matte);
  background-image: linear-gradient(#d4cec366 1px, transparent 1px), linear-gradient(90deg, #d4cec366 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: center;
  transition: background-color .2s, border-color .2s;
}
.hero-plate:hover { border-color: #b99e8d; background-color: #ebe5da; }
.hero-plate::before { content: ""; position: absolute; z-index: -1; inset: 8px; border: 1px solid #d4cec3; pointer-events: none; }
.plate-index { position: absolute; top: 18px; left: 18px; display: grid; gap: 4px; text-align: left; color: var(--muted); font-size: 10px; }
.plate-index strong { color: var(--accent); font: 700 12px var(--mono); }
.plate-views { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; width: min(100%, 395px); height: 100%; min-height: 0; }
.plate-angle { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 3px; min-height: 0; min-width: 0; }
.plate-angle + .plate-angle { border-left: 1px dashed #c8bfb0; }
.plate-angle img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; transition: transform .24s ease; }
.hero-plate:hover .plate-angle img { transform: scale(1.035); }
.plate-angle > span { color: var(--muted); font-size: 10px; letter-spacing: .05em; white-space: nowrap; }
.plate-angle b { margin-right: 3px; color: var(--accent); font: 11px var(--mono); }
.plate-link { position: absolute; top: 17px; right: 17px; display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #d3cabe; border-radius: 2px; background: var(--paper); color: var(--accent); transition: background .18s, color .18s; }
.hero-plate:hover .plate-link { background: var(--accent); color: #fff; }

.library-tools { position: sticky; z-index: 2; top: var(--header-height); display: grid; grid-template-columns: minmax(0, 1fr) minmax(305px, .61fr); align-items: center; gap: 15px; min-height: var(--tools-height); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.series { display: flex; align-items: center; gap: clamp(9px, 1.5vw, 23px); align-self: stretch; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.series-button { position: relative; display: flex; flex: none; align-items: center; gap: 5px; min-height: 43px; padding: 0 1px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 530; white-space: nowrap; transition: color .16s, border-color .16s; }
.series-button:hover { color: var(--ink); }
.series-button:focus-visible { outline-offset: -3px; }
.series-button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 690; }
.series-count { color: var(--muted); font: 10px var(--mono); }
.series-button[aria-pressed="true"] .series-count { color: var(--accent); }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(103px, auto); gap: 8px; min-width: 0; padding-block: 7px; }
.search-box, .select-box { display: flex; align-items: center; gap: 7px; min-width: 0; height: 39px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: #fdfcf9; color: var(--muted); }
.search-box .icon, .select-box .icon { width: 16px; height: 16px; }
.search-box:focus-within, .select-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search-box input, .select-box select { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input::placeholder { color: var(--muted); }
.select-box { position: relative; max-width: 155px; }
.select-box select { appearance: none; padding-right: 16px; cursor: pointer; }
.select-chevron { position: absolute; right: 6px; pointer-events: none; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 17px 0 12px; scroll-margin-top: calc(var(--header-height) + var(--tools-height) + 14px); }
.section-heading h2 { margin: 0; font-size: 21px; font-weight: 660; letter-spacing: -.045em; }
.section-heading span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 25px clamp(11px, 1.6vw, 22px); }
.card { position: relative; min-width: 0; }
.pose-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.card-visual { position: relative; isolation: isolate; display: grid; place-items: center; overflow: hidden; aspect-ratio: 1.27; border: 1px solid #e3ded5; border-radius: 3px; background: var(--matte); transition: background .18s, border-color .18s; }
.pose-open:hover .card-visual, .pose-open:focus-visible .card-visual { border-color: #b8a697; background: #eae5dc; }
.card-visual img { position: absolute; display: block; width: 100%; height: 100%; padding-block: 5px; object-fit: contain; mix-blend-mode: multiply; transition: transform .24s ease; }
.pose-open:hover .card-visual img { transform: scale(1.045); }
.card-code { position: absolute; z-index: 1; top: 10px; left: 11px; padding: 2px 4px; background: var(--matte); color: #5d544a; font: 11px/1.25 var(--mono); }
.card-info { display: block; min-width: 0; padding: 9px 0 8px; border-bottom: 1px solid var(--line); }
.card-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 14px; line-height: 1.4; font-weight: 650; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.card-category { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-angles { display: inline-flex; align-items: center; gap: 3px; flex: none; white-space: nowrap; }
.card-angles .icon { width: 13px; height: 13px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #d6cfc5; border-radius: 4px; background: var(--paper); color: var(--muted); transition: background .18s, color .18s, border-color .18s; }
.icon-button:hover { border-color: #b79c8f; background: var(--accent-soft); color: var(--accent); }
.card-favorite { position: absolute; z-index: 1; top: 8px; right: 8px; width: 34px; height: 34px; border-color: transparent; background: #f8f7f3d9; }
.card-favorite .icon { width: 16px; height: 16px; }
.card-favorite[aria-pressed="true"] { border-color: #d3a397; background: var(--accent-soft); color: var(--accent); }
.card-favorite[aria-pressed="true"] .icon, .detail-favorite[aria-pressed="true"] .icon { fill: currentColor; }
.card-favorite:active, .favorites:active, .small-button:active { transform: translateY(1px); }

.empty { display: grid; justify-items: center; gap: 8px; min-height: 220px; padding: 38px 16px; border: 1px solid var(--line); background: #f1eee7; text-align: center; }
.empty > .icon { box-sizing: content-box; width: 23px; height: 23px; padding: 10px; border: 1px solid #d9c6bb; color: var(--accent); }
.empty h3 { margin: 3px 0 0; font-size: 17px; }
.empty p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.small-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-size: 12px; font-weight: 630; transition: background .18s, border-color .18s; }
.small-button:not(:disabled):hover { border-color: #bdaca0; background: #efeae1; }
.small-button:disabled { color: #80786d; background: #efede7; }
.small-button .icon { width: 16px; height: 16px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 26px; }
.pagination span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding: 15px 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

body:has(.detail[open]) { overflow: hidden; }
.detail { position: fixed; width: min(960px, calc(100vw - 36px)); max-width: none; max-height: calc(100dvh - 34px); overflow: auto; padding: 0; border: 1px solid #cfc5b7; border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px #34291f38; }
.detail::backdrop { background: #2e251db0; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.detail-visual { position: relative; isolation: isolate; display: grid; place-items: center; min-width: 0; min-height: 390px; height: min(71dvh, 660px); overflow: hidden; padding: 16px 24px 54px; background: var(--matte); }
.detail-visual img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; mix-blend-mode: multiply; }
.angle-prev, .angle-next { position: absolute; bottom: 11px; }
.angle-prev { right: 57px; }
.angle-next { right: 12px; }
.angle-position { position: absolute; bottom: 18px; left: 17px; padding: 4px 6px; background: var(--matte); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.detail-info { display: flex; flex-direction: column; min-width: 0; padding: 55px clamp(17px, 2.3vw, 31px) 22px; border-left: 1px solid var(--line); }
.detail-close { position: absolute; z-index: 1; top: 11px; right: 11px; }
.detail-series { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 650; }
.detail-info h2 { margin: 0; font: 700 clamp(21px, 2.7vw, 31px)/1.34 var(--serif); overflow-wrap: anywhere; }
.detail-meta { margin: 10px 0 20px; color: var(--muted); font-size: 12px; }
.angle-heading { display: flex; align-items: center; justify-content: space-between; padding-top: 13px; border-top: 1px solid var(--line); }
.angle-heading h3 { margin: 0; font-size: 13px; }
.angle-heading span { color: var(--muted); font-size: 11px; }
.angles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 10px 0 18px; }
.angle-button { min-width: 0; overflow: hidden; padding: 2px 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--matte); color: var(--muted); font-size: 10px; white-space: nowrap; transition: border-color .18s, background .18s; }
.angle-button img { display: block; width: 100%; height: auto; max-height: 80px; aspect-ratio: 4 / 5; object-fit: contain; mix-blend-mode: multiply; }
.angle-button:hover { border-color: #b69a8c; }
.angle-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.detail-favorite { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; margin-top: auto; border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 650; transition: background .18s; }
.detail-favorite:hover { background: #454039; }
.detail-favorite[aria-pressed="true"] { border-color: #d2a192; background: var(--accent-soft); color: var(--accent); }
.detail-favorite .icon, .original .icon { width: 16px; height: 16px; }
.original { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 39px; margin-top: 4px; color: var(--muted); font-size: 12px; text-decoration: none; }
.original:hover { color: var(--accent); text-decoration: underline; }
.toast { position: fixed; z-index: 4; right: 16px; bottom: 16px; max-width: calc(100vw - 32px); padding: 11px 14px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 13px; }

@media (max-width: 1030px) {
  :root { --tools-height: 100px; }
  .library-tools { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .series { gap: 20px; }
  .toolbar { grid-template-columns: minmax(0, 1fr) minmax(103px, auto); }
}

@media (max-width: 740px) {
  :root { --header-height: 56px; --tools-height: 0px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 17px; }
  .hero h1 { font-size: clamp(37px, 7.4vw, 53px); }
  .hero-description { font-size: 13px; }
  .hero-plate { height: 192px; padding-inline: 32px; }
  .hero-stats { gap: 12px; margin-top: 16px; }
  .hero-stats div + div { padding-left: 12px; }
  .plate-index { left: 12px; top: 13px; }
  .plate-link { top: 12px; right: 12px; width: 26px; height: 26px; }
  .plate-link .icon { width: 15px; height: 15px; }
  .library-tools { position: static; min-height: auto; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 18px; }
}

@media (max-width: 540px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .hero-text { padding-block: 1px; }
  .hero h1 { margin-block: 6px; font-size: clamp(43px, 11vw, 57px); }
  .hero-stats { margin-top: 13px; }
  .hero-plate { height: 164px; padding-block: 6px 13px; }
  .plate-views { max-width: 248px; }
  .series { gap: 17px; }
  .series-button { min-height: 40px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-visual { aspect-ratio: 1.17; }
  .card-code { top: 6px; left: 6px; font-size: 10px; }
  .card-favorite { top: 4px; right: 4px; width: 32px; height: 32px; }
  .card-title { font-size: 13px; }
  .card-meta { font-size: 10px; }
  .detail { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-visual { min-height: 205px; height: min(43dvh, 390px); padding: 11px 13px 42px; }
  .angle-prev, .angle-next { bottom: 6px; width: 34px; height: 34px; }
  .angle-prev { right: 50px; }
  .angle-position { bottom: 10px; }
  .detail-info { padding: 14px; border-top: 1px solid var(--line); border-left: 0; }
  .detail-meta { margin: 6px 0 11px; }
  .angle-heading { padding-top: 8px; }
  .angle-button img { max-height: 54px; }
  .angles { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
