/* Doki Doki Modding Central: one stylesheet for the whole site.
   A pastel club room: soft skies, polaroid cards, game-menu buttons, and Matsuda. */

@font-face {
  font-family: "Mochiy Pop One";
  src: url("/assets/fonts/mochiypop.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Zen Maru Gothic";
  src: url("/assets/fonts/zenmaru-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Zen Maru Gothic";
  src: url("/assets/fonts/zenmaru-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nova Square";
  src: url("/assets/fonts/novasquare.woff2") format("woff2");
  font-display: swap;
}

/* ---------- Tokens: each color carries its light and dark value ---------- */

:root {
  color-scheme: light dark;
  --bg: light-dark(#fcf6fa, #1a1421);
  --card: light-dark(#ffffff, #271e30);
  --ink: light-dark(#3b2b42, #f8eef6);
  --ink-soft: light-dark(#715f78, #cdbad3);
  --line: light-dark(#f0dbe8, #3d3047);
  --link: light-dark(#0f7380, #7fdbe3);
  --pink: light-dark(#e0548a, #ff8bb7);
  --pink-deep: light-dark(#bd3a6d, #ffadcc);
  --lilac: light-dark(#8a6bd6, #b9a3ff);
  --teal: light-dark(#14899a, #6ad4dd);
  --mint: light-dark(#2e9a7b, #72dcb9);
  --butter: light-dark(#e0a21c, #ffd36e);
  --sky: light-dark(#3a86d0, #8fc3ff);
  --btn-a: light-dark(#cc3f78, #ff8bb7);
  --btn-b: light-dark(#7a5ac8, #c3adff);
  --on-btn: light-dark(#ffffff, #2a0f22);
  --shadow:
    0 2px 0 var(--line),
    0 16px 30px -20px light-dark(rgb(189 58 109 / 0.5), rgb(0 0 0 / 0.8));
  --sky-top: light-dark(#ffe4ef, #2c1838);
  --sky-mid: light-dark(#f2e8ff, #1e1733);
  --sky-low: light-dark(#e2f5f3, #10212b);
  /* Faint paper grain: neutral grey noise, so the same tile reads on light and dark. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .5 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --scene-wash: light-dark(rgb(252 246 250 / 0.62), rgb(26 20 33 / 0.68));
  --night: #132029;
  --brass: #d9b77b;
  --parchment: #f0e6d2;
  --accent: var(--pink);
  --font-display: "Mochiy Pop One", "Zen Maru Gothic", system-ui, sans-serif;
  --font-ui:
    "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold",
    system-ui, sans-serif;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header: 84px;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

/* Each section of the site has its own color. */
[data-page="fangames"],
[data-page="gui"],
[data-page="addons"],
[data-page="report"] {
  --accent: var(--teal);
}
[data-page="art"],
[data-page="about"] {
  --accent: var(--lilac);
}
[data-page="videos"],
[data-page="assets"] {
  --accent: var(--sky);
}
[data-page="audio"],
[data-page="faq"],
[data-page="soon"] {
  --accent: var(--butter);
}
[data-page="writing"],
[data-page="code"],
[data-page="classroom"],
[data-page="template"],
[data-page="resources"] {
  --accent: var(--mint);
}

/* Each page stands somewhere from the game: a faded scene behind its title (see body::after). */
[data-page="home"],
[data-page="mods"],
[data-page="mod"] {
  --scene: url("/assets/images/scenes/club.webp");
}
[data-page="fangames"] {
  --scene: url("/assets/images/scenes/house.webp");
}
[data-page="resources"] {
  --scene: url("/assets/images/scenes/bedroom.webp");
}
[data-page="videos"],
[data-page="about"],
[data-page="report"] {
  --scene: url("/assets/images/scenes/corridor.webp");
}
[data-page="assets"],
[data-page="art"],
[data-page="characters"],
[data-page="gui"],
[data-page="audio"],
[data-page="code"] {
  --scene: url("/assets/images/scenes/residential.webp");
}
[data-page="writing"] {
  --scene: url("/assets/images/scenes/notebook.webp");
}
[data-page="classroom"],
[data-page="template"],
[data-page="addons"] {
  --scene: url("/assets/images/scenes/classroom.webp");
}
[data-page="faq"] {
  --scene: url("/assets/images/scenes/closet.webp");
}
[data-page="submit"] {
  --scene: url("/assets/images/scenes/kitchen.webp");
}
[data-page="soon"] {
  --scene: url("/assets/images/scenes/sorry.webp");
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header) + 12px);
  scrollbar-color: color-mix(in srgb, var(--pink) 55%, transparent) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.65 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Soft color in the corners and a faint paper grain, behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    var(--grain) 0 0 / 240px 240px,
    radial-gradient(
      42vmax 42vmax at 0% 0%,
      color-mix(in srgb, var(--pink) 13%, transparent),
      transparent 70%
    ),
    radial-gradient(
      38vmax 38vmax at 100% 6%,
      color-mix(in srgb, var(--lilac) 12%, transparent),
      transparent 70%
    ),
    radial-gradient(
      40vmax 40vmax at 100% 100%,
      color-mix(in srgb, var(--teal) 9%, transparent),
      transparent 70%
    ),
    radial-gradient(
      34vmax 34vmax at 0% 100%,
      color-mix(in srgb, var(--butter) 10%, transparent),
      transparent 70%
    );
}

/* The page's scene, washed in the page color and dissolving into it further down. */
body:not([data-page="home"])::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 640px;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(var(--scene-wash), var(--scene-wash)),
    var(--scene, none) center 40% / cover no-repeat;
  mask-image: linear-gradient(#000 30%, transparent);
}

main {
  flex: 1;
}

img,
svg,
video,
iframe {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
}
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
}
h3,
h4 {
  font-family: var(--font-ui);
  font-weight: 700;
}
p,
li,
dd {
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--pink-deep);
}

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}

::selection {
  background: var(--pink);
  color: #fff;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Type ---------- */

.page-head {
  padding: clamp(36px, 6vw, 72px) 0 clamp(24px, 4vw, 40px);
  text-align: center;
}
.page-head h1 {
  font-size: clamp(36px, 6vw, 62px);
  line-height: 1.1;
}
/* A hand-drawn squiggle in the section's color. The wave spans y 1.5 to 18.5 of its 20px box,
   and the em gap clears this font's descenders, which hang about 0.28em below the baseline. */
.page-head h1::after {
  content: "";
  display: block;
  width: 132px;
  height: 20px;
  margin: 0.36em auto 0;
  background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='20'%3E%3Cpath d='M3 10c10-8 20-8 30 0s20 8 30 0 20-8 30 0 20 8 30 0' fill='none' stroke='black' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E")
    center / 132px 20px no-repeat;
}
.page-head .lede {
  margin: 16px auto 0;
}

.lede {
  margin: 0;
  max-width: 58ch;
  font-size: clamp(17px, 1.6vw, 19px);
  line-height: 1.6;
  color: var(--ink-soft);
}

.section {
  margin-top: clamp(56px, 8vw, 96px);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 22px;
}
.section-head h2 {
  font-size: clamp(25px, 3vw, 32px);
}
.section-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

.prose {
  max-width: 70ch;
  font-size: 17px;
  line-height: 1.75;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose h2 {
  font-size: 25px;
  margin: 1.8em 0 0.6em;
}
.prose h3 {
  font-size: 19px;
  margin: 1.5em 0 0.5em;
}
.prose > :first-child {
  margin-top: 0;
}
.prose > :last-child {
  margin-bottom: 0;
}
.prose strong {
  font-weight: 700;
}

/* A notebook margin line beside long reading columns. */
.margin-rule {
  position: relative;
  padding-left: clamp(18px, 3vw, 32px);
}
.margin-rule::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--pink) 55%, transparent);
}

/* ---------- Controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  color: var(--on-btn);
  font: 700 16px/1.2 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  box-shadow:
    0 10px 20px -12px var(--btn-b),
    inset 0 -3px 0 rgb(0 0 0 / 0.14);
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    filter 0.15s;
}
.btn:hover {
  color: var(--on-btn);
  transform: translateY(-2px);
  filter: brightness(1.06);
}
.btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.14);
}
.btn-quiet {
  background: var(--card);
  color: var(--ink);
  box-shadow:
    0 0 0 2px var(--line) inset,
    0 3px 0 var(--line);
}
.btn-quiet:hover {
  color: var(--pink-deep);
  filter: none;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--pink) 55%, var(--line)) inset,
    0 4px 0 var(--line);
}
.btn-quiet:active {
  box-shadow: 0 0 0 2px var(--line) inset;
}
.btn-small {
  min-height: 36px;
  padding: 6px 15px;
  font-size: 14px;
}
.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.field {
  height: 46px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 500 16px var(--font-ui);
}
.field::placeholder {
  color: var(--ink-soft);
  opacity: 0.9;
}
.field:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pink) 45%, transparent);
  outline-offset: 0;
  border-color: var(--pink);
}
select.field {
  appearance: none;
  padding-right: 40px;
  background: var(--card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e0548a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 16px center;
}

.chip {
  --c: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 15px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 700 14px/1 var(--font-ui);
  text-decoration: none;
  transition:
    border-color 0.15s,
    background-color 0.15s;
}
.chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.chip:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--c) 60%, var(--line));
}
.chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--c) 20%, var(--card));
  border-color: var(--c);
}
.chip .n {
  font-weight: 500;
  color: var(--ink-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  --c: var(--accent);
  padding: 1px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 16%, var(--card));
  color: var(--ink);
  font: 700 12px/20px var(--font-ui);
}

/* A label stuck onto a thumbnail like a sticker. */
.sticker {
  --c: var(--accent);
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 2px 10px;
  border-radius: 8px;
  border: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 22%, var(--card));
  color: var(--ink);
  font: 700 12px/1.5 var(--font-ui);
  rotate: -3deg;
  box-shadow: 0 4px 10px -4px rgb(0 0 0 / 0.35);
}

/* Theme switch, shared by the header and the home screen. */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  transition:
    transform 0.2s,
    border-color 0.15s;
}
.theme-toggle:hover {
  border-color: var(--butter);
  transform: rotate(-12deg);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px var(--gutter) 0;
  view-transition-name: site-header;
}
.header-in {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: var(--wrap);
  height: 62px;
  margin: 0 auto;
  padding: 0 10px 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 400 16px/1.1 var(--font-display);
}
.brand:hover {
  color: var(--ink);
}
.brand img {
  width: 42px;
  height: 42px;
  transition: transform 0.4s;
}
.brand:hover img {
  transform: rotate(-20deg);
}
.brand-short {
  display: none;
}

.site-nav {
  margin-left: auto;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-group {
  position: relative;
}

.nav-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: 700 15px/1 var(--font-ui);
  text-decoration: none;
  transition: background-color 0.15s;
}
.nav-top:hover,
.nav-group.open > .nav-top {
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  color: var(--ink);
}
button.nav-top::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0.55;
  transition: transform 0.2s;
}
.nav-group.open > button.nav-top::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}
.nav-top.current,
.nav-group.current > .nav-top {
  background: color-mix(in srgb, var(--pink) 16%, transparent);
  color: var(--pink-deep);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  translate: -50% 0;
  z-index: 5;
  display: none;
  min-width: 210px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.nav-group.open > .nav-menu {
  display: block;
  animation: drop 0.18s ease-out;
}
.nav-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}
.nav-menu a {
  --c: var(--pink);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 12px;
  color: var(--ink);
  font: 700 15px/1.3 var(--font-ui);
  text-decoration: none;
}
.nav-menu a::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}
.nav-menu a:hover {
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--ink);
}
.nav-menu a[aria-current="page"] {
  background: color-mix(in srgb, var(--c) 18%, transparent);
}
@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  margin: auto;
  border-radius: 2px;
  background: var(--ink);
  position: relative;
  transition:
    transform 0.2s,
    background-color 0.2s;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before {
  top: -6px;
}
.nav-toggle span::after {
  top: 6px;
}
.nav-toggle[aria-expanded="true"] span {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] span::before {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span::after {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 1100px) {
  .brand-full {
    display: none;
  }
  .brand-short {
    display: inline;
  }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }
  .site-nav {
    order: 3;
    margin-left: 0;
  }
  .header-in .theme-toggle {
    margin-left: auto;
  }
  .site-nav {
    position: fixed;
    inset: calc(var(--header) + 4px) var(--gutter) auto var(--gutter);
    z-index: 49;
    display: none;
    max-height: calc(100dvh - var(--header) - 16px);
    overflow-y: auto;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow);
  }
  .site-nav.open {
    display: block;
    animation: drop 0.18s ease-out;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .nav-top {
    width: 100%;
    justify-content: space-between;
    min-height: 48px;
    font-size: 17px;
  }
  .nav-menu {
    position: static;
    translate: none;
    min-width: 0;
    box-shadow: none;
    border: 0;
    padding: 2px 0 8px 10px;
    background: none;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(72px, 10vw, 112px);
  padding: 0 var(--gutter) 128px; /* room for Matsuda in the corner */
}
.footer-card {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px);
  border: 2px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--pink) 9%, var(--card)),
    color-mix(in srgb, var(--lilac) 9%, var(--card))
  );
  box-shadow: var(--shadow);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 28px;
}
.footer-grid h2 {
  font-size: 16px;
  margin-bottom: 10px;
}
.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.footer-grid a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}
.footer-grid a:hover {
  color: var(--pink-deep);
}
.footer-about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  align-content: start;
}
.footer-about img {
  grid-row: span 2;
  width: 84px;
}
.footer-name {
  align-self: end;
  color: var(--ink);
  font: 400 17px/1.25 var(--font-display);
  text-decoration: none;
}
.footer-name:hover {
  color: var(--pink-deep);
}
.footer-about p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 32ch;
}
.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: 14px;
}
.footer-base p {
  margin: 0;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-about {
    grid-column: 1 / -1;
  }
}

/* ---------- Cards: polaroids on the club's corkboard ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1),
    box-shadow 0.2s;
}
.card-link:hover,
.card-link:focus-within {
  transform: translateY(-4px) rotate(-0.8deg);
  box-shadow:
    0 2px 0 var(--line),
    0 22px 34px -18px color-mix(in srgb, var(--pink) 55%, transparent);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--line);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-media[data-video]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  translate: -50% -50%;
  border-radius: 50%;
  background: rgb(224 84 138 / 0.88)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18'%3E%3Cpath d='M2 1l13 8-13 8z' fill='white'/%3E%3C/svg%3E")
    no-repeat 56% 50%;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.3);
}
.card .sticker {
  top: 8px;
  left: 8px;
}

.card-head {
  padding: 12px 8px 4px;
}
.card-title {
  font: 700 16px/1.35 var(--font-ui);
  overflow-wrap: anywhere;
}
.card-title a {
  color: var(--ink);
  text-decoration: none;
}
.card-link .card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}
.card-link .card-title a:focus-visible {
  outline: none;
}
.card-link:has(.card-title a:focus-visible) {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

.card-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 8px;
  font-size: 14px;
  color: var(--ink-soft);
}
.card-lines p {
  margin: 0;
}
.card-by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.55;
}
.card-lines .tags {
  margin-top: auto;
  padding-top: 4px;
}
.card-actions {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.code {
  position: relative;
  z-index: 3;
  margin-top: 8px;
}
.code summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--link);
  width: fit-content;
}
.code-box {
  position: relative;
  margin-top: 10px;
}
.code-box pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: #221a2b;
  color: #f1e8f3;
  font:
    13px/1.55 ui-monospace,
    "Cascadia Code",
    Consolas,
    monospace;
  tab-size: 4;
}
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
}
.code ol {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--ink);
}
.code-notes {
  margin-top: 10px;
  color: var(--ink);
  line-height: 1.6;
}

/* ---------- Catalog ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 620px;
}
.search .field {
  width: 100%;
  padding-left: 46px;
}
.search svg {
  position: absolute;
  left: 17px;
  top: 50%;
  translate: 0 -50%;
  width: 18px;
  height: 18px;
  color: var(--pink);
  pointer-events: none;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.result-count {
  margin: 24px 0 14px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 15px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}
.pager span {
  min-width: 120px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 40px);
  padding: clamp(20px, 4vw, 40px);
  border: 3px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 28px;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.empty img {
  width: clamp(96px, 16vw, 160px);
  flex: none;
}
.empty h2 {
  font-size: 24px;
}
.empty p {
  margin: 8px 0 16px;
  max-width: 48ch;
  font-size: 17px;
  color: var(--ink-soft);
}
@media (max-width: 560px) {
  .empty {
    flex-direction: column;
    text-align: center;
  }
  .empty .actions {
    justify-content: center;
  }
}

/* ---------- Mod page ---------- */

.crumbs {
  margin: 28px 0 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}
.crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--pink-deep);
  text-decoration: underline;
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  margin-top: 24px;
}
.entry-media {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  rotate: -1deg;
}
.entry-media img,
.entry-media iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 15px;
}
.entry-play {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(transparent, rgb(20 16 28 / 0.35));
}
.entry-play span {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  color: #fff;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.3);
  transition: transform 0.15s;
}
.entry-play:hover span {
  transform: scale(1.08);
}
.entry-info h1 {
  font-size: clamp(30px, 4vw, 44px);
  overflow-wrap: anywhere;
  margin-top: 12px;
}
.entry-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 18px 0 0;
  font-size: 15px;
}
.entry-meta dt {
  color: var(--ink-soft);
}
.entry-meta dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.downloads p {
  margin: 0;
  color: var(--ink-soft);
}
.entry-note {
  margin: 22px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--teal) 12%, var(--card));
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
}
.entry-desc {
  margin-top: clamp(32px, 5vw, 56px);
}
.entry-desc .text {
  white-space: pre-line;
}
/* The full credits, folded under the description so a long list doesn't bury it. */
.credits {
  margin-top: 20px;
}
.credits summary {
  cursor: pointer;
  font-weight: 700;
}
.notice {
  max-width: 56ch;
  margin: 0 auto;
  padding: 56px 0;
  text-align: center;
}
.notice h1 {
  font-size: 34px;
}
.notice p {
  font-size: 18px;
  color: var(--ink-soft);
}
.notice .actions {
  justify-content: center;
}

