@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Young+Serif&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d1421;
  --panel: #121d2c;
  --panel-hover: #182638;
  --line: #26364a;
  --text: #edf2f8;
  --muted: #a6b5c8;
  --mint: #83d8bb;
  --amber: #efc583;
  --serif: "Young Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); }
a { color: var(--mint); text-underline-offset: 4px; }
button, input { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}
button, .button { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.skip { position: fixed; left: 12px; top: -80px; padding: 8px 14px; background: var(--bg); z-index: 10; }
.skip:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); background: #101928; }
.topbar { max-width: 1536px; min-height: 74px; margin: auto; padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.brand { color: var(--text); font: 22px/1.2 var(--serif); white-space: nowrap; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #203c39; color: var(--mint); font: bold 22px/1 var(--sans); }
.brand-accent { color: var(--mint); }
.global-search { position: relative; margin-left: auto; width: min(410px, 42vw); }
.global-search input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); padding: 0 44px 0 38px; }
.global-search input::placeholder { opacity: 1; color: var(--muted); }
.search-submit { position: absolute; top: 3px; left: 3px; width: 33px; height: 36px; border: 0; border-radius: 6px; background: transparent; }
.search-submit:hover { background: var(--panel-hover); }
.search-icon { position: absolute; left: 10px; top: 11px; width: 12px; height: 12px; border: 1.6px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 1.6px; background: var(--muted); right: -4px; bottom: -2px; transform: rotate(45deg); }
kbd { position: absolute; right: 11px; top: 9px; width: 23px; text-align: center; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 15px/20px monospace; pointer-events: none; }
.play-link { white-space: nowrap; color: var(--mint); font-size: 14px; font-weight: 700; text-decoration: none; }
.play-link:hover { text-decoration: underline; }
.play-link span { padding-left: 3px; }

