/* exlegacy clean-set · two-mode full weight · light + galaxy */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #FAFAFC;
  --bg2: #f0f0f5;
  --ink: #12121a;
  --mut: #5c5c6b;
  --faint: #8a8a9a;
  --line: #e4e4ec;
  --panel: #ffffff;
  --accent: #0047FF;
  --accent-ink: #0033c4;
  --chip: #eef2fb;
  --ok: #0a7d33;
  --warn: #b45309;
  --dot: #0047FF;
  --galaxy-veil: transparent;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --star: transparent;
}
[data-theme="galaxy"] {
  color-scheme: dark;
  --bg: #07070c;
  --bg2: #0e0e16;
  --ink: #f2f2f7;
  --mut: #9a9aaf;
  --faint: #6e6e82;
  --line: #22222e;
  --panel: #12121a;
  --accent: #6b8cff;
  --accent-ink: #9bb0ff;
  --chip: #1a1a28;
  --ok: #3dce7a;
  --warn: #e8a54b;
  --dot: #4d7cff;
  --galaxy-veil: radial-gradient(ellipse 120% 80% at 70% -10%, rgba(77, 124, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 80% 50% at 10% 100%, rgba(140, 80, 255, 0.12), transparent 50%);
  --star: rgba(255, 255, 255, 0.55);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  background-image: var(--galaxy-veil);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[data-theme="galaxy"] body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, var(--star), transparent),
    radial-gradient(1px 1px at 48% 8%, var(--star), transparent),
    radial-gradient(1.2px 1.2px at 82% 22%, var(--star), transparent),
    radial-gradient(1px 1px at 28% 62%, var(--star), transparent),
    radial-gradient(1px 1px at 66% 74%, var(--star), transparent),
    radial-gradient(1.2px 1.2px at 90% 58%, var(--star), transparent),
    radial-gradient(1px 1px at 8% 88%, var(--star), transparent);
  opacity: 0.55;
}
.wrap, .shell { position: relative; z-index: 1; }
.wrap { max-width: 960px; margin: 0 auto; padding: 28px 20px 64px; }
.shell { max-width: 1100px; margin: 0 auto; padding: 20px 18px 56px; }

header.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 16px; margin-bottom: 32px;
}
.mark { font-size: 26px; font-weight: 300; letter-spacing: -0.06em; color: var(--ink); text-decoration: none; }
.mark:hover { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nav a, .chip-btn {
  font-size: 12px; color: var(--mut); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--panel);
}
.nav a:hover, .chip-btn:hover { color: var(--ink); border-color: var(--faint); }
.nav a.here { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--chip); }
.stage {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--mut); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px;
}
.theme-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); }
.theme-toggle button {
  border: 0; background: transparent; color: var(--mut); font-size: 11px; padding: 6px 12px; cursor: pointer;
}
.theme-toggle button[aria-pressed="true"] { background: var(--chip); color: var(--ink); font-weight: 600; }
.theme-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-size: clamp(28px, 5vw, 42px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.12; max-width: 18ch; }
.lead { margin-top: 14px; color: var(--mut); font-size: 15px; max-width: 48ch; }
.lead strong { color: var(--ink); font-weight: 600; }

.grid { margin-top: 32px; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid.g3 { grid-template-columns: 1fr 1fr 1fr; } }

.tile {
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  padding: 18px 18px 16px; min-height: 120px; text-decoration: none; color: inherit;
  display: block; transition: border-color .15s ease, transform .15s ease;
}
a.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.tile h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.tile p { margin-top: 8px; font-size: 13px; color: var(--mut); line-height: 1.5; }
.tile .tag {
  display: inline-block; margin-top: 12px; font-size: 10px; font-family: var(--mono);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink);
}

.note {
  margin-top: 28px; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--line);
  font-size: 12.5px; color: var(--mut); line-height: 1.5;
}
.note strong { color: var(--ink); font-weight: 600; }
.note code { font-family: var(--mono); font-size: 11px; }

footer.foot {
  margin-top: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  color: var(--mut); font-size: 12px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot); flex: 0 0 auto; }
a { color: var(--accent); }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* houseavatar cast */
.cast {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  margin-top: 20px;
}
.cast figure {
  margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--panel); cursor: pointer; transition: border-color .15s;
}
.cast figure:hover, .cast figure[aria-selected="true"] {
  border-color: var(--accent);
}
.cast img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--bg2); }
.cast figcaption {
  font-size: 10px; text-align: center; padding: 6px 4px; color: var(--mut); font-family: var(--mono);
}

.kits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.kits button, .kits .kit {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: 12px; cursor: pointer;
}
.kits button[aria-pressed="true"], .kits .kit.on {
  background: var(--chip); border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent-ink); font-weight: 600;
}

.panel {
  margin-top: 24px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); padding: 20px;
}
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.panel .sub { font-size: 13px; color: var(--mut); margin-bottom: 14px; }
label.field { display: block; font-size: 12px; color: var(--mut); margin: 12px 0 6px; }
textarea, input[type="text"], select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); padding: 12px 14px; font: inherit; font-size: 14px;
}
textarea { min-height: 120px; resize: vertical; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.out {
  margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--bg2);
  border: 1px solid var(--line); font-size: 13px; color: var(--ink); white-space: pre-wrap;
  min-height: 48px;
}
.out.muted { color: var(--mut); }

/* age gate */
#age-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(7, 7, 12, 0.88); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#age-gate.open { display: flex; }
#age-gate .card {
  max-width: 380px; width: 100%; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px;
}
#age-gate h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
#age-gate p { font-size: 13px; color: var(--mut); line-height: 1.5; margin-bottom: 18px; }
#age-gate .btn-row { justify-content: stretch; }
#age-gate .btn { flex: 1; text-align: center; }

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