@media (max-width: 860px) {
  .entry {
    grid-template-columns: 1fr;
  }
}

/* ---------- Drawers (assets hub) ---------- */

.drawers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.drawers li:nth-child(6n + 1) {
  --c: var(--pink);
}
.drawers li:nth-child(6n + 2) {
  --c: var(--teal);
}
.drawers li:nth-child(6n + 3) {
  --c: var(--butter);
}
.drawers li:nth-child(6n + 4) {
  --c: var(--lilac);
}
.drawers li:nth-child(6n + 5) {
  --c: var(--sky);
}
.drawers li:nth-child(6n + 6) {
  --c: var(--mint);
}
.drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 26px 20px 20px;
  border-radius: 24px;
  text-align: center;
  background: color-mix(in srgb, var(--c) 10%, var(--card));
  border: 2px solid color-mix(in srgb, var(--c) 35%, var(--line));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 35%, var(--line));
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.drawer:hover {
  color: var(--ink);
  transform: translateY(-3px) rotate(-0.6deg);
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 35%, var(--line));
}
.drawer:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 35%, var(--line));
}
.drawer-label {
  display: grid;
  gap: 2px;
  padding: 10px 18px 8px;
  border: 2px solid var(--c);
  border-radius: 12px;
  background: var(--card);
  rotate: -1.5deg;
}
.drawer-name {
  font: 400 19px/1.3 var(--font-display);
}
.drawer-desc {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- Home: one screen, a pastel scrapbook board ---------- */

.title-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100svh;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--sky-top) 80%, transparent),
      color-mix(in srgb, var(--sky-mid) 86%, transparent) 52%,
      color-mix(in srgb, var(--sky-low) 93%, transparent)
    ),
    var(--scene) center 30% / cover no-repeat;
}
.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grain) 0 0 / 240px 240px;
}

