:root {
  color-scheme: dark;
  --bg: #101224;
  --panel: #181b31;
  --line: #2c3050;
  --ink: #f4f1ff;
  --muted: #b5b9d4;
  --lavender: #b1a1ff;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: var(--lavender); }
button:focus-visible, a:focus-visible { outline: 3px solid #aeeaff; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #252840; background: #111326; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); font-size: 1.12rem; font-weight: 800; text-decoration: none; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: .66rem; letter-spacing: .16em; }
.brand-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; background: #9380fc; color: #15102d; font-size: 1.45rem; box-shadow: inset 0 -3px #7561d6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 9px 17px; border: 1px solid transparent; border-radius: 12px; font-size: .94rem; font-weight: 750; text-decoration: none; }
.button:disabled { opacity: .5; }
.button-subtle { background: #1b1e34; color: var(--ink); border-color: #343859; }
.button-subtle:hover:not(:disabled) { background: #282b48; }
.button-primary { min-height: 48px; padding-inline: 21px; color: #17122d; background: #b3a4ff; box-shadow: 0 4px 0 #7160d3; }
.button-primary:hover:not(:disabled) { background: #c7bcff; }
.button-primary span { font-size: .75em; }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: 370px;
  overflow: hidden;
  margin-top: 34px;
  border: 1px solid #3a345e;
  border-radius: 24px;
  background: radial-gradient(ellipse at 75% 65%, #2b214c, #19152f 65%);
}
.hero-image { position: absolute; inset: 0 0 0 auto; width: 65%; height: 100%; object-fit: cover; object-position: center 52%; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #1b1635 0%, #1b1635 30%, #1b1635d9 40%, #1b163500 68%); }
.hero-content { padding: 42px 44px; max-width: 52%; }
.eyebrow { color: #c4b9ff; font-size: .9rem; font-weight: 750; letter-spacing: .08em; }
.eyebrow span { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 9px; background: #cfb9ff; transform: rotate(45deg); vertical-align: .12em; }
.hero h1 { margin: 12px 0 16px; font-size: clamp(2.9rem, 6vw, 4.9rem); line-height: 1.08; font-weight: 900; letter-spacing: -.045em; }
.hero h1 span { color: #bbabff; }
.hero-description { max-width: 21em; margin-bottom: 24px; color: #d2cbe8; font-size: 1rem; line-height: 1.7; }
.catalog { margin-top: 38px; }
.catalog-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 17px; }
.catalog h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); letter-spacing: -.025em; }
.filters { display: flex; gap: 4px; padding: 4px; border: 1px solid #2e3250; border-radius: 12px; background: #171a30; }
.filters button { min-height: 40px; padding: 5px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.filters button:hover { color: var(--ink); background: #242842; }
.filters button[aria-pressed="true"] { color: #e0d7ff; background: #37305a; font-weight: 800; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.game-card { display: flex; flex-direction: column; text-align: left; width: 100%; padding: 0; border: 1px solid #2d3251; border-radius: 17px; overflow: hidden; background: var(--panel); }
.game-card:hover { border-color: var(--accent); background: #1e2240; }
.card-art {
  position: relative;
  isolation: isolate;
  display: flex;
  place-content: center;
  align-items: center;
  gap: .16em;
  width: 100%;
  height: 105px;
  overflow: hidden;
  color: var(--accent);
  background: radial-gradient(ellipse at 50% 75%, var(--glow), var(--art));
  font-family: system-ui, sans-serif;
  font-size: 3.7rem;
  font-weight: 850;
}
.card-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(#ffffff0c 1px, transparent 1px), linear-gradient(90deg, #ffffff0c 1px, transparent 1px); background-size: 20px 20px; mask-image: linear-gradient(#0005, #000); }
.card-art span { display: inline-block; text-shadow: 0 5px #080b214d, 0 0 22px color-mix(in srgb, var(--accent), transparent 47%); }
.art-stars { --accent: #c4afff; --art: #2b1d59; --glow: #503592; }
.art-stars .card-art span:first-child { font-size: .43em; align-self: flex-start; margin-top: .72em; }
.art-stars .card-art span:last-child { font-size: .37em; align-self: flex-end; margin-bottom: .7em; }
.art-memory { --accent: #8af2dc; --art: #143f42; --glow: #1b716f; }
.art-memory .card-art span { display: grid; place-items: center; width: 43px; height: 56px; border: 2px solid #8af2dc99; border-radius: 9px; background: #226e6c; font-size: .48em; transform: rotate(-13deg); }
.art-memory .card-art span:last-child { transform: rotate(13deg) translateY(4px); }
.art-tic { --accent: #ffb2b8; --art: #532238; --glow: #8a365b; }
.art-tic .card-art span:last-child { color: #ffd6a3; transform: translateY(7px); }
.art-color { --accent: #ffcd82; --art: #4c311d; --glow: #87502a; }
.art-color .card-art span { width: 38px; height: 38px; border-radius: 11px; background: #ffac65; box-shadow: 0 4px 0 #23142a50; transform: rotate(-10deg) translateY(4px); }
.art-color .card-art span:nth-child(2) { background: #ff85a7; transform: rotate(8deg) translateY(-9px); }
.art-color .card-art span:nth-child(3) { background: #8cd5fe; transform: rotate(14deg) translateY(6px); }
.art-numbers { --accent: #9ddcff; --art: #1d345b; --glow: #285e8c; }
.art-numbers .card-art span { display: grid; place-items: center; width: 39px; height: 44px; border-radius: 8px; background: #336897; box-shadow: inset 0 0 0 1px #9ddcff6b; font-size: .44em; transform: rotate(-11deg) translateY(7px); }
.art-numbers .card-art span:nth-child(2) { transform: rotate(4deg) translateY(-7px); }
.art-numbers .card-art span:nth-child(3) { transform: rotate(13deg) translateY(5px); }
.art-lights { --accent: #e1f49d; --art: #303d23; --glow: #536b2c; }
.art-lights .card-art span { width: 34px; height: 34px; border-radius: 8px; background: #b4de72; box-shadow: 0 0 20px #b4de7260, 0 4px #20301f70; transform: translateY(-12px) rotate(-10deg); }
.art-lights .card-art span:nth-child(2) { transform: translateY(9px) rotate(6deg); }
.art-lights .card-art span:nth-child(3) { background: #526737; box-shadow: inset 0 0 0 1px #c0e7905e; transform: translateY(0) rotate(10deg); }
.card-copy { display: grid; gap: 6px; padding: 13px 16px 16px; width: 100%; }
.card-category { color: var(--accent); font-size: .875rem; font-weight: 720; }
.card-title { font-size: 1.2rem; font-weight: 800; }
.card-summary { color: var(--muted); font-size: .94rem; line-height: 1.45; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 20px; margin-top: 34px; border-top: 1px solid #282c47; color: var(--muted); font-size: .9rem; }

.game-view { max-width: 740px; margin: 30px auto 0; }
.game-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.best-score, .game-instructions, .result-panel p { color: var(--muted); line-height: 1.6; }
.best-score { font-size: .9rem; text-align: right; }
.game-panel { padding: clamp(18px, 4vw, 36px); border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.game-heading { display: grid; gap: 8px; margin-bottom: 24px; }
.game-heading h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); outline: 0; }
.game-heading .eyebrow { color: var(--accent, var(--lavender)); }
.stage { display: grid; gap: 14px; }
.scoreboard { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; font-weight: 750; color: var(--ink); }
.scoreboard p:last-child { color: var(--muted); }
.board { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: 8px; width: min(100%, 410px); margin-inline: auto; }
.tile { display: grid; place-items: center; min-width: 0; min-height: 44px; aspect-ratio: 1; border: 1px solid #3b4167; border-radius: 11px; background: #222745; font-size: clamp(1rem, 5.2vw, 2rem); font-weight: 850; }
.tile:hover:not(:disabled) { border-color: var(--accent, var(--lavender)); background-color: #33395b; }
.tile.is-star, .tile.is-open, .tile.is-lit { color: #16152a; border-color: transparent; background: var(--accent, var(--lavender)); }
.tile:is(.is-star, .is-open, .is-lit):hover:not(:disabled) { background: color-mix(in srgb, var(--accent, var(--lavender)), white 25%); }
.tile.is-matched { color: #9df1db; border-color: #407a70; background: #21453f; }
.tile.is-used { opacity: .48; }
.tile.is-shown { color: var(--accent); }
.color-stimulus { display: grid; place-items: center; min-height: 132px; margin: 6px 0; border: 1px solid var(--line); border-radius: 15px; background: #131629; font-size: clamp(2.5rem, 9vw, 4.2rem); font-weight: 900; }
.color-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.color-options button { border-bottom: 3px solid var(--swatch); padding-inline: 5px; }
.round-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.round-actions p { color: var(--muted); }
.result-panel { padding: 21px 12px 5px; margin-top: 15px; border-top: 1px solid var(--line); text-align: center; }
.result-panel h2 { font-size: 1.55rem; margin-bottom: 6px; outline: 0; }
.privacy-page { max-width: 740px; padding-block: 32px; line-height: 1.7; }
.privacy-page h2 { margin-top: 20px; font-size: 1.2rem; }
.privacy-page p { color: var(--muted); }
.privacy-page .button { margin-top: 20px; }

@media (max-width: 810px) {
  .shell { width: calc(100% - 36px); }
  .hero { min-height: 320px; }
  .hero-content { padding: 32px 26px; max-width: 58%; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .header-inner { min-height: 62px; }
  .hero { align-items: end; min-height: 375px; margin-top: 20px; }
  .hero-image { inset: 0 0 auto; width: 100%; height: 65%; object-position: center 45%; }
  .hero::after { background: linear-gradient(0deg, #1b1635 0%, #1b1635 34%, #1b1635e9 46%, #1b163500 68%); }
  .hero-content { max-width: 100%; padding: 19px 20px 23px; }
  .hero h1 { margin: 6px 0 8px; }
  .hero-description { margin-bottom: 14px; }
  .catalog { margin-top: 26px; }
  .catalog-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .game-grid { gap: 10px; }
  .card-art { height: 85px; }
  .card-copy { padding: 10px; }
  .card-title { font-size: 1.08rem; }
  .card-summary { font-size: .875rem; }
  .game-view { margin-top: 20px; }
  .game-panel { padding: 15px; }
}

@media (max-width: 345px) {
  .shell { width: calc(100% - 24px); }
  .game-grid { grid-template-columns: 1fr; }
  .filters button { padding-inline: 9px; }
}
