:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #121315;
  --line: #292a2e;
  --text: #f6f5f2;
  --muted: #afafb7;
  --amber: #ffc45f;
  --amber-light: #ffda8a;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 100%;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber-light); outline-offset: 4px; }
.wrap { width: min(1200px, calc(100% - 80px)); margin-inline: auto; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; z-index: 2; top: 10px; left: 12px; padding: 10px 15px; color: #201305; background: var(--amber); border-radius: 5px; }

.topbar { border-bottom: 1px solid #232428; background: #0e0f11; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 780; font-size: 1.23rem; letter-spacing: -.055em; white-space: nowrap; }
.brand-accent { color: var(--amber); }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 39px;
  padding: 0 13px; color: var(--muted); border: 1px solid transparent; border-radius: 8px;
  font-size: .875rem; font-weight: 650;
}
.nav-link:hover, .nav-current { color: var(--amber-light); border-color: #48351c; background: #1f180f; }

.hero {
  position: relative; isolation: isolate; overflow: hidden; min-height: 393px; margin-top: 30px;
  display: grid; align-items: center; border: 1px solid #48351e; border-radius: 18px;
  background: linear-gradient(110deg, #17120d, #0d0b08 65%);
}
.hero-art { position: absolute; inset: 0 0 0 38%; z-index: -1; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, #120f0a, transparent 31%);
}
.hero-copy { padding: 38px 0 42px 44px; width: 51%; }
.hero-label {
  display: inline-flex; gap: 9px; align-items: center; color: var(--amber);
  font: 700 .76rem/1.3 ui-monospace, Consolas, monospace; letter-spacing: .13em;
}
.hero-label .icon { width: 19px; height: 19px; }
.hero h1 {
  font-size: clamp(2.65rem, 5.1vw, 4.6rem); line-height: .99; letter-spacing: -.073em;
  font-weight: 810; margin-top: 15px;
}
.hero h1 span { color: var(--amber); }
.hero p { max-width: 390px; margin: 19px 0 24px; color: #c4bcb2; font-size: 1rem; line-height: 1.57; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 0 15px; border: 1px solid transparent;
  border-radius: 8px; font-size: .875rem; font-weight: 720;
  transition: background .16s, border-color .16s, color .16s;
}
.primary { background: var(--amber); color: #1d1509; border-color: #fbd087; }
.primary:hover { background: #ffda88; }
.secondary { background: #1a1b1f; color: var(--text); border-color: #34353a; }
.secondary:hover { background: #222327; border-color: #777065; }

.library { margin-top: 39px; margin-bottom: 53px; scroll-margin-top: 24px; }
.library-head h2, .related h2 { font-size: 1.95rem; font-weight: 760; letter-spacing: -.047em; }
.library-head p { margin-top: 5px; color: var(--muted); line-height: 1.5; }
.tools { margin-top: 19px; display: flex; gap: 10px; }
.search, .sort {
  min-height: 45px; display: flex; align-items: center; position: relative;
  background: #141517; border: 1px solid #2b2c30; border-radius: 8px;
}
.search { flex: 1; min-width: 0; gap: 10px; padding: 0 12px; color: #a9a9b2; }
.search:focus-within, .sort:focus-within { outline: 2px solid #b98639; outline-offset: 2px; }
.search input {
  flex: 1; width: 100%; min-width: 0; min-height: 43px; padding: 0; outline: 0;
  border: 0; background: transparent; color: var(--text); font-size: 1rem;
}
.search input::placeholder { color: #aaabb3; }
.search kbd {
  padding: 2px 7px; border: 1px solid #343538; border-radius: 4px; color: #b8b8bf;
  background: #1e1f22; font: .8rem Consolas, monospace;
}
.sort select {
  -webkit-appearance: none; appearance: none; border: 0; outline: 0; background: transparent;
  min-height: 43px; padding: 0 37px 0 13px; font-size: .875rem; font-weight: 620;
}
.sort option { background: #141517; }
.sort .icon { position: absolute; right: 11px; pointer-events: none; color: #b6b6be; }
.filter-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 13px 0 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  min-height: 39px; display: inline-flex; align-items: center; gap: 7px;
  background: #141517; border: 1px solid #2b2b2f; border-radius: 7px;
  color: #c3c3cb; padding: 0 12px; font-size: .875rem; font-weight: 630;
}
.chip:hover { background: #201e1b; color: var(--text); }
.chip[aria-pressed="true"] { color: var(--amber-light); border-color: #684e24; background: #2b2012; }
.result-count { color: var(--muted); font-size: .875rem; flex: none; }
.cards, .tags { padding: 0; margin: 0; list-style: none; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; transition: border-color .16s, background .16s;
}
.card:hover, .card:focus-within { border-color: #6b5229; background: #161615; }
.card-image { position: relative; }
.art {
  display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 47%, #53391c, #1b130b 74%);
  color: var(--amber); aspect-ratio: 2.12;
}
.art-violet { background: radial-gradient(ellipse at 50% 47%, #483461, #171022 74%); color: #d6a5ff; }
.art-lime { background: radial-gradient(ellipse at 50% 47%, #344722, #10150a 74%); color: #cee797; }
.art-blue { background: radial-gradient(ellipse at 50% 47%, #23466b, #091421 74%); color: #9cceff; }
.art > .icon { width: 3rem; height: 3rem; }
.art img { width: 100%; height: 100%; object-fit: cover; object-position: center 46%; }
.card-badges {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.category {
  display: inline-flex; width: fit-content; align-items: center; border: 1px solid #715420;
  background: #241b0d; color: var(--amber-light); border-radius: 5px;
  min-height: 25px; padding: 3px 8px; font-size: .78rem; font-weight: 700;
}
.tone-violet { border-color: #5d367a; background: #22122f; color: #e2b8ff; }
.tone-lime { border-color: #4e6a32; background: #172311; color: #cdeca6; }
.tone-blue { border-color: #315e84; background: #0e2030; color: #a7d8ff; }
.card-body { flex: 1; display: flex; flex-direction: column; padding: 14px 14px 11px; }
.card h3 { font-size: 1.15rem; letter-spacing: -.025em; line-height: 1.28; overflow-wrap: anywhere; }
.card-title:hover, .breadcrumb a:hover { color: var(--amber-light); }
.card p { color: var(--muted); margin: 6px 0 13px; font-size: .94rem; line-height: 1.45; overflow-wrap: anywhere; }
.card-bottom {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 4px 9px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid #26272a;
}
.date { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: .81rem; white-space: nowrap; }
.card-action { display: inline-flex; align-items: center; min-height: 36px; gap: 6px; color: var(--amber); font-size: .875rem; font-weight: 670; }
.card-action:hover { color: var(--amber-light); text-decoration: underline; }
.empty { padding: 54px 16px; text-align: center; border: 1px dashed #3c3730; border-radius: 12px; background: var(--panel); }
.empty > .icon { width: 2rem; height: 2rem; color: var(--amber); margin-bottom: 9px; }
.empty p { color: var(--muted); margin: 7px 0 20px; }
.library-empty { margin-top: 16px; }

.detail { margin-bottom: 57px; }
.breadcrumb {
  font-size: .875rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 29px 0 25px; color: var(--muted); overflow-wrap: anywhere;
}
.breadcrumb a { color: var(--amber); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); gap: 24px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-meta .date { margin-inline-start: 5px; }
.detail h1, .missing h1 { font-size: clamp(2.35rem, 6vw, 4.15rem); letter-spacing: -.067em; line-height: 1.04; margin: 12px 0; overflow-wrap: anywhere; }
.detail-summary, .missing p { color: var(--muted); font-size: 1.12rem; line-height: 1.5; overflow-wrap: anywhere; }
.game-button { margin-top: 14px; }
.detail-side .art { aspect-ratio: 1.6; border-radius: 12px; border: 1px solid #343339; }
.share-button { margin-top: 11px; width: 100%; }
.code-panel { margin-top: 23px; background: #111214; border: 1px solid #343132; border-radius: 11px; overflow: hidden; }
.code-heading {
  padding: 9px 10px 9px 15px; display: flex; flex-wrap: wrap; gap: 7px 12px;
  align-items: center; justify-content: space-between; background: #18191b; border-bottom: 1px solid #343132;
}
.code-heading h2 { display: flex; align-items: center; gap: 8px; font-size: .96rem; }
.code-heading h2 .icon { color: var(--amber); }
.code-panel pre {
  margin: 0; padding: 15px; max-height: 350px; overflow: auto;
  color: #f5d6a0; font: .875rem/1.65 Consolas, ui-monospace, monospace; tab-size: 4;
}
.code-panel pre:focus-visible { outline-offset: -3px; }
.code-panel code { font: inherit; }
.about { margin-top: 27px; }
.about h2 { font-size: 1.36rem; letter-spacing: -.024em; }
.about p { color: #c2c2ca; margin-top: 9px; line-height: 1.62; overflow-wrap: anywhere; }
.tags { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 4px 9px; font-size: .83rem; border: 1px solid var(--line); border-radius: 5px; color: #c3c3cb; background: var(--panel); overflow-wrap: anywhere; }
.related { margin-top: 35px; }
.related .cards { margin-top: 13px; }
.missing { padding-block: 70px; }
.missing .button { margin-top: 18px; }
.footer { border-top: 1px solid #242528; background: #0e0f11; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 75px; padding-block: 13px; }
.footer .brand { font-size: 1rem; }
.footer .brand img { width: 29px; height: 29px; }
.footer small { color: var(--muted); }
.toast {
  position: fixed; z-index: 3; right: 18px; bottom: 18px; max-width: calc(100% - 36px);
  padding: 10px 14px; border: 1px solid #705125; border-radius: 8px;
  background: #20180e; color: var(--amber-light); font-size: .875rem;
  opacity: 1; transition: opacity .16s;
}
.toast:empty { opacity: 0; pointer-events: none; }
.clipboard-fallback { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.manual-copy { border: 1px solid #674b23; border-radius: 8px; padding: 10px; margin-top: 10px; background: var(--panel); }
.manual-copy input { margin-top: 7px; width: 100%; padding: 6px; border: 1px solid var(--line); background: var(--bg); }

@media (max-width: 940px) {
  .wrap { width: min(100% - 48px, 1200px); }
  .hero { min-height: 352px; }
  .hero-copy { padding-left: 28px; width: 52%; }
  .hero-art { inset-inline-start: 41%; }
}

@media (max-width: 740px) {
  .wrap { width: calc(100% - 32px); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .detail-side { display: flex; flex-direction: column; align-items: flex-start; }
  .detail-side .art { display: none; }
  .share-button { width: auto; margin-top: 0; }
}

@media (max-width: 540px) {
  .nav { min-height: 62px; gap: 4px; }
  .nav .brand { font-size: 1.06rem; gap: 7px; }
  .nav .brand img { width: 30px; height: 30px; }
  .nav-link { padding-inline: 8px; gap: 5px; font-size: .81rem; }
  .hero { margin-top: 16px; min-height: 0; border-radius: 13px; }
  .hero-art { position: relative; inset: auto; order: 1; aspect-ratio: 1.85; }
  .hero-art img { object-position: center 48%; }
  .hero-art::after { background: linear-gradient(180deg, #130f0a, transparent 23%); }
  .hero-copy { width: 100%; padding: 22px 18px 8px; }
  .hero h1 { font-size: clamp(2.55rem, 10.5vw, 3.5rem); margin-top: 10px; }
  .hero p { margin: 12px 0 14px; }
  .library { margin: 28px auto 39px; }
  .library-head h2, .related h2 { font-size: 1.65rem; }
  .tools { gap: 7px; margin-top: 14px; }
  .search { padding-inline: 9px; gap: 6px; }
  .search kbd { display: none; }
  .sort select { padding-inline: 9px 26px; }
  .sort .icon { right: 6px; }
  .filter-line { flex-wrap: wrap; margin-bottom: 12px; }
  .chip { padding-inline: 8px; min-height: 42px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .footer-inner { min-height: 62px; }
}

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