/* Bubbles drift up through the sky. */
.sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bubble {
  position: absolute;
  bottom: -80px;
  left: var(--x);
  width: var(--s);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle at 32% 30%,
    rgb(255 255 255 / 0.95) 0 12%,
    rgb(255 255 255 / 0.25) 30%,
    color-mix(in srgb, var(--b, var(--pink)) 26%, transparent) 72%
  );
  border: 1.5px solid
    light-dark(rgb(255 255 255 / 0.85), rgb(255 173 204 / 0.3));
  box-shadow: 0 0 18px light-dark(transparent, rgb(255 139 183 / 0.22));
  opacity: 0;
  animation: float-up var(--d) linear var(--t) infinite;
}
.bubble:nth-child(3n) {
  --b: var(--lilac);
}
.bubble:nth-child(4n) {
  --b: var(--teal);
}
@keyframes float-up {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.9;
  }
  50% {
    transform: translate(var(--w, 24px), -55vh);
  }
  85% {
    opacity: 0.75;
  }
  100% {
    transform: translate(0, -112vh);
    opacity: 0;
  }
}

.home-tools {
  position: absolute;
  top: 16px;
  right: var(--gutter);
  z-index: 3;
}

.title-in {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  grid-template-areas: "board actor";
  align-items: center;
  column-gap: clamp(16px, 3vw, 48px);
  max-width: 1440px;
  min-height: 100svh;
  margin: 0 auto;
  padding: 36px clamp(16px, 3.5vw, 56px) 32px;
}
.board {
  grid-area: board;
  display: grid;
  gap: 22px;
}

