:root {
  --card-hover-shadow: #2630150d;
  --art-shadow: #dfe3d3;
  --cat-red-bg: #f9dbd5;
  --cat-red-border: #dc7c6b;
  --cat-blue-bg: #dce7ff;
  --cat-blue-border: #7e9acb;
  --cat-red-label-bg: #aa4432;
  --cat-red-label-ink: #ffffff;
  --cat-blue-label-bg: #365eaa;
  --cat-blue-label-ink: #ffffff;
  color-scheme: light dark;
  --paper: #f8f8f0;
  --ink: #262c24;
  --muted: #68705f;
  --line: #dce0d1;
  --card: #ffffff;
  --soft: #eef0e5;
  --lime: #d7ed87;
  --lime-ink: #28351a;
  --highlight: #d7ed87;
  --alert: #a94728;
  background: var(--paper); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-synthesis: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
[hidden] { display: none !important; }
.hub-shell { width: min(100%, 760px); min-height: 100vh; min-height: 100svh; min-height: 100dvh; padding: max(10px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); margin: auto; }
.hub-header { min-height: 65px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hub-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 500; letter-spacing: -.6px; min-height: 44px; }
.hub-mark { background: var(--ink); color: var(--paper); display: grid; grid-template-columns: repeat(2, 5px); gap: 3px; justify-content: center; align-content: center; width: 29px; height: 29px; border-radius: 9px; }
.hub-mark b { display: block; width: 5px; height: 5px; border-radius: 1px; background: currentColor; }
.hub-mark b:last-child { background: var(--lime); }
.hub-edition { font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; color: var(--muted); }
.hub-intro { padding: 35px 0 33px; }
.hub-eyebrow { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin: 0 0 17px; }
.hub-eyebrow > span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
h1 { margin: 0; font-size: 35px; line-height: 1.28; letter-spacing: -1.8px; font-weight: 500; }
h1 em { font-style: normal; position: relative; z-index: 0; }
h1 em::after { content: ''; position: absolute; left: -1px; right: -1px; bottom: 3px; height: 10px; background: var(--highlight); z-index: -1; transform: rotate(-.8deg); }
.hub-description { margin: 15px 0 0; font-size: 13px; line-height: 1.75; color: var(--muted); letter-spacing: -.25px; }
.hub-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; gap: 12px; }
.hub-section-heading h2 { font-size: 16px; font-weight: 500; letter-spacing: -.5px; margin: 0; }
.hub-section-heading > span { font-size: 10px; color: var(--muted); }
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 18px; }
.game-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); text-decoration: none; background: var(--card); transition: transform 150ms, box-shadow 150ms; }
.game-card:hover { transform: translateY(-2px); box-shadow: 0 7px 20px var(--card-hover-shadow); }
.game-card:active { transform: translateY(1px); }
.game-art { background: var(--soft); position: relative; min-height: 189px; display: flex; justify-content: center; align-items: center; gap: 11px; padding: 36px 16px 20px; overflow: hidden; }
.game-art::before { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; border: 1px solid var(--line); }
.game-type { position: absolute; top: 13px; left: 15px; color: var(--muted); font-size: 10px; z-index: 1; }
.art-hand { width: 86px; height: 111px; background: var(--card); border: 1px solid var(--line); border-radius: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; transform: rotate(-10deg) translateY(5px); z-index: 1; box-shadow: 0 5px 0 var(--art-shadow); }
.art-hand span { font-size: 9px; }
.art-hand strong { font: 49px/1.1 "Apple Color Emoji", "Segoe UI Emoji", sans-serif; font-weight: 400; }
.art-hand.is-empty { background: var(--lime); color: var(--lime-ink); border-color: transparent; transform: rotate(9deg) translateY(-3px); }
.art-hand.is-empty strong { font: 55px/1.05 ui-rounded, -apple-system, sans-serif; }
.art-vs { position: absolute; z-index: 2; top: calc(50% - 4px); left: calc(50% - 13px); display: grid; place-items: center; width: 26px; height: 26px; background: var(--ink); color: var(--paper); border-radius: 50%; font: 9px ui-monospace, monospace; }
.art-potion-pair { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 33px; height: 115px; padding-top: 12px; }
.art-potion { position: relative; display: block; width: 66px; height: 81px; border: 2px solid var(--ink); border-radius: 17px 17px 23px 23px; background: var(--card); transform: rotate(-11deg) translateY(7px); box-shadow: 0 5px 0 var(--art-shadow); }
.art-potion::before { content: ''; position: absolute; left: 17px; top: -19px; width: 28px; height: 20px; border: 2px solid var(--ink); border-bottom: 0; border-radius: 5px 5px 0 0; background: var(--card); box-shadow: 0 -6px 0 var(--ink); }
.art-potion::after { content: ''; position: absolute; top: 18px; left: 13px; width: 5px; height: 25px; border-radius: 4px; background: #ffffffa6; }
.art-potion-liquid { position: absolute; left: 7px; right: 7px; bottom: 7px; height: 43px; border-radius: 8px 8px 16px 16px; background: #729ef0; }
.art-potion-liquid::before { content: ''; position: absolute; right: 10px; top: 11px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid #ffffff9c; box-shadow: -10px 13px 0 -1px #ffffff9c; }
.art-potion.is-red { transform: rotate(11deg) translateY(-5px); }
.art-potion.is-red .art-potion-liquid { background: #ef8982; }
.art-cat-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(6, 20px); gap: 4px; transform: rotate(-4deg); }
.art-cat-cell { display: grid; place-items: center; position: relative; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--card); font: 15px/1 "Apple Color Emoji", "Segoe UI Emoji", sans-serif; }
.art-cat-cell.is-target-a { background: var(--cat-red-bg); border-color: var(--cat-red-border); }
.art-cat-cell.is-target-b { background: var(--cat-blue-bg); border-color: var(--cat-blue-border); }
.art-cat-target { position: absolute; right: -5px; top: -6px; width: 12px; height: 12px; display: grid; place-items: center; border-radius: 4px; background: var(--cat-red-label-bg); color: var(--cat-red-label-ink); font: 700 8px/1 ui-monospace, monospace; }
.is-target-b .art-cat-target { background: var(--cat-blue-label-bg); color: var(--cat-blue-label-ink); }
.game-card-body { padding: 21px 20px 18px; }
.game-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-title-row h3 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -1px; }
.game-open { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--lime); color: var(--lime-ink); font-size: 20px; }
.game-description { margin: 8px 0 18px; font-size: 12px; line-height: 1.8; color: var(--muted); word-break: keep-all; }
.game-record-row { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; font-size: 11px; }
.game-record-label { color: var(--muted); }
.game-record { font-weight: 500; font-variant-numeric: tabular-nums; }
.game-record[data-empty="true"] { font-weight: 400; color: var(--muted); }
.hub-empty { color: var(--muted); font-size: 13px; padding-block: 20px; }
.hub-footer { padding-top: 33px; text-align: center; }
.footer-rule { width: 25px; height: 1px; display: block; background: var(--line); margin: 0 auto; }
.hub-footer p { margin: 16px 0 9px; font-size: 10px; color: var(--muted); line-height: 1.7; }
.hub-footer p[data-warning="true"] { color: var(--alert); }
.hub-footer-label { font-size: 10px; color: var(--muted); letter-spacing: .1px; }
@media (min-width: 600px) {
  .hub-shell { padding-inline: 32px; }
  .hub-intro { padding-block: 50px 43px; }
  h1 { font-size: 44px; }
  .hub-description br { display: none; }
  .game-grid:has(> :only-child) { grid-template-columns: minmax(0, 380px); }
}
@media (max-width: 350px) {
  .hub-shell { padding-inline: 20px; }
  .hub-edition { font-size: 8px; letter-spacing: .2px; }
  h1 { font-size: 31px; }
  .hub-brand { font-size: 15px; gap: 7px; }
  .game-card-body { padding-inline: 17px; }
}
@media (prefers-reduced-motion: reduce) { .game-card { transition: none; } }

/* Preserve the same palette without requiring newer color functions. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #20221e;
    --ink: #f2f3e9;
    --muted: #b3b9a7;
    --line: #464d3d;
    --card: #30352b;
    --soft: #292e25;
    --highlight: #50622b;
    --alert: #ffb499;
    --card-hover-shadow: #00000020;
    --art-shadow: #1e241b;
    --cat-red-bg: #673b36;
    --cat-red-border: #d58a7c;
    --cat-blue-bg: #314c72;
    --cat-blue-border: #8baae0;
    --cat-red-label-bg: #ffc6ba;
    --cat-red-label-ink: #53271e;
    --cat-blue-label-bg: #c4d7ff;
    --cat-blue-label-ink: #1e365f;
  }
}