.shell { max-width: 1536px; margin: 0 auto; display: grid; grid-template-columns: 224px minmax(0,1fr); align-items: start; }
.sidebar { padding: 30px 15px 30px 22px; position: sticky; top: 0; max-height: 100vh; overflow: auto; }
#menu-button { display: none; }
.nav-group { margin: 0 0 24px; }
.nav-heading { margin: 0 0 7px 11px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.nav-link { display: flex; gap: 10px; align-items: center; min-height: 36px; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link[aria-current="page"] { color: var(--mint); background: #19332f; }
.nav-link .glyph { width: 19px; text-align: center; color: var(--mint); }
.live-drop-badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #91353e; border-radius: 999px; padding: 2px 7px; background: #451b23; color: #ffb6bc; font-size: 10px; font-weight: 700; line-height: 1.3; letter-spacing: .06em; }
.nav-link .live-drop-badge { margin-left: auto; }
.live-drop-badge::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #ff6574; animation: live-drop-pulse 2s ease-out infinite; }
@keyframes live-drop-pulse {
  0% { box-shadow: 0 0 0 0 #ff657480; }
  75%, 100% { box-shadow: 0 0 0 4px #ff657400; }
}
@media (prefers-reduced-motion: reduce) {
  .live-drop-badge::before { animation: none; }
}
main { padding: 30px 34px 40px; min-height: calc(100vh - 74px); border-left: 1px solid var(--line); min-width: 0; }
main:focus { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.025em; }
h1 { margin-bottom: 12px; font-size: clamp(2.2rem, 4vw, 3.5rem); }
h2 { margin-bottom: 16px; font-size: 26px; }
h3 { margin-bottom: 6px; font-size: 17px; }

.hero { position: relative; min-height: 308px; display: flex; align-items: center; isolation: isolate; padding: clamp(24px, 4vw, 58px); border: 1px solid #344558; border-radius: 14px; overflow: hidden; background: #142231 url('./assets/twilight-village.jpg') right top / cover; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #080f1bea 0%, #080f1ba0 43%, #080f1b15 82%); }
.hero-scene { position: absolute; inset: 0; z-index: -2; container-type: size; pointer-events: none; }
.hero-scene svg { position: absolute; top: 0; right: 0; display: block; width: max(100cqw, 300cqh); height: auto; aspect-ratio: 3; }
.hero-lantern { mix-blend-mode: screen; animation: village-flicker 3.8s ease-in-out infinite; }
.hero-lantern:nth-child(3n + 2) { animation-duration: 4.6s; animation-delay: -2.3s; }
.hero-lantern:nth-child(3n) { animation-duration: 3.1s; animation-delay: -.8s; }
.hero-lantern:nth-child(even) { animation-direction: reverse; }
.hero-wisp { animation: village-drift 12s linear infinite; }
.hero-wisp:nth-child(2) { animation-delay: -4s; }
.hero-wisp:nth-child(3) { animation-delay: -8s; }
@keyframes village-flicker {
  0%, 100% { opacity: .38; }
  18%, 53% { opacity: .68; }
  31% { opacity: .23; }
  40%, 79% { opacity: .84; }
  64%, 91% { opacity: .32; }
}
@keyframes village-drift {
  0% { transform: translate(0, 0) scale(.52); opacity: 0; }
  13% { opacity: .16; }
  43% { transform: translate(23px, -36px) scale(.88); opacity: .12; }
  100% { transform: translate(82px, -90px) scale(1.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-motion { display: none; }
}
.hero-copy { max-width: 565px; min-width: 0; }
.hero-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 13px; margin-bottom: 10px; }
.hero-wordmark { --wordmark-width: clamp(162px, 21vw, 245px); display: inline-flex; align-items: center; flex: none; color: #32c1b0; }
.hero-wordmark-signature { width: var(--wordmark-width); aspect-ratio: 3; background: currentColor; mask: url('./assets/mzdunk-wordmark.png') center 49% / 103.9% auto no-repeat; }
.hero-wordmark-suffix { width: calc(var(--wordmark-width) * .147); aspect-ratio: 136 / 310; background: currentColor; mask: url('./assets/mzdunk-possessive.svg') center / contain no-repeat; }
.hero-brand-label { color: #e6f9f5; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 4.2rem); }
.hero-title-wiki { font-size: .55em; white-space: nowrap; }
.hero p:not(.hero-brand) { max-width: 405px; color: #d5dfeb; margin-bottom: 23px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 7px 15px; font-weight: 700; font-size: 14px; text-decoration: none; }
.button:hover { background: var(--panel-hover); }
.button.primary { border-color: var(--mint); background: var(--mint); color: #09271f; }
.button.primary:hover { background: #a1e7ce; }
.button.outline { border-color: #617184; background: #102030a8; }
.button.outline:hover { background: #22374c; }
.notice { margin: 16px 0 30px; display: flex; gap: 10px; align-items: baseline; background: #24211d; border: 1px solid #4a3a25; border-radius: 8px; padding: 10px 15px; color: #ece0ce; font-size: 13px; }
.notice a, .notice .glyph { color: var(--amber); font-weight: 700; }
.notice p { margin: 0; }

.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topic-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 13px; align-items: start; min-height: 103px; padding: 17px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); text-decoration: none; }
.topic-card:hover, .list-card:hover, .entry-card:hover { border-color: #53766f; background: var(--panel-hover); }
.topic-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--mint); background: #1b3837; font-size: 20px; }
.topic-card:nth-child(3n+2) .topic-icon { color: var(--amber); background: #3c3022; }
.topic-card:nth-child(3n) .topic-icon { color: #c0b2ff; background: #322c4a; }
.topic-name { font-weight: 700; display: block; margin-bottom: 2px; }
.topic-desc { color: var(--muted); font-size: 13px; line-height: 1.4; display: block; }
.arrow { color: var(--mint); }
.home-columns { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 22px; margin-top: 33px; }
.list-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-bottom-width: 0; background: var(--panel); padding: 13px 16px; }
.list-card:first-of-type { border-radius: 9px 9px 0 0; }
.list-card:last-of-type { border-radius: 0 0 9px 9px; border-bottom-width: 1px; }
.list-card strong, .list-card small { display: block; }
.list-card small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.updates { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 16px; }
.updates p { margin: 5px 0 12px; color: var(--muted); font-size: 14px; }
.updates time { color: var(--amber); font-size: 12px; }
.updates a { font-size: 14px; font-weight: 700; }
.footer { border-top: 1px solid var(--line); margin-top: 36px; padding: 17px 0 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 18px; }

.breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.intro { max-width: 77ch; color: var(--muted); margin-bottom: 22px; font-size: 17px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.filter { min-height: 36px; padding: 4px 12px; font-size: 13px; }
.filter:hover { border-color: var(--mint); }
.filter[aria-pressed="true"] { background: #19332f; color: var(--mint); border-color: #487768; }
.result-label { margin: 14px 0 11px; font-size: 14px; color: var(--muted); }
.entry-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.entry-card { min-width: 0; display: flex; justify-content: space-between; align-items: start; gap: 12px; color: var(--text); text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px; overflow-wrap: anywhere; }
.entry-card strong, .entry-card small { display: block; }
.entry-card small { margin-top: 2px; font-size: 13px; color: var(--muted); }
.entry-card-body { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tutorial-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; }
.tutorial-card-sprites { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); place-items: center; min-height: 116px; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: radial-gradient(ellipse, #394d55, #23323d 82%); }
.tutorial-card-sprites .game-sprite-frame { max-width: 108px; }
.tutorial-card-sprites .game-sprite-frame:not(:first-child) { max-width: 74px; }
.drop-status, .drop-help { color: var(--muted); font-size: 14px; }
.drop-status { margin: 14px 0 0; }
.drop-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 295px), 1fr)); gap: 16px; }
.drop-group h2 { margin-bottom: 10px; }
.drop-group ul { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.drop-group li + li { margin: 0; }
.drop-group p { margin: 0; }
.drop-avatar { position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; overflow: hidden; background: #233b37; color: var(--mint); font-weight: 700; }
.drop-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.entry-icon { flex: none; display: block; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(circle at 50% 40%, #233b37, var(--panel) 72%); object-fit: contain; image-rendering: pixelated; }
.entry-thumbnail { padding: 4px; border-radius: 8px; }
.pet-profile-header { display: flex; align-items: center; gap: clamp(12px, 3vw, 25px); margin: 0 0 20px; }
.pet-profile-header .intro { margin: 0; }
.pet-profile-header h1 { font-size: clamp(1.8rem, 4.4vw, 3.5rem); }
.artwork-header { display: grid; grid-template: "art title" auto "art facts" auto / auto minmax(0,1fr); align-items: start; column-gap: clamp(12px, 3vw, 25px); row-gap: 10px; }
.profile-art { grid-area: art; }
.artwork-title { grid-area: title; }
.artwork-title h1 { font-size: clamp(1.8rem, 4.4vw, 3.5rem); }
.artwork-title .intro { margin: 0; }
.artwork-header .facts { grid-area: facts; margin: 0; }
.item-art-group { display: grid; grid-template-columns: repeat(2,42px); gap: 4px; }
@media (max-width: 550px) {
  .artwork-header { grid-template-areas: "art title" "facts facts"; align-items: center; }
}
.more { margin: 16px 0 0; }
.empty { padding: 18px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.article { max-width: 950px; }
.article section { margin-top: 25px; }
.article section > p { max-width: 76ch; }
.article section > ul { padding-left: 23px; }
.article li + li { margin-top: 5px; }
.article .notice { margin-bottom: 23px; }
.location-map { margin: 18px 0 0; }
.location-map-image { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: clamp(4px, 1.5vw, 14px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.location-map-image img { display: block; max-width: 100%; max-height: 550px; width: auto; height: auto; image-rendering: pixelated; }
.location-map figcaption { padding: 7px 0 0; color: var(--muted); font-size: 13px; }
.game-sprites { display: flex; flex-wrap: wrap; gap: 12px; }
.game-sprite { flex: 0 1 260px; min-width: 0; margin: 0; }
.game-sprite-stage { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 226px; padding: 12px; background: radial-gradient(ellipse, #52636b, #263943 82%); border: 1px solid var(--line); border-radius: 12px; }
.game-sprite-link { position: relative; text-decoration: none; }
.game-sprite-link:hover { border-color: var(--mint); }
.game-sprite-link .arrow { position: absolute; top: 8px; right: 12px; }
.game-sprite-frame { position: relative; display: block; width: min(100%, var(--sprite-width)); overflow: hidden; }
.game-sprite-frame.flipped { transform: scaleX(-1); }
.game-sprite-layer { position: absolute; image-rendering: pixelated; }
.game-sprite figcaption { padding-top: 6px; color: var(--muted); font-size: 13px; }
.tutorial-screenshot { max-width: 790px; margin: 16px 0 0; }
.tutorial-screenshot-frame { position: relative; overflow: hidden; border-radius: 10px; background: var(--panel); }
.tutorial-screenshot-frame img { position: absolute; display: block; max-width: none; height: auto; image-rendering: pixelated; }
.tutorial-screenshot-marker { position: absolute; width: clamp(16px, 3vw, 32px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid #fff08a; border-radius: 50%; box-shadow: 0 0 0 2px #19120e; }
.tutorial-screenshot figcaption { padding-top: 7px; color: var(--muted); font-size: 13px; }
.tutorial-steps { max-width: 76ch; padding-left: 25px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(135px,100%),1fr)); gap: 9px; }
.facts div { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 11px 14px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 700; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-disclosure { margin: 9px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.table-disclosure summary { padding: 10px 14px; color: var(--mint); font-weight: 700; cursor: pointer; }
.table-disclosure .table-wrap { margin: 0 10px 10px; }
.table-disclosure td:first-child { width: 65%; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 65px; }
th { background: #1b2b3f; color: var(--text); }
tbody tr:nth-child(odd) { background: var(--panel); }
tr:last-child td { border-bottom: 0; }
.related { display: flex; flex-wrap: wrap; gap: 8px; }
.sources { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.sources h2 { font-size: 21px; }

.calculator { margin: 24px 0; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.calc-inputs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.calc-inputs label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.calc-inputs input { min-width: 0; width: 100%; height: 40px; padding: 5px 8px; border: 1px solid #496277; border-radius: 7px; background: var(--bg); color: var(--text); }
.calc-result { display: block; color: var(--mint); font-weight: 700; margin-top: 12px; }
.calculator details { margin-top: 18px; }
.calculator summary { color: var(--mint); cursor: pointer; }
.calculator details .table-wrap { margin-top: 9px; max-height: 470px; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 188px minmax(0,1fr); }
  .topbar { padding-inline: 20px; }
  .sidebar { padding-left: 13px; }
  main { padding-inline: 22px; }
  .topic-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
  .brand { font-size: 19px; }
  .brand-icon { width: 28px; height: 28px; }
  .global-search { order: 1; width: 100%; margin: 0; }
  .play-link { font-size: 13px; }
  .shell { display: block; }
  .sidebar { position: static; max-height: none; padding: 10px 14px 0; }
  #menu-button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 39px; padding: 6px 11px; color: var(--mint); font-size: 14px; font-weight: 700; }
  #wiki-nav { display: none; }
  #menu-button[aria-expanded="true"] + #wiki-nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; padding-top: 14px; }
  .nav-group { margin-bottom: 10px; }
  main { border: 0; padding: 14px 14px 28px; }
  .hero { min-height: 282px; }
  .hero::before { background: linear-gradient(90deg, #080f1bee, #080f1ba8 70%, #080f1b58); }
  .hero-scene svg { transform: translateX(4%); }
  .home-columns { grid-template-columns: 1fr; }
  .calc-inputs { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 445px) {
  .topic-grid, .entry-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 0; }
}