.ts-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ts-brand img {
  width: clamp(72px, 7vw, 104px);
  flex: none;
  animation: bob 6s ease-in-out infinite;
  filter: drop-shadow(0 10px 16px rgb(189 58 109 / 0.3));
}
.ts-brand h1 {
  font-size: clamp(34px, 4.4vw, 62px);
  line-height: 1.02;
}
.ts-brand h1 span {
  display: block;
  color: var(--pink-deep);
}
.ts-tag {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: clamp(16px, 1.3vw, 18px);
  font-weight: 700;
}
@keyframes bob {
  50% {
    transform: translateY(-7px) rotate(-4deg);
  }
}

/* Washi tape holding things to the board. */
.taped {
  position: relative;
}
.taped::before,
.picks .card::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 3;
  width: 104px;
  height: 24px;
  translate: -50% 0;
  rotate: -3deg;
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--tape, var(--pink)) 60%, transparent) 0 7px,
    color-mix(in srgb, var(--tape, var(--pink)) 38%, transparent) 7px 14px
  );
  border-radius: 2px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

/* The menu: one tile per corner of the site. */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  --c: var(--pink);
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  height: 100%;
  min-height: 96px;
  padding: 12px 6px 10px;
  border-radius: 20px;
  border: 2px solid color-mix(in srgb, var(--c) 45%, var(--line));
  background: color-mix(in srgb, var(--c) 13%, var(--card));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 42%, var(--line));
  color: var(--ink);
  font: 400 15px/1.15 var(--font-display);
  text-align: center;
  text-decoration: none;
  rotate: var(--r, 0deg);
  transition:
    transform 0.14s,
    box-shadow 0.14s,
    rotate 0.2s,
    background-color 0.15s;
}
.tiles li:nth-child(4n + 1) .tile {
  --r: -1.5deg;
}
.tiles li:nth-child(4n + 2) .tile {
  --r: 1deg;
}
.tiles li:nth-child(4n + 3) .tile {
  --r: -0.5deg;
}
.tiles li:nth-child(4n + 4) .tile {
  --r: 1.5deg;
}
.tile svg {
  width: 30px;
  height: 30px;
  color: var(--c);
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.tile:hover {
  color: var(--ink);
  rotate: 0deg;
  transform: translateY(-3px);
  background: color-mix(in srgb, var(--c) 22%, var(--card));
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 42%, var(--line));
}
.tile:hover svg {
  transform: scale(1.15) rotate(-8deg);
}
.tile:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 42%, var(--line));
}
.tile .count {
  position: absolute;
  top: -9px;
  right: -6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 2px solid var(--c);
  background: var(--card);
  color: var(--ink);
  font: 700 12px/1.4 var(--font-ui);
  rotate: 6deg;
}
.tile .count:empty {
  display: none;
}

/* Right: Matsuda on her mark, cut off by the bottom edge like a visual novel. */
.ts-matsuda {
  grid-area: actor;
  position: relative;
  align-self: end;
  margin-bottom: -32px;
}
.ts-matsuda::before {
  content: "";
  position: absolute;
  inset: 4% -16% 0;
  z-index: -1;
  background: radial-gradient(
    46% 44% at 50% 50%,
    color-mix(in srgb, var(--pink) 30%, transparent),
    transparent 72%
  );
}
.ts-matsuda .stage-actor {
  width: min(100%, 500px);
  margin: 0 auto;
}
.ts-matsuda .textbox {
  position: absolute;
  left: -6%;
  right: 0;
  bottom: 64px;
}

/* Below the board: random picks pinned like polaroids. */
.picks .grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.picks .card {
  --tape: var(--lilac);
}
.picks .card:nth-child(odd) {
  rotate: -1.2deg;
}
.picks .card:nth-child(even) {
  rotate: 1deg;
  --tape: var(--teal);
}
.picks .card-lines .tags {
  display: none;
}
.social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 0;
}
.social img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

@media (max-width: 1100px) {
  .title-in {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "actor" "tiles" "featured";
    padding-top: 72px;
    row-gap: 8px;
  }
  .board {
    display: contents;
  }
  .ts-head {
    grid-area: brand;
  }
  .board > nav {
    grid-area: tiles;
  }
  .board > .featured {
    grid-area: featured;
    margin-top: 34px;
  }
  .ts-matsuda {
    margin: 0 0 12px;
    align-self: center;
  }
  .ts-matsuda .stage-actor {
    width: min(76%, 380px);
  }
  .ts-matsuda .textbox {
    position: relative;
    left: auto;
    bottom: auto;
    margin-top: -96px;
  }
}
@media (max-width: 760px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- Matsuda sprites (body plus registered face plate) ---------- */

.matsu {
  position: relative;
  display: block;
  aspect-ratio: 880 / 970;
}
.matsu img {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
}
.matsu-body {
  inset: 0;
  width: 100%;
  height: 100%;
}
.matsu-face {
  left: var(--fx);
  top: var(--fy);
  width: var(--fw);
}
.matsu-hero {
  --fx: 34.773%;
  --fy: 15.258%;
  --fw: 24.659%;
}
.matsu-guide {
  --fx: 28.438%;
  --fy: 24.359%;
  --fw: 34.688%;
  aspect-ratio: 320 / 312;
}

/* The entrance: Matsuda arrives from stage right, once. */
.stage-actor .matsu {
  animation: enter-right 0.75s cubic-bezier(0.2, 0.9, 0.25, 1.15) 0.15s both;
}
[data-stage] .textbox {
  animation: rise 0.5s ease-out 0.55s both;
}
@keyframes enter-right {
  from {
    opacity: 0;
    transform: translateX(70px);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- Visual-novel textbox ---------- */

.textbox {
  position: relative;
  z-index: 2;
  min-height: 118px;
  padding: 24px 54px 18px 22px;
  border: 3px solid var(--pink);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 93%, transparent);
  box-shadow: 0 18px 36px -22px rgb(189 58 109 / 0.6);
  cursor: pointer;
}
.textbox-name {
  position: absolute;
  top: -17px;
  left: 18px;
  margin: 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  color: var(--on-btn);
  font: 400 15px/1.2 var(--font-display);
}
.textbox-line {
  margin: 0;
  font: 700 clamp(16px, 1.35vw, 18px) / 1.65 var(--font-ui);
  min-height: 3.3em;
}
.textbox-next {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--pink);
}
.textbox-next::before {
  content: "";
  border: 7px solid transparent;
  border-top: 9px solid currentColor;
  border-bottom: 0;
  animation: nudge 1.1s ease-in-out infinite;
}
@keyframes nudge {
  50% {
    transform: translateY(3px);
  }
}
.ghost {
  visibility: hidden;
}

/* ---------- Corner guide ---------- */

.guide {
  --size: 150px;
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 40;
  view-transition-name: guide;
  transition:
    transform 0.35s ease,
    visibility 0s;
}
.guide.offstage {
  transform: translateY(115%);
  visibility: hidden;
  transition:
    transform 0.35s ease,
    visibility 0s 0.35s;
}
.guide-sprite {
  display: block;
  width: var(--size);
  padding: 0;
  border: 0;
  background: none;
  transform: translateY(22%);
  transition: transform 0.3s cubic-bezier(0.3, 1.3, 0.5, 1);
  filter: drop-shadow(0 6px 14px rgb(59 43 66 / 0.25));
}
.guide-sprite:hover,
.guide.talking .guide-sprite {
  transform: translateY(12%);
}
.guide-sprite:focus-visible {
  outline-offset: -6px;
}
.guide.tucked .guide-sprite {
  transform: translateY(74%);
}

.guide-box {
  position: absolute;
  right: calc(var(--size) - 22px);
  bottom: calc(var(--size) * 0.5);
  width: min(330px, calc(100vw - var(--size) - 8px));
  padding: 22px 16px 12px;
  border: 3px solid var(--pink);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 40px -20px rgb(189 58 109 / 0.55);
  animation: rise 0.25s ease-out both;
}
.guide-box .textbox-name {
  top: -15px;
  left: 14px;
  font-size: 13px;
  padding: 5px 13px;
}
.guide-line {
  margin: 0;
  font: 700 15px/1.6 var(--font-ui);
}
.guide-tools {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
}
.guide-tools button {
  padding: 4px 11px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font: 700 13px/1.4 var(--font-ui);
}
.guide-tools button:hover {
  background: color-mix(in srgb, var(--pink) 12%, transparent);
  color: var(--ink);
}
.guide-tools .guide-more {
  color: var(--pink-deep);
}

@media (max-width: 640px) {
  .guide {
    --size: 84px;
  }
  .guide-sprite {
    transform: translateY(30%);
  }
  .guide-box {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--size) * 0.82);
    width: auto;
  }
}

/* ---------- Featured release (ENTER-M's own palette) ---------- */

.featured {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px 22px;
  padding: 22px 24px;
  border-radius: 26px;
  background: var(--night);
  color: var(--parchment);
  box-shadow:
    0 24px 50px -30px rgb(19 32 41 / 0.9),
    0 0 0 3px light-dark(rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.06));
}
.featured-sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
}
.featured-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgb(19 32 41 / 0.94) 20%,
    rgb(19 32 41 / 0.45) 70%,
    rgb(19 32 41 / 0.2)
  );
}
.featured-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 75% 50%;
}
.featured-rings {
  position: absolute;
  right: 14%;
  top: 50%;
  width: 62%;
  aspect-ratio: 1;
  translate: 0 -50%;
}
.featured-rings img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ring-months {
  animation: turn 360s linear infinite;
}
.ring-days {
  animation: turn 240s linear -120s infinite reverse;
}
.ring-orbits {
  animation: turn 150s linear -75s infinite;
}
@keyframes turn {
  to {
    rotate: 360deg;
  }
}

.featured-tag {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 12px;
  border: 1px solid rgb(217 183 123 / 0.6);
  border-radius: 999px;
  color: var(--brass);
  font: 700 13px/1.2 var(--font-ui);
}
.wordmark {
  margin: 0;
  font:
    400 clamp(38px, 3.6vw, 52px) / 1 "Nova Square",
    var(--font-ui);
  white-space: nowrap;
  color: var(--parchment);
}
.wordmark .prompt {
  color: #737474;
  margin-right: 0.12em;
}
.wordmark .m {
  position: relative;
  display: inline-block;
}
.wordmark .m::before,
.wordmark .m::after {
  content: "M";
  position: absolute;
  inset: 0;
  z-index: -1;
  mix-blend-mode: screen;
}
.wordmark .m::before {
  color: #d30000;
  translate: -0.05em 0.015em;
  animation: slip-red 9s steps(1, end) infinite;
}
.wordmark .m::after {
  color: #00b7b8;
  translate: 0.05em -0.01em;
  animation: slip-cyan 9s steps(1, end) infinite;
}
@keyframes slip-red {
  96% {
    translate: -0.15em 0;
    clip-path: inset(20% 0 46% 0);
  }
  98% {
    translate: -0.05em 0.015em;
    clip-path: none;
  }
}
@keyframes slip-cyan {
  96% {
    translate: 0.12em 0;
    clip-path: inset(58% 0 10% 0);
  }
  98% {
    translate: 0.05em -0.01em;
    clip-path: none;
  }
}
.featured-tagline {
  margin: 14px 0 0;
  max-width: 28ch;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 700;
}
.featured-meta {
  margin: 8px 0 0;
  max-width: 40ch;
  color: #b9b5aa;
  font-size: 14px;
  line-height: 1.55;
}
.tab-button {
  display: inline-block;
  margin-top: 16px;
  padding: 0.2rem 1.2rem;
  border-style: solid;
  border-width: 16px 20px;
  border-image: url("/assets/featured/enter-m/tab.svg") 16 20 fill / 16px 20px;
  color: #263238;
  font:
    400 16px/1.2 "Nova Square",
    var(--font-ui);
  text-decoration: none;
}
.tab-button:hover {
  color: #263238;
  filter: brightness(1.08);
}
.tab-button:focus-visible {
  outline-color: var(--brass);
  outline-offset: 4px;
}
.featured-shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.featured-shots li:nth-child(odd) {
  rotate: -1.5deg;
}
.featured-shots li:nth-child(even) {
  rotate: 1.2deg;
}
@media (max-width: 760px) {
  .featured {
    grid-template-columns: 1fr;
  }
}
.featured-shots img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgb(0 0 0 / 0.4);
}

/* ---------- Content pages ---------- */

.community {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}
.community a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.15s,
    border-color 0.15s;
}
.community a:hover {
  color: var(--ink);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--pink) 50%, var(--line));
}
.community img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  flex: none;
}
.community b {
  display: block;
  font: 400 17px/1.3 var(--font-display);
}
.community span span {
  display: block;
  color: var(--ink-soft);
  font-size: 15px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 32px);
}
@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.panel {
  padding: clamp(20px, 3vw, 30px);
  border: 2px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 22px;
}
.panel h3 {
  font-size: 18px;
}
.panel p {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.panel .actions {
  margin-top: 18px;
}
.panel ul,
.panel ol {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.panel .tags {
  margin: 0 0 12px;
  padding: 0;
}
.panel > img {
  width: 150px;
  height: auto;
  margin-bottom: 14px;
}
.split > .panel,
.routes .panel {
  display: flex;
  flex-direction: column;
}
.split > .panel .actions,
.routes .actions {
  margin-top: auto;
  padding-top: 18px;
}

.routes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 18px;
}
.routes .panel {
  border-top: 6px solid var(--c, var(--accent));
}
.routes .panel:nth-child(5n + 1) {
  --c: var(--pink);
}
.routes .panel:nth-child(5n + 2) {
  --c: var(--teal);
}
.routes .panel:nth-child(5n + 3) {
  --c: var(--butter);
}
.routes .panel:nth-child(5n + 4) {
  --c: var(--lilac);
}
.routes .panel:nth-child(5n + 5) {
  --c: var(--sky);
}

.checklists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px 40px;
}
.checklists h3 {
  font-size: 18px;
  margin-bottom: 10px;
}
.checklists ul {
  margin: 0;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.65;
}
.checklists li {
  margin-bottom: 6px;
}
.checklists li::marker {
  color: var(--accent);
}

/* The submission form: two columns of fields where there's room. */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 22px 28px;
  margin-top: 24px;
}
.form .wide {
  grid-column: 1 / -1;
}
.form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}
.form .field {
  width: 100%;
}
.form textarea.field {
  height: auto;
  padding: 12px 18px;
  border-radius: 22px;
  line-height: 1.6;
  resize: vertical;
}
.form .field:user-invalid {
  border-color: var(--pink-deep);
}
.form .hint {
  margin: 6px 0 0;
  font-size: 14px;
}
/* The agreement: its box beside the sentence, which reads easier in regular weight than as a bold label. */
.form .agree {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.form .agree input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--pink);
}
.form .agree label {
  margin: 0;
  font-weight: inherit;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}
.jump li:nth-child(4n + 1) .chip {
  --c: var(--pink);
}
.jump li:nth-child(4n + 2) .chip {
  --c: var(--teal);
}
.jump li:nth-child(4n + 3) .chip {
  --c: var(--butter);
}
.jump li:nth-child(4n + 4) .chip {
  --c: var(--lilac);
}

/* Questions and answers, answered by Matsuda. Native disclosure does the work. */
.qa-group {
  max-width: 860px;
  margin-inline: auto;
}
.qa-group + .qa-group {
  margin-top: 48px;
}
.qa-group h2 {
  font-size: 26px;
  margin-bottom: 14px;
}
.qa {
  margin-top: 12px;
}
.qa summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  list-style: none;
  font: 700 17px/1.45 var(--font-ui);
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.qa summary::-webkit-details-marker {
  display: none;
}
.qa summary::before {
  content: "?";
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, var(--card));
  color: var(--ink);
  font: 400 16px/1 var(--font-display);
}
.qa summary::after {
  content: "+";
  margin-left: auto;
  flex: none;
  color: var(--pink);
  font: 400 22px/1 var(--font-display);
  transition: rotate 0.2s;
}
.qa summary:hover {
  border-color: color-mix(in srgb, var(--pink) 50%, var(--line));
}
.qa[open] summary {
  border-color: var(--pink);
}
.qa[open] summary::after {
  rotate: 45deg;
}
.qa-answer {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 14px 0 6px;
  padding-left: 12px;
}
.qa[open] .qa-answer {
  animation: rise 0.28s ease-out both;
}
.qa-face {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--pink);
  background: var(--card);
  box-shadow: 0 6px 14px -6px rgb(189 58 109 / 0.5);
}
.qa-bubble {
  position: relative;
  padding: 14px 18px 16px;
  border: 2px solid color-mix(in srgb, var(--pink) 40%, var(--line));
  border-radius: 6px 22px 22px 22px;
  background: color-mix(in srgb, var(--pink) 6%, var(--card));
}
.qa-bubble::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 16px;
  width: 18px;
  height: 18px;
  rotate: 45deg;
  background: inherit;
  border: inherit;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 4px;
}
.qa-name {
  margin: 0 0 2px;
  color: var(--pink-deep);
  font: 400 14px/1.4 var(--font-display);
}
.qa-quip {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 17px;
}
.qa .prose {
  font-size: 16.5px;
}

.link-groups {
  display: grid;
  gap: 48px;
}
.link-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.link-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.15s,
    border-color 0.15s;
}
.link-list a:hover {
  color: var(--ink);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
}
.link-list img {
  width: 42px;
  height: 42px;
  padding: 4px;
  object-fit: contain;
  flex: none;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--line);
}
.link-list b {
  display: block;
  font: 700 16px/1.3 var(--font-ui);
}
.link-list span span {
  display: block;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}
.link-groups h2 {
  font-size: 24px;
}

.team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.team li {
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.team li:nth-child(odd) {
  rotate: -0.6deg;
}
.team li:nth-child(even) {
  rotate: 0.6deg;
}
.team img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center 25%;
  border-radius: 15px;
}
.team div {
  padding: 14px 10px 12px;
}
.team h3 {
  font: 400 20px/1.3 var(--font-display);
}
.team .role {
  margin: 4px 0 0;
  color: var(--pink-deep);
  font-weight: 700;
  font-size: 14px;
}
.team .bio {
  margin: 10px 0 0;
  font-size: 15.5px;
  line-height: 1.65;
}

.rules {
  counter-reset: rule;
  display: grid;
  gap: 18px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.rules li {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
}
.rules li::before {
  counter-increment: rule;
  content: counter(rule);
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--c, var(--pink));
  color: #fff;
  font: 400 20px/1 var(--font-display);
  rotate: -6deg;
}
.rules li:nth-child(3n + 2) {
  --c: var(--teal);
}
.rules li:nth-child(3n + 3) {
  --c: var(--lilac);
}
.rules h3 {
  font-size: 20px;
  margin-top: 10px;
}
.rules p {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.7;
}
.rules .aside {
  color: var(--ink-soft);
  font-size: 15.5px;
}

.history {
  margin-block: 24px;
  border: 2px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}
.history summary {
  cursor: pointer;
  padding: 16px 22px;
  font: 700 17px/1.4 var(--font-ui);
  color: var(--pink-deep);
}
.history .prose {
  padding: 0 22px 8px;
}

.steps {
  counter-reset: step;
  display: grid;
  gap: 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 17px;
  line-height: 1.6;
}
.steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: baseline;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 25%, var(--card));
  color: var(--ink);
  font: 400 15px/1 var(--font-display);
}

.frame {
  margin-top: 20px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.frame iframe {
  width: 100%;
  height: min(1100px, 80vh);
  border: 0;
  border-radius: 16px;
  background: #fff;
}

.soon {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 5vw, 56px);
  padding: clamp(40px, 8vw, 96px) 0;
}
.soon img {
  width: clamp(150px, 24vw, 260px);
  animation: bob 5s ease-in-out infinite;
}
.soon h1 {
  font-size: clamp(32px, 5vw, 50px);
}
.soon p {
  margin: 14px 0 24px;
  max-width: 46ch;
  font-size: 19px;
  color: var(--ink-soft);
}
@media (max-width: 640px) {
  .soon {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .soon .actions {
    justify-content: center;
  }
}

/* ---------- Lightbox ---------- */

.lightbox {
  max-width: min(94vw, 1400px);
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.lightbox::backdrop {
  background: rgb(26 20 33 / 0.84);
  backdrop-filter: blur(4px);
}
.lightbox figure {
  margin: 0;
}
.lightbox img {
  max-height: 80vh;
  margin: auto;
  border-radius: 14px;
}
.lightbox figcaption {
  margin-top: 12px;
  text-align: center;
  font-weight: 700;
}
.lightbox form {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

/* ---------- Page transitions ---------- */
/* Moving between pages, the next one opens in a heart from wherever you clicked, the way a visual novel
   irises into a new scene, while the page you leave sinks back and blushes pink. The header and Matsuda
   stay put. head.js sets --from-x and --from-y from the click; without them the heart opens from the middle.
   The opt-in, @view-transition { navigation: auto }, is an inline <style> at the top of every page's <head>:
   Chromium drops a transition if the page restyles before this stylesheet arrives and finds no opt-in. */

:root {
  --heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 92C24 72 4 55 4 33 4 18 15 7 29 7c9 0 16 5 21 13 5-8 12-13 21-13 14 0 25 11 25 26 0 22-20 39-46 59z'/%3E%3C/svg%3E");
}

/* One heartbeat, then the heart blooms past every corner of the screen. */
@keyframes heart-open {
  from {
    mask-image: var(--heart);
    mask-repeat: no-repeat;
    mask-size: 0 0;
    mask-position: var(--from-x, 50vw) var(--from-y, 50vh);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  24% {
    mask-size: 24vmax 24vmax;
    mask-position: calc(var(--from-x, 50vw) - 12vmax)
      calc(var(--from-y, 50vh) - 12vmax);
    animation-timing-function: ease-in-out;
  }
  36% {
    mask-size: 19vmax 19vmax;
    mask-position: calc(var(--from-x, 50vw) - 9.5vmax)
      calc(var(--from-y, 50vh) - 9.5vmax);
    animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5);
  }
  to {
    mask-image: var(--heart);
    mask-repeat: no-repeat;
    mask-size: 520vmax 520vmax;
    mask-position: calc(var(--from-x, 50vw) - 260vmax)
      calc(var(--from-y, 50vh) - 260vmax);
  }
}
/* Fading into the backdrop behind it (the group's background) is what makes the heart stand out. */
@keyframes page-sink {
  from {
    clip-path: inset(0 round 0);
  }
  30% {
    opacity: 0.6;
  }
  to {
    scale: 0.94;
    opacity: 0.5;
    clip-path: inset(0 round 28px);
  }
}
@keyframes header-drop {
  from {
    translate: 0 -130%;
  }
}
@keyframes header-lift {
  to {
    translate: 0 -130%;
  }
}

::view-transition-group(root) {
  background: var(--sky-top);
}
::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
}
::view-transition-old(root) {
  animation: page-sink 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}
::view-transition-new(root) {
  animation: heart-open 0.7s both;
}
/* The header slides in on the first page that has one, and back out on the way home. */
::view-transition-new(site-header):only-child {
  animation: header-drop 0.45s 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
::view-transition-old(site-header):only-child {
  animation: header-lift 0.3s ease-in both;
}

/* Switching light and dark reuses the heart, opening from the switch across the whole screen. */
.theme-change :is(.site-header, .guide) {
  view-transition-name: none;
}
.theme-change::view-transition-old(root) {
  animation: none;
}

/* Browsers without cross-document view transitions still open the new page in a heart (see head.js). */
.heart-in body {
  animation: heart-open 0.7s;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ring-months,
  .ring-days,
  .ring-orbits,
  .wordmark .m::before,
  .wordmark .m::after,
  .textbox-next::before,
  .soon img {
    animation: none !important;
  }
  .sky {
    display: none;
  }
  @view-transition {
    navigation: none;
  }
}
