@layer reset, tokens, base, shell, components, games, utilities;

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

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    margin: 0;
  }

  img, svg {
    max-width: 100%;
  }

  h1, h2, h3, h4 {
    margin: 0 0 8px;
    line-height: 1.3;
    letter-spacing: -0.01em;
  }

  p {
    margin: 0 0 10px;
  }

  p:last-child {
    margin-bottom: 0;
  }

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

@layer tokens {
  :root {
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --bg-light: #F3F6FC;
    --bg-dark: #0B0F19;
    --card-light: #FFFFFF;
    --card-dark: #131A29;
    --surface-light: #EEF2FA;
    --surface-dark: #1B2438;
    --glass-light: rgba(255, 255, 255, 0.80);
    --glass-dark: rgba(15, 22, 37, 0.82);

    --ink-light: #0F172A;
    --ink-dark: #F1F5F9;
    --muted-light: #475569;
    --muted-dark: #94A3B8;

    --line-light: rgba(15, 23, 42, 0.08);
    --line-dark: rgba(255, 255, 255, 0.09);
    --control-border-light: #7B8BA1;
    --control-border-dark: #5B6B84;

    --brand-light: #2563EB;
    --brand-dark: #60A5FA;
    --brand-solid-light: #2563EB;
    --brand-solid-dark: #2563EB;
    --brand-hover-light: #1D4ED8;
    --brand-hover-dark: #3B82F6;
    --brand-ink-light: #FFFFFF;
    --brand-ink-dark: #FFFFFF;

    --ok-light: #15803D;
    --ok-dark: #4ADE80;
    --ok-bg-light: #E8F8EE;
    --ok-bg-dark: rgba(34, 197, 94, 0.16);

    --warn-light: #C81E1E;
    --warn-dark: #FCA5A5;
    --warn-bg-light: #FEF2F2;
    --warn-bg-dark: rgba(239, 68, 68, 0.18);

    --gold-light: #B45309;
    --gold-dark: #FBBF24;

    --hb-light: #C8382E;
    --hb-dark: #9E2B23;
    --hb-ink-light: #FFF5E8;
    --hb-ink-dark: #FFF1DE;
    --hb-gold: #F3C14B;

    --t-leaf-light: #2E9A4E;
    --t-leaf-dark: #4ADE80;
    --t-trunk-light: #7A5230;
    --t-trunk-dark: #A6754B;
    --t-fruit-light: #E0A82E;
    --t-fruit-dark: #FBBF24;
    --t-flower-light: #F472B6;
    --t-flower-dark: #F9A8D4;
    --t-ground-light: #D7CFC0;
    --t-ground-dark: #334155;

    --bg: var(--bg-light);
    --card: var(--card-light);
    --surface: var(--surface-light);
    --glass: var(--glass-light);
    --ink: var(--ink-light);
    --muted: var(--muted-light);
    --line: var(--line-light);
    --control-border: var(--control-border-light);
    --brand: var(--brand-light);
    --brand-solid: var(--brand-solid-light);
    --brand-hover: var(--brand-hover-light);
    --brand-ink: var(--brand-ink-light);
    --ok: var(--ok-light);
    --ok-bg: var(--ok-bg-light);
    --warn: var(--warn-light);
    --warn-bg: var(--warn-bg-light);
    --gold: var(--gold-light);
    --hb: var(--hb-light);
    --hb-ink: var(--hb-ink-light);
    --t-leaf: var(--t-leaf-light);
    --t-trunk: var(--t-trunk-light);
    --t-fruit: var(--t-fruit-light);
    --t-flower: var(--t-flower-light);
    --t-ground: var(--t-ground-light);

    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-elevated: 0 12px 32px -6px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.04);
    --radius-card: 18px;
    --radius-control: 12px;
    --radius-pill: 999px;

    --scrollbar-track: #E5E9F2;
    --scrollbar-thumb: #6E7B91;

    color-scheme: light dark;
    font-family: var(--font-sans);
    accent-color: var(--brand);
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  }

  :root:has(> head > meta[name="color-scheme"][content="dark"]),
  :root[data-theme="dark"] {
    color-scheme: dark;
  }

  :root:has(> head > meta[name="color-scheme"][content="light"]),
  :root[data-theme="light"] {
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: var(--bg-dark);
      --card: var(--card-dark);
      --surface: var(--surface-dark);
      --glass: var(--glass-dark);
      --ink: var(--ink-dark);
      --muted: var(--muted-dark);
      --line: var(--line-dark);
      --control-border: var(--control-border-dark);
      --brand: var(--brand-dark);
      --brand-solid: var(--brand-solid-dark);
      --brand-hover: var(--brand-hover-dark);
      --brand-ink: var(--brand-ink-dark);
      --ok: var(--ok-dark);
      --ok-bg: var(--ok-bg-dark);
      --warn: var(--warn-dark);
      --warn-bg: var(--warn-bg-dark);
      --gold: var(--gold-dark);
      --hb: var(--hb-dark);
      --hb-ink: var(--hb-ink-dark);
      --t-leaf: var(--t-leaf-dark);
      --t-trunk: var(--t-trunk-dark);
      --t-fruit: var(--t-fruit-dark);
      --t-flower: var(--t-flower-dark);
      --t-ground: var(--t-ground-dark);
      --shadow-card: 0 6px 24px -4px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
      --shadow-elevated: 0 14px 36px -6px rgba(0, 0, 0, 0.55);
      --scrollbar-track: #111827;
      --scrollbar-thumb: #64748B;
    }
  }

  :root[data-theme="dark"] {
    --bg: var(--bg-dark);
    --card: var(--card-dark);
    --surface: var(--surface-dark);
    --glass: var(--glass-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --line: var(--line-dark);
    --control-border: var(--control-border-dark);
    --brand: var(--brand-dark);
    --brand-solid: var(--brand-solid-dark);
    --brand-hover: var(--brand-hover-dark);
    --brand-ink: var(--brand-ink-dark);
    --ok: var(--ok-dark);
    --ok-bg: var(--ok-bg-dark);
    --warn: var(--warn-dark);
    --warn-bg: var(--warn-bg-dark);
    --gold: var(--gold-dark);
    --hb: var(--hb-dark);
    --hb-ink: var(--hb-ink-dark);
    --t-leaf: var(--t-leaf-dark);
    --t-trunk: var(--t-trunk-dark);
    --t-fruit: var(--t-fruit-dark);
    --t-flower: var(--t-flower-dark);
    --t-ground: var(--t-ground-dark);
    --shadow-card: 0 6px 24px -4px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow-elevated: 0 14px 36px -6px rgba(0, 0, 0, 0.55);
    --scrollbar-track: #111827;
    --scrollbar-thumb: #64748B;
  }

  @supports (color: light-dark(white, black)) {
    :root {
      --bg: light-dark(var(--bg-light), var(--bg-dark));
      --card: light-dark(var(--card-light), var(--card-dark));
      --surface: light-dark(var(--surface-light), var(--surface-dark));
      --glass: light-dark(var(--glass-light), var(--glass-dark));
      --ink: light-dark(var(--ink-light), var(--ink-dark));
      --muted: light-dark(var(--muted-light), var(--muted-dark));
      --line: light-dark(var(--line-light), var(--line-dark));
      --control-border: light-dark(var(--control-border-light), var(--control-border-dark));
      --brand: light-dark(var(--brand-light), var(--brand-dark));
      --brand-hover: light-dark(var(--brand-hover-light), var(--brand-hover-dark));
      --ok: light-dark(var(--ok-light), var(--ok-dark));
      --ok-bg: light-dark(var(--ok-bg-light), var(--ok-bg-dark));
      --warn: light-dark(var(--warn-light), var(--warn-dark));
      --warn-bg: light-dark(var(--warn-bg-light), var(--warn-bg-dark));
      --gold: light-dark(var(--gold-light), var(--gold-dark));
      --hb: light-dark(var(--hb-light), var(--hb-dark));
      --hb-ink: light-dark(var(--hb-ink-light), var(--hb-ink-dark));
      --t-leaf: light-dark(var(--t-leaf-light), var(--t-leaf-dark));
      --t-trunk: light-dark(var(--t-trunk-light), var(--t-trunk-dark));
      --t-fruit: light-dark(var(--t-fruit-light), var(--t-fruit-dark));
      --t-flower: light-dark(var(--t-flower-light), var(--t-flower-dark));
      --t-ground: light-dark(var(--t-ground-light), var(--t-ground-dark));
      --scrollbar-track: light-dark(#E5E9F2, #111827);
      --scrollbar-thumb: light-dark(#6E7B91, #64748B);
    }
  }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@layer base {
  body {
    min-height: 100dvh;
    overflow-x: clip;
    background-color: var(--bg);
    background-image:
      radial-gradient(64rem 34rem at 8% -6%, color-mix(in oklab, var(--brand) 11%, transparent), transparent 60%),
      radial-gradient(52rem 28rem at 92% -8%, color-mix(in oklab, #0EA5E9 9%, transparent), transparent 62%);
    background-attachment: fixed;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.62;
  }

  body.skin-h5 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  a {
    color: var(--brand);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
  }

  a:hover {
    text-decoration-thickness: 2px;
  }

  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }

  code {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--surface);
  }

  /* Smooth vector & HD illustration rendering */
  img.pix,
  .fcrop,
  .crop-pic,
  .dex-pic,
  .pen-pic,
  .pen-bug,
  .pet-big,
  .pet-mid,
  .car-pic,
  .car-big,
  .zh-intro-art,
  .zh-mon-art,
  .zh-cap-art,
  .zh-ico,
  .av img,
  .av-btn img,
  .decor-row img,
  .decor-list img,
  .fland,
  .fland .fbadges img,
  .gicon,
  .ui-ico {
    image-rendering: auto;
  }

  .xiu-grid img,
  .xiu-worn img {
    image-rendering: auto;
  }

  @supports not (scrollbar-color: auto) {
    .tabs::-webkit-scrollbar,
    .chips::-webkit-scrollbar {
      display: none;
    }
  }
}

@layer shell {
  /* Mobile top glass header */
  .top.h5-top {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--line);
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }

  .h5-top-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    max-width: 1220px;
    margin: 0 auto;
  }

  .logo.h5-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.02em;
    text-decoration: none;
    flex: none;
    white-space: nowrap;
  }

  .h5-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 55%, #1D4ED8 100%);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.03em;
    box-shadow: 0 3px 10px -2px rgba(37, 99, 235, 0.45);
  }

  .h5-top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 0%;
    gap: 5px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0;
  }

  .h5-top-nav::-webkit-scrollbar {
    display: none;
  }

  .h5-top-chip,
  .h5-theme-btn,
  .h5-skin-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: none;
    min-height: 32px;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, scale 140ms ease;
  }

  @media (max-width: 640px) {
    .h5-top-chip[href="/chat"],
    .h5-top-chip.h5-top-me {
      display: none;
    }
    .h5-top-chip .h5-chip-txt {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
      border: 0;
    }
    .h5-top-chip {
      min-width: 32px;
      min-height: 32px;
      padding: 4px 7px;
    }
    .h5-theme-btn {
      min-width: 32px;
      min-height: 32px;
      padding: 4px 7px;
    }
    .h5-skin-pill {
      min-height: 32px;
      padding: 4px 8px;
      font-size: 11.5px;
    }
  }

  .h5-top-chip:hover,
  .h5-theme-btn:hover,
  .h5-skin-pill:hover {
    background: color-mix(in oklab, var(--brand) 10%, var(--surface));
    border-color: color-mix(in oklab, var(--brand) 30%, transparent);
    text-decoration: none;
  }

  .h5-top-chip[aria-current="page"] {
    background: color-mix(in oklab, var(--brand) 14%, var(--card));
    border-color: color-mix(in oklab, var(--brand) 42%, transparent);
    color: var(--brand);
  }

  .h5-top-me span {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .h5-top-cta {
    background: var(--brand-solid);
    border-color: transparent;
    color: #FFFFFF;
  }

  .h5-top-cta:hover {
    background: var(--brand-hover);
    color: #FFFFFF;
  }

  .h5-skin-pill {
    background: color-mix(in oklab, var(--gold) 10%, var(--surface));
    border-color: color-mix(in oklab, var(--gold) 26%, transparent);
  }

  .h5-theme-btn {
    padding: 4px 8px;
  }

  .h5-theme-btn .ico-light,
  .h5-theme-btn .ico-dark,
  .h5-side-ctrl .ico-light,
  .h5-side-ctrl .ico-dark {
    display: none;
  }

  [data-theme-state="light"] .ico-auto,
  [data-theme-state="dark"] .ico-auto {
    display: none;
  }

  [data-theme-state="light"] .ico-light {
    display: inline-block;
  }

  [data-theme-state="dark"] .ico-dark {
    display: inline-block;
  }

  .ui-ico {
    display: inline-block;
    flex: none;
    vertical-align: middle;
    transition: filter 150ms ease;
  }

  :root[data-theme="dark"] .ui-ico {
    filter: brightness(0) invert(0.92);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .ui-ico {
      filter: brightness(0) invert(0.92);
    }
  }

  .h5-top-chip[aria-current="page"] .ui-ico,
  .h5-dock a[aria-current="page"] .ui-ico {
    filter: brightness(0) saturate(100%) invert(32%) sepia(93%) saturate(1852%) hue-rotate(207deg) brightness(96%) contrast(98%);
  }

  :root[data-theme="dark"] .h5-top-chip[aria-current="page"] .ui-ico,
  :root[data-theme="dark"] .h5-dock a[aria-current="page"] .ui-ico {
    filter: brightness(0) saturate(100%) invert(65%) sepia(72%) saturate(1800%) hue-rotate(192deg) brightness(102%) contrast(100%);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .h5-top-chip[aria-current="page"] .ui-ico,
    :root:not([data-theme="light"]) .h5-dock a[aria-current="page"] .ui-ico {
      filter: brightness(0) saturate(100%) invert(65%) sepia(72%) saturate(1800%) hue-rotate(192deg) brightness(102%) contrast(100%);
    }
  }

  /* Marquee banner */
  .marquee {
    background: color-mix(in oklab, var(--warn) 8%, var(--card));
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }

  .h5-mq-in {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1220px;
    margin: 0 auto;
    padding: 7px max(14px, env(safe-area-inset-left));
  }

  .mq-tag {
    flex: none;
    padding: 1px 7px;
    border-radius: 6px;
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid color-mix(in oklab, var(--warn) 25%, transparent);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
  }

  .mq-view {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .mq-track {
    margin: 0;
    white-space: nowrap;
    display: inline-flex;
    animation: mq 32s linear infinite;
  }

  .mq-run {
    padding-right: 4em;
  }

  .mq-view:hover .mq-track,
  .mq-view:focus-within .mq-track {
    animation-play-state: paused;
  }

  .mq-item + .mq-item::before {
    content: "  ◆  ";
    color: var(--muted);
  }

  .mq-item b {
    margin-right: 3px;
  }

  @keyframes mq {
    to {
      transform: translateX(-50%);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .mq-track {
      animation: none;
      white-space: normal;
    }
    .mq-copy {
      display: none;
    }
  }

  /* Main shell */
  .h5-shell {
    max-width: 780px;
    margin: 0 auto;
    padding: 12px max(12px, env(safe-area-inset-left)) calc(84px + env(safe-area-inset-bottom));
  }

  .h5-side {
    display: none;
  }

  .h5-content {
    min-width: 0;
  }

  .main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 0;
  }

  .main > * {
    min-width: 0;
  }

  .wide {
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
  }

  .mq-wide {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
  }

  /* Footer */
  .foot {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 20px 8px 8px;
    display: grid;
    gap: 6px;
  }

  .foot nav a {
    color: var(--muted);
    text-decoration: none;
  }

  .foot nav a:hover {
    color: var(--brand);
    text-decoration: underline;
  }

  .h5-foot-ver {
    margin: 0;
  }

  .foot .inline {
    margin-left: 6px;
  }

  /* Mobile bottom glass dock */
  .h5-dock {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px max(10px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px -4px rgba(15, 23, 42, 0.08);
  }

  .h5-dock a {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 2px;
    border-radius: 14px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: background-color 150ms ease, color 150ms ease, scale 140ms ease;
  }

  .h5-dock a[aria-current="page"] {
    color: var(--brand);
    font-weight: 700;
    background: color-mix(in oklab, var(--brand) 12%, transparent);
  }

  .h5-dock a[aria-current="page"]::after {
    content: "";
    position: absolute;
    top: 2px;
    width: 20px;
    height: 3px;
    border-radius: 999px;
    background: var(--brand);
  }

  .h5-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 16px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 0 2px var(--card);
  }

  /* Desktop dual-column shell (>= 920px) */
  @media (min-width: 920px) {
    .top.h5-top,
    .h5-dock {
      display: none;
    }

    .h5-shell {
      display: grid;
      grid-template-columns: 240px minmax(0, 1fr);
      gap: 22px;
      align-items: start;
      max-width: 1220px;
      padding: 20px 24px 48px;
    }

    .h5-mq-in {
      padding: 8px 24px;
    }

    .h5-side {
      display: block;
      position: sticky;
      top: 20px;
      max-height: calc(100dvh - 40px);
      overflow-y: auto;
      scrollbar-width: thin;
    }

    .h5-side-card {
      display: grid;
      gap: 10px;
      background: var(--glass);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      backdrop-filter: blur(20px) saturate(180%);
      border: 1px solid var(--line);
      border-radius: 20px;
      padding: 14px 12px;
      box-shadow: var(--shadow-card);
    }

    @supports (corner-shape: squircle) {
      .h5-side-card {
        border-radius: 24px;
        corner-shape: squircle;
      }
    }

    .h5-side-logo {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 4px 6px;
      color: var(--ink);
      text-decoration: none;
    }

    .h5-side-logo .h5-brand-mark {
      width: 36px;
      height: 36px;
      border-radius: 11px;
      font-size: 14px;
    }

    .h5-side-logo span:last-child {
      display: grid;
      gap: 1px;
    }

    .h5-side-logo b {
      font-size: 16px;
      line-height: 1.2;
    }

    .h5-side-logo small {
      font-size: 11px;
      color: var(--muted);
    }

    .h5-side-user {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px;
      border-radius: 14px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--ink);
      text-decoration: none;
      transition: border-color 150ms ease, background-color 150ms ease;
    }

    .h5-side-user:hover {
      border-color: color-mix(in oklab, var(--brand) 38%, transparent);
      text-decoration: none;
    }

    .h5-side-avatar {
      display: inline-grid;
      place-items: center;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: color-mix(in oklab, var(--brand) 14%, var(--card));
      flex: none;
    }

    .h5-side-user span:last-child {
      display: grid;
      min-width: 0;
    }

    .h5-side-user b {
      font-size: 14px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .h5-side-user small {
      font-size: 11px;
      color: var(--muted);
    }

    .h5-side-auth {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .h5-side-auth .btn {
      margin-top: 0;
      text-align: center;
      justify-content: center;
    }

    .h5-side-nav {
      display: grid;
      gap: 2px;
    }

    .h5-side-label {
      margin: 5px 10px 2px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--muted);
      text-transform: uppercase;
    }

    .h5-side-label:first-child {
      margin-top: 0;
    }

    .h5-side-nav a {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 6px 10px;
      border-radius: 11px;
      color: var(--ink);
      text-decoration: none;
      font-size: 13.5px;
      font-weight: 500;
      transition: background-color 140ms ease, color 140ms ease, scale 140ms ease;
    }

    .h5-side-nav a:hover {
      background: var(--surface);
      text-decoration: none;
    }

    .h5-side-nav a > span {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex: 1;
      min-width: 0;
    }

    .h5-side-nav a[aria-current="page"] {
      background: var(--brand-solid);
      color: #FFFFFF;
      font-weight: 600;
      box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.38);
    }

    .h5-side-nav a[aria-current="page"] .ui-ico {
      filter: brightness(0) invert(1);
    }

    .h5-side-nav a[aria-current="page"] .badge {
      background: #FFFFFF;
      color: #1D4ED8;
    }

    .h5-side-foot {
      display: grid;
      gap: 6px;
      padding-top: 10px;
      border-top: 1px solid var(--line);
    }

    .h5-side-ctrl {
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      padding: 8px 10px;
      border-radius: 11px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--ink);
      font-size: 13px;
      font-weight: 600;
      text-decoration: none;
      cursor: pointer;
      transition: background-color 140ms ease, border-color 140ms ease;
    }

    .h5-side-ctrl:hover {
      border-color: color-mix(in oklab, var(--brand) 36%, transparent);
      text-decoration: none;
    }
  }
}

@layer components {
  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    padding: 18px;
    box-shadow: var(--shadow-card);
  }

  @supports (corner-shape: squircle) {
    .card {
      border-radius: 22px;
      corner-shape: squircle;
    }
  }

  .card h1 {
    font-size: 20px;
    font-weight: 750;
  }

  .card h2 {
    font-size: 17px;
    font-weight: 700;
  }

  .card h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 12px 0 6px;
  }

  .card h1 small,
  .card h2 small {
    font-size: 13px;
    font-weight: 500;
  }

  .card h2 a {
    color: inherit;
    text-decoration: none;
  }

  .card h2 a:hover {
    color: var(--brand);
  }

  .muted {
    color: var(--muted);
  }

  .small {
    font-size: 13px;
  }

  .alert {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid color-mix(in oklab, var(--warn) 28%, transparent);
    padding: 11px 14px;
    border-radius: 14px;
    margin: 0;
    font-weight: 500;
  }

  .notice {
    background: var(--ok-bg);
    color: var(--ok);
    border: 1px solid color-mix(in oklab, var(--ok) 26%, transparent);
    padding: 11px 14px;
    border-radius: 14px;
    margin: 0 0 8px;
  }

  /* Daily Almanac Fortune Banner */
  .h5-fortune {
    border: 1px solid color-mix(in oklab, #DC2626 42%, transparent);
    background: linear-gradient(120deg, color-mix(in oklab, #DC2626 10%, var(--card)), color-mix(in oklab, #F59E0B 10%, var(--card)));
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .h5-fortune-txt {
    min-width: 0;
    flex: 1 1 200px;
    overflow-wrap: anywhere;
  }

  .h5-fortune-txt .tag {
    margin-right: 6px;
  }

  .h5-fortune-btn {
    margin-top: 0;
    background: #C8382E;
    color: #FFF5E8;
  }

  .h5-fortune-btn:hover:not(:disabled) {
    background: #B32E25;
  }

  /* Buttons & interactive micro-feedback */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 600;
    background: var(--brand-solid);
    color: #FFFFFF;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    padding: 10px 18px;
    min-height: 44px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 10px;
    box-shadow: 0 2px 8px -2px rgba(37, 99, 235, 0.35);
    transition: background-color 150ms ease, box-shadow 150ms ease, scale 140ms ease, border-color 150ms ease;
  }

  .btn:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--brand-hover);
    box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.42);
    text-decoration: none;
  }

  .btn.ghost {
    background: transparent;
    color: var(--brand);
    border: 1px solid color-mix(in oklab, var(--brand) 48%, transparent);
    box-shadow: none;
    margin-top: 0;
  }

  .btn.ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: color-mix(in oklab, var(--brand) 10%, transparent);
    border-color: var(--brand);
    box-shadow: none;
  }

  .btn.danger {
    background: #DC2626;
    color: #FFFFFF;
    box-shadow: 0 2px 8px -2px rgba(220, 38, 38, 0.35);
  }

  .btn.danger:hover:not(:disabled):not([aria-disabled="true"]) {
    background: #B91C1C;
  }

  .btn.ghost.danger {
    background: transparent;
    color: var(--warn);
    border-color: color-mix(in oklab, var(--warn) 48%, transparent);
    box-shadow: none;
  }

  .btn.ghost.danger:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--warn-bg);
  }

  .btn.small {
    min-height: 36px;
    padding: 6px 13px;
    font-size: 13px;
    border-radius: 10px;
  }

  .buy .btn,
  .gactions .btn,
  .jh-arts-bar .btn,
  .jh-exits .btn,
  .db-exits .btn,
  .row .btn,
  .actions .btn,
  .row-actions .btn,
  .mini-vars .btn,
  .h5-fortune .btn,
  .trade-filters .btn,
  .card-wall-act .btn,
  .plist .btn,
  td .btn,
  .poll-form .btn {
    margin-top: 0;
  }

  .btn.hb-like {
    background: var(--t-fruit);
    color: #3A2A00;
    box-shadow: none;
  }

  .btn:disabled,
  .btn[aria-disabled="true"] {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
  }

  :where(.btn, .gtile > a, .h5-dock a, .h5-side-nav a, .gstrip a, .shop-tiles a, .mini-hub a):active:not(:disabled):not([aria-disabled="true"]) {
    scale: 0.97;
  }

  .inline {
    display: inline;
  }

  .link {
    background: none;
    border: 0;
    color: var(--brand);
    font: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    min-height: 24px;
  }

  .link.danger {
    color: var(--warn);
  }

  .link.liked {
    color: var(--warn);
    font-weight: 700;
  }

  .link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* Forms */
  .form {
    display: grid;
    gap: 8px;
    max-width: 440px;
  }

  .wide-form {
    max-width: 720px;
  }

  .form label,
  .form .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-top: 6px;
  }

  .form input:not([type="radio"]):not([type="checkbox"]),
  .form textarea,
  .select,
  .row input,
  input.tiny,
  textarea.out,
  .cards-form select {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    min-height: 44px;
    max-width: 100%;
    min-width: 0;
    transition: border-color 140ms ease, background-color 140ms ease;
  }

  .form textarea,
  textarea.out {
    resize: vertical;
  }

  textarea.out {
    width: 100%;
    margin-top: 6px;
  }

  input.tiny {
    font-size: 13px;
    padding: 5px 9px;
    width: 9em;
    min-height: 34px;
    border-radius: 9px;
  }

  .row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
  }

  .row input {
    flex: 1 1 180px;
  }

  .row .btn {
    margin-top: 0;
  }

  .radios {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
  }

  .radios.col {
    flex-direction: column;
    gap: 2px;
  }

  .radios label {
    color: var(--ink);
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-height: 44px;
    margin: 0;
    font-weight: 400;
  }

  .checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px 12px;
  }

  .checks label,
  .check {
    color: var(--ink);
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-height: 36px;
    margin: 0;
    font-weight: 400;
  }

  .stack {
    display: grid;
    gap: 10px;
  }

  .stack label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
  }

  .stack input,
  .stack select,
  .stack textarea {
    font: inherit;
    padding: 9px 12px;
    border: 1px solid var(--control-border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
  }

  /* Tags, Badges, Stats & Key-Value */
  .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
  }

  .tag.warn {
    background: var(--warn-bg);
    color: var(--warn);
    border-color: color-mix(in oklab, var(--warn) 25%, transparent);
  }

  .tag.ok {
    background: var(--ok-bg);
    color: var(--ok);
    border-color: color-mix(in oklab, var(--ok) 25%, transparent);
  }

  .tag.top {
    background: var(--brand-solid);
    color: #FFFFFF;
    border-color: transparent;
    margin-right: 4px;
  }

  .tag.fine {
    background: var(--ok-bg);
    color: var(--ok);
  }

  .tag.ann {
    background: var(--warn-bg);
    color: var(--warn);
  }

  .tag.lock {
    background: var(--surface);
    color: var(--muted);
  }

  .tag.soil {
    background: color-mix(in oklab, #16A34A 14%, var(--card));
    color: var(--ok);
  }

  .badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    margin-left: 3px;
    border-radius: 999px;
    background: #DC2626;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  .num {
    font-variant-numeric: tabular-nums;
    color: var(--ink);
  }

  .num.pos {
    color: var(--ok);
  }

  .num.neg {
    color: var(--warn);
  }

  .kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0 0 10px;
    font-variant-numeric: tabular-nums;
  }

  .kv dt {
    color: var(--muted);
  }

  .kv dd {
    margin: 0;
    font-weight: 600;
  }

  .stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    margin: 10px 0 14px;
  }

  .stats div {
    display: grid;
    gap: 2px;
  }

  .stats dt {
    color: var(--muted);
    font-size: 12px;
  }

  .stats dd {
    margin: 0;
    font-size: 20px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
  }

  .sig-big {
    color: var(--muted);
    margin: 0 0 6px;
  }

  .links,
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .actions .btn,
  .row-actions .btn {
    margin-top: 0;
  }

  .row-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: auto;
  }

  .grid-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .grid-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
  }

  .grid-links a:hover {
    border-color: color-mix(in oklab, var(--brand) 42%, transparent);
    background: color-mix(in oklab, var(--brand) 8%, var(--surface));
    text-decoration: none;
  }

  .wap-links {
    line-height: 1.9;
  }

  /* Tables */
  .scroll,
  .table-wrap,
  .tbl-wrap {
    overflow-x: auto;
    position: relative;
  }

  .table,
  table.lv,
  .tbl {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }

  .table th,
  .table td,
  table.lv th,
  table.lv td,
  .tbl th,
  .tbl td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
  }

  .table th,
  table.lv th,
  .tbl th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
  }

  .table td.mono {
    white-space: normal;
    word-break: break-all;
    font-family: var(--font-mono);
    font-size: 12px;
    min-width: 220px;
  }

  .table td a {
    display: inline-block;
    min-height: 24px;
  }

  .tbl td.num,
  .tbl th.num {
    text-align: right;
  }

  .tbl td.wrap {
    white-space: normal;
    min-width: 180px;
  }

  /* Tabs & Chips: swipeable with scroll snap */
  .tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .tabs a {
    position: relative;
    white-space: nowrap;
    flex: none;
    scroll-snap-align: start;
    padding: 8px 14px;
    min-height: 40px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 140ms ease;
  }

  .tabs a:hover {
    color: var(--ink);
  }

  .tabs a.current {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 700;
  }

  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    scroll-snap-type: x proximity;
  }

  @media (max-width: 640px) {
    .chips {
      flex-wrap: nowrap;
      overflow-x: auto;
      scrollbar-width: none;
      padding-bottom: 2px;
    }
  }

  .chips a {
    flex: none;
    scroll-snap-align: start;
    padding: 6px 13px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  .chips a.current {
    background: var(--brand-solid);
    color: #FFFFFF;
    border-color: transparent;
    font-weight: 600;
  }

  /* Details disclosure */
  .more {
    margin-top: 12px;
  }

  .more summary {
    cursor: pointer;
    color: var(--muted);
    min-height: 34px;
    font-weight: 600;
  }

  .more form {
    display: block;
    margin: 6px 0;
  }

  /* Lists: users, entries, boards, topics, floors, feed, tasks */
  .ulist,
  .entries,
  .blist,
  .tlist,
  .floors,
  .flist,
  .tasks,
  .plist,
  .glist,
  .jlist,
  .notices {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ulist li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    min-width: 0;
  }

  .ulist li:last-child {
    border-bottom: 0;
  }

  .ulist .who {
    font-weight: 600;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
  }

  .ulist .sig {
    flex: 1 1 120px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .entries {
    margin-top: 12px;
  }

  .entries li {
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }

  .entries .body {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 2px 0;
  }

  /* Chat DMs */
  .chat {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 10px;
  }

  .chat li {
    display: grid;
    justify-items: start;
    max-width: 85%;
  }

  .chat li.mine {
    justify-self: end;
    justify-items: end;
  }

  .chat .bubble {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px 16px 16px 4px;
    padding: 9px 14px;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .chat li.mine .bubble {
    background: var(--brand-solid);
    border-color: transparent;
    color: #FFFFFF;
    border-radius: 16px 16px 4px 16px;
  }

  /* Forum */
  .blist li {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .blist li:last-child {
    border-bottom: 0;
  }

  .blist .bn {
    font-weight: 700;
    min-height: 24px;
  }

  .blist .desc {
    flex-basis: 100%;
  }

  .tlist li {
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .tlist li:last-child {
    border-bottom: 0;
  }

  .tlist .tt {
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    word-break: break-word;
    min-height: 24px;
  }

  .tlist .tt:hover {
    color: var(--brand);
  }

  .tlist .meta a {
    color: inherit;
  }

  .tlist .tag,
  .post h1 .tag {
    margin-right: 4px;
    vertical-align: 1px;
  }

  .crumbs {
    margin: 0 0 6px;
    color: var(--muted);
  }

  .pager {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    margin-top: 14px;
  }

  .pager a {
    min-height: 36px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
  }

  .post h1 {
    font-size: 20px;
    word-break: break-word;
  }

  .post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
    margin-top: 8px;
  }

  .post-actions a,
  .post-actions .link {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
  }

  .post-actions a:hover,
  .post-actions .link:hover {
    color: var(--brand);
    border-color: color-mix(in oklab, var(--brand) 36%, transparent);
    text-decoration: none;
  }

  .post-actions .link.liked {
    color: var(--warn);
    background: var(--warn-bg);
    border-color: color-mix(in oklab, var(--warn) 32%, transparent);
  }

  .floors li {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 72px;
  }

  .floors li:last-child {
    border-bottom: 0;
  }

  .quote {
    margin: 6px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--brand);
    background: var(--surface);
    border-radius: 0 10px 10px 0;
  }

  .ubb {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.75;
  }

  .ubb.deleted {
    opacity: 0.6;
  }

  .mod summary {
    color: var(--brand);
  }

  .ubb-table td {
    white-space: normal;
  }

  .ubb-table code {
    white-space: pre-wrap;
    word-break: break-all;
  }

  .palette {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 6px;
  }

  .palette li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
  }

  .palette .sw {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--line);
    flex: none;
  }

  /* UBB decorations */
  .u-al-left { text-align: left; }
  .u-al-center { text-align: center; }
  .u-al-right { text-align: right; }
  .u-bg { padding: 2px 6px; border-radius: 4px; }
  .u-box { border: 2px solid; padding: 6px 10px; border-radius: 8px; }
  .u-line { border-bottom: 2px solid; padding-bottom: 2px; }
  .u-ring { border: 2px solid; border-radius: 999px; padding: 0 8px; }
  .u-hidden { border: 1px dashed var(--control-border); color: var(--muted); padding: 10px; border-radius: 10px; text-align: center; }
  .u-reveal { border: 1px dashed var(--ok); padding: 10px; border-radius: 10px; }
  .u-at { font-weight: 600; }
  .u-sqm { font-weight: 700; background-image: linear-gradient(90deg, #e53935, #fb8c00, #fdd835, #43a047, #1e88e5, #8e24aa); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .u-sqm1 { background-image: linear-gradient(90deg, #ff4081, #7c4dff); }
  .u-sqm2 { background-image: linear-gradient(90deg, #00b0ff, #00e676); }
  .u-sqm3 { background-image: linear-gradient(90deg, #ff6d00, #ffd600); }
  .u-sqm4 { background-image: linear-gradient(90deg, #d50000, #aa00ff, #2962ff); }
  .u-sqm5 { background-image: linear-gradient(90deg, #1de9b6, #2979ff, #f50057); }
  .u-xsign { font-weight: 700; letter-spacing: 0.05em; text-shadow: 0 0 6px var(--brand); }
  .u-mq { display: block; overflow: hidden; white-space: nowrap; }
  .u-mq > span { display: inline-block; }
  .u-mq-left > span { animation: u-left 8s linear infinite; padding-left: 100%; }
  .u-mq-right > span { animation: u-right 8s linear infinite; }
  .u-mq-up, .u-mq-down { height: 1.8em; }
  .u-mq-up > span { animation: u-up 4s linear infinite; }
  .u-mq-down > span { animation: u-down 4s linear infinite; }
  @keyframes u-left { from { transform: translateX(0); } to { transform: translateX(-100%); } }
  @keyframes u-right { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
  @keyframes u-up { from { transform: translateY(1.8em); } to { transform: translateY(-1.8em); } }
  @keyframes u-down { from { transform: translateY(-1.8em); } to { transform: translateY(1.8em); } }
  @media (prefers-reduced-motion: reduce) {
    .u-mq > span { animation: none; padding-left: 0; }
  }

  .board-edit {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }

  .board-edit summary {
    cursor: pointer;
    min-height: 32px;
  }

  .board-edit h3 {
    margin: 12px 0 4px;
  }

  .grid3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
  }

  .grid3 > div {
    display: grid;
    gap: 6px;
  }

  .grid3 input {
    min-width: 0;
  }

  /* Feed & Tasks */
  .fpost {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 72px;
  }

  .fpost:last-child {
    border-bottom: 0;
  }

  .fhead {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
  }

  .fbody {
    margin: 6px 0;
  }

  .fbody a {
    color: var(--ink);
  }

  .tasks {
    margin-top: 8px;
  }

  .tasks li {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .tasks li:last-child {
    border-bottom: 0;
  }

  .tasks .tinfo {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 4px;
  }

  .tasks .reward {
    color: var(--ok);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .tasks .tact {
    flex: none;
  }

  .tasks li.claimed {
    opacity: 0.62;
  }

  .tasks li.ready .tinfo b {
    color: var(--brand);
  }

  .bar {
    height: 7px;
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
    max-width: 280px;
  }

  .bar span {
    display: block;
    height: 100%;
    background: var(--brand-solid);
    border-radius: 999px;
  }

  .tasks li.claimed .bar span,
  .tasks li.ready .bar span {
    background: var(--ok);
  }

  /* Hall Hero & Game Tiles */
  .hello {
    background:
      radial-gradient(28rem 14rem at 100% 0%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 65%),
      var(--card);
  }

  .hello-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
  }

  .hello h1 {
    margin: 0 0 4px;
  }

  .taskpill {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 12px;
    align-items: baseline;
    padding: 10px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
    text-decoration: none;
    color: var(--ink);
    min-height: 44px;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
  }

  .taskpill:hover {
    border-color: color-mix(in oklab, var(--brand) 42%, transparent);
    text-decoration: none;
  }

  .taskpill .tp-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
  }

  .taskpill .tp-num {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    grid-row: span 2;
    align-self: center;
    order: -1;
  }

  .taskpill .tp-sub {
    font-size: 12px;
    color: var(--muted);
  }

  .taskpill.ready {
    border-color: color-mix(in oklab, var(--ok) 45%, transparent);
    background: var(--ok-bg);
  }

  .taskpill.ready .tp-sub {
    color: var(--ok);
    font-weight: 700;
  }

  .intro {
    background:
      radial-gradient(32rem 16rem at 95% 10%, color-mix(in oklab, var(--brand) 14%, transparent), transparent 60%),
      var(--card);
  }

  .intro h1 {
    font-size: 26px;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
  }

  .intro .lead {
    margin: 0 0 14px;
    color: var(--muted);
  }

  .cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
  }

  .cta .btn {
    margin-top: 0;
  }

  .glyph {
    --s: 48px;
    width: var(--s);
    height: var(--s);
    border-radius: 14px;
    background: linear-gradient(145deg, color-mix(in oklab, var(--c, var(--brand)) 88%, #ffffff), var(--c, var(--brand)));
    color: #FFFFFF;
    display: inline-grid;
    place-items: center;
    font-size: calc(var(--s) * 0.48);
    font-weight: 700;
    flex: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    box-shadow: 0 6px 14px -4px color-mix(in oklab, var(--c, var(--brand)) 40%, rgba(15, 23, 42, 0.2));
  }

  .glyph.sm {
    --s: 32px;
    border-radius: 9px;
  }

  .glyph.lg {
    --s: 72px;
    border-radius: 18px;
  }

  .gicon {
    display: block;
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 14px;
    box-shadow: 0 8px 18px -5px color-mix(in oklab, var(--c, var(--brand)) 45%, rgba(15, 23, 42, 0.26));
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .gicon.sm {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.18);
  }

  .gicon.xs {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    box-shadow: none;
  }

  .gicon.lg {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  @supports (corner-shape: squircle) {
    .gicon,
    .glyph {
      corner-shape: squircle;
    }
  }

  .gtile .glyph,
  .gstrip .glyph,
  .gdetail .glyph {
    display: none;
  }

  .gtile .gicon {
    grid-row: span 3;
    align-self: center;
  }

  .ggrid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 12px;
  }

  @media (min-width: 920px) {
    .card[data-module="games"] .ggrid {
      grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
      gap: 14px;
    }
  }

  .gtile {
    position: relative;
  }

  .gtile > a {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    row-gap: 2px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    text-decoration: none;
    color: var(--ink);
    height: 100%;
    min-height: 92px;
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, scale 140ms ease;
  }

  .gtile > a:hover {
    border-color: color-mix(in oklab, var(--c, var(--brand)) 50%, transparent);
    background: var(--card);
    box-shadow: var(--shadow-elevated);
    transform: translateY(-2px);
    text-decoration: none;
  }

  .gtile > a:hover .gicon {
    transform: scale(1.05);
  }

  .gtile .gname {
    font-weight: 700;
    font-size: 15px;
    padding-right: 26px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .gtile .gline {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
  }

  .gtile .gmeta {
    font-size: 12px;
    color: var(--ok);
    font-weight: 600;
    margin-top: 2px;
  }

  .gtile.soon .gicon,
  .gtile.soon .glyph {
    filter: saturate(0.35);
    opacity: 0.78;
  }

  .gtile.soon .gmeta {
    color: var(--muted);
    font-weight: 400;
  }

  .pin {
    position: absolute;
    top: 4px;
    right: 4px;
  }

  .pin button {
    background: none;
    border: 0;
    font-size: 18px;
    line-height: 1;
    color: #F59E0B;
    cursor: pointer;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
  }

  .pin button:hover {
    background: color-mix(in oklab, #F59E0B 14%, transparent);
  }

  .gstrip {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .gstrip a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px 5px 7px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-pill);
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
    min-height: 40px;
    transition: border-color 150ms ease, background-color 150ms ease, scale 140ms ease;
  }

  .gstrip a:hover {
    border-color: color-mix(in oklab, var(--c, var(--brand)) 50%, transparent);
    background: var(--card);
    text-decoration: none;
  }

  .fplay {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
  }

  .fplay li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 34px;
  }

  .gchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 5px;
    border-radius: var(--radius-pill);
    background: color-mix(in oklab, var(--c, var(--brand)) 16%, var(--card));
    border: 1px solid color-mix(in oklab, var(--c, var(--brand)) 36%, transparent);
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
  }

  .gchip:hover {
    border-color: var(--c, var(--brand));
    text-decoration: none;
  }

  .cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
  }

  .cols > * {
    min-width: 0;
  }

  .gdetail {
    display: flex;
    gap: 16px;
    align-items: center;
  }

  .gdetail h1 {
    margin: 0;
  }

  .gdetail p {
    margin: 4px 0 0;
  }

  @media (max-width: 480px) {
    .ggrid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 9px;
    }
    .gtile > a {
      padding: 10px;
      column-gap: 9px;
    }
    .gtile .gicon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
    }
    .gtile .gname {
      font-size: 14px;
      padding-right: 20px;
    }
  }

  /* Notices & Social */
  .notices li.unread .nbody {
    font-weight: 600;
  }

  .notices li.unread::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warn);
    margin-right: 6px;
    vertical-align: middle;
  }

  .online {
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    vertical-align: 1px;
    background: var(--ok-bg);
    color: var(--ok);
  }

  .online.on-m {
    background: color-mix(in oklab, #2563EB 14%, var(--card));
    color: var(--brand);
  }

  .online.on-f {
    background: color-mix(in oklab, #EC4899 14%, var(--card));
    color: color-mix(in oklab, #DB2777 82%, var(--ink));
  }

  /* Rankings */
  .rk-tabs {
    display: grid;
    gap: 8px;
  }

  .rk-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .rk-gname {
    flex: none;
    width: 3em;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }

  .rk-group a {
    padding: 5px 11px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-pill);
    text-decoration: none;
    color: var(--ink);
    font-size: 13px;
    min-height: 28px;
  }

  .rk-group a.on {
    background: var(--brand-solid);
    border-color: transparent;
    color: #FFFFFF;
    font-weight: 600;
  }

  .rk-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .rk-head h1,
  .rk-head h2 {
    margin: 0;
  }

  .rk-head .links {
    align-items: center;
  }

  .seg {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    overflow: hidden;
  }

  .seg a {
    padding: 5px 13px;
    text-decoration: none;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
  }

  .seg a.on {
    background: var(--brand-solid);
    color: #FFFFFF;
    font-weight: 600;
  }

  .rk-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-variant-numeric: tabular-nums;
  }

  .rk-list li {
    display: grid;
    grid-template-columns: 2.4em minmax(0, 1fr) auto 2.8em;
    align-items: center;
    gap: 8px;
    padding: 9px 6px;
    border-bottom: 1px solid var(--line);
  }

  .rk-list li:last-child {
    border-bottom: 0;
  }

  .rk-no {
    text-align: center;
    color: var(--muted);
    font-weight: 700;
  }

  .rk-top .rk-no {
    display: inline-block;
    width: 1.9em;
    height: 1.9em;
    line-height: 1.9em;
    border-radius: 50%;
    color: #FFFFFF;
    justify-self: center;
  }

  .rk-1 .rk-no { background: #B45309; }
  .rk-2 .rk-no { background: #64748B; }
  .rk-3 .rk-no { background: #9A4D24; }

  .rk-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rk-val {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
  }

  .rk-me {
    background: color-mix(in oklab, var(--brand) 10%, transparent);
    border-radius: 10px;
  }

  .rk-mine {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: color-mix(in oklab, var(--brand) 10%, var(--card));
  }

  .rk-mvc { text-align: right; }
  .rk-mv { font-size: 12px; font-weight: 600; white-space: nowrap; margin-left: 4px; }
  .rk-up { color: #DC2626; }
  .rk-down { color: #16A34A; }
  .rk-new { color: var(--brand); }

  /* World Channel & Red Packets */
  .chat-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .chat-form input {
    flex: 1;
    min-width: 0;
  }

  .chat-bar {
    margin: 0 0 6px;
  }

  .chan {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .cl {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
    line-height: 1.6;
  }

  .cl:last-child {
    border-bottom: 0;
  }

  .cl-time,
  .cl-mod {
    white-space: nowrap;
  }

  .cl-body {
    overflow-wrap: anywhere;
  }

  .cl-hb .hb-card {
    margin-top: 6px;
  }

  .cl-me .who {
    font-weight: 700;
  }

  .cl-time {
    margin-left: 4px;
  }

  .cl-mod {
    margin-left: 6px;
  }

  .hb-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    max-width: 290px;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--hb), color-mix(in oklab, var(--hb) 80%, #991B1B));
    color: var(--hb-ink);
    text-decoration: none;
    box-shadow: 0 4px 12px -3px rgba(200, 56, 46, 0.35);
  }

  .hb-card.hb-done {
    background: color-mix(in oklab, var(--hb) 52%, var(--card));
    box-shadow: none;
  }

  .hb-icon {
    flex: none;
    padding: 2px 7px;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
  }

  .hb-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .hb-detail {
    text-align: center;
    background: var(--hb);
    color: var(--hb-ink);
  }

  .hb-detail a,
  .hb-detail .muted {
    color: var(--hb-ink);
    opacity: 0.92;
  }

  .hb-note {
    margin: 8px 0 16px;
    text-wrap: balance;
  }

  .hb-got {
    font-size: 18px;
  }

  .hb-got b {
    font-size: 40px;
    display: block;
    color: var(--hb-gold);
  }

  .hb-open {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    font-size: 30px;
    font-weight: 700;
    background: var(--hb-gold);
    color: var(--hb);
    border: 0;
    cursor: pointer;
  }

  .hb-best {
    background: var(--hb);
    color: var(--hb-ink);
  }

  /* Forum attachments & polls */
  .files {
    display: grid;
    gap: 10px;
    margin: 12px 0;
  }

  .fimg {
    margin: 0;
    min-width: 0;
    max-width: 100%;
  }

  .fimg img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
  }

  .fimg figcaption {
    margin-top: 4px;
  }

  .fatt {
    margin: 0;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .ubb-img {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
  }

  .ubb-img img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 4px 0;
  }

  .rpics {
    margin-top: 8px;
  }

  .rpics .fimg img {
    max-height: 320px;
    width: auto;
  }

  .poll {
    margin: 12px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .poll-head {
    margin: 0 0 8px;
  }

  .poll-res {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: grid;
    gap: 8px;
  }

  .poll-res li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
  }

  .pr-label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .pr-bar {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 999px;
    background: var(--card);
    overflow: hidden;
    order: 3;
  }

  .pr-bar span {
    display: block;
    height: 100%;
    background: var(--brand-solid);
  }

  .poll-res li.mine .pr-bar span {
    background: var(--ok);
  }

  .pr-num {
    color: var(--muted);
    font-size: 13px;
  }

  .poll-form {
    display: grid;
    gap: 6px;
    justify-items: start;
  }

  /* Shop, Vanity, Nobles, Avatars, Albums, Achievements, Seasons */
  .nb {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 5px;
    font-size: 11px;
    line-height: 17px;
    font-weight: 700;
    vertical-align: 1px;
    font-variant-numeric: tabular-nums;
  }

  .nb-v { background: #B7791F; color: #FFFFFF; }
  .nb-l { background: #2B6CB0; color: #FFFFFF; }
  .nb-id { background: transparent; color: #DC2626; border: 1px solid currentColor; }
  .nb-title { background: #FFF4D6; color: #8C5A00; border: 1px solid #E0B44A; font-weight: 600; }

  .shop-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .shop-head h1 {
    margin: 0;
  }

  .dia {
    margin: 0;
    display: grid;
    text-align: right;
  }

  .dia b {
    font-size: 28px;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
  }

  .shop-tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .shop-tiles a {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    text-decoration: none;
    color: var(--ink);
    min-height: 76px;
    transition: border-color 150ms ease, background-color 150ms ease, scale 140ms ease;
  }

  .shop-tiles a:hover {
    border-color: var(--brand);
    background: var(--card);
    text-decoration: none;
  }

  .plist li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
  }

  .plist li:last-child {
    border-bottom: 0;
  }

  .plist li > div {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 180px;
  }

  .plist li > div > .tag {
    justify-self: start;
  }

  .plist .buy {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .plist .buy input:not([type="checkbox"]) {
    max-width: 10em;
  }

  .noble-card {
    margin: 10px 0;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid color-mix(in oklab, #B7791F 45%, var(--line));
    background: var(--surface);
    display: grid;
    gap: 6px;
  }

  .noble-card.lz {
    border-color: color-mix(in oklab, #2B6CB0 45%, var(--line));
  }

  .noble-card p {
    margin: 0;
  }

  .noble-card .pr-bar {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: var(--card);
    overflow: hidden;
  }

  .noble-card .pr-bar span {
    display: block;
    height: 100%;
    background: #B7791F;
  }

  .noble-card.lz .pr-bar span {
    background: #2B6CB0;
  }

  .vlist {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .vlist li {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  .vlist li.muted {
    grid-column: 1 / -1;
  }

  .vrules {
    margin: 8px 0;
    padding-left: 18px;
    line-height: 1.9;
  }

  .vnum {
    font-size: 22px;
    font-weight: 800;
    color: #DC2626;
    letter-spacing: 0.05em;
  }

  .palette-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border: 0;
    padding: 0;
    margin: 0;
  }

  .palette-pick legend {
    margin-bottom: 6px;
  }

  .palette-pick label {
    position: relative;
  }

  .palette-pick input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
  }

  .palette-pick span {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid var(--line);
  }

  .palette-pick input:checked + span {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
  }

  .palette-pick input:focus-visible + span {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
  }

  .swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    vertical-align: -2px;
  }

  /* Guilds & Guardian Tree */
  .emblem {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: color-mix(in oklab, var(--brand) 16%, var(--card));
    color: var(--brand);
    font-weight: 700;
  }

  .emblem.big {
    width: 58px;
    height: 58px;
    font-size: 28px;
    border-radius: 14px;
  }

  .glist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .glist li:last-child {
    border-bottom: 0;
  }

  .glist .rk-no {
    width: 2em;
  }

  .glist .gname {
    display: grid;
    gap: 2px;
    min-width: 0;
    text-decoration: none;
    color: var(--ink);
  }

  .gh-top {
    display: flex;
    gap: 12px;
    align-items: center;
  }

  .gh-top h1 {
    margin: 0;
  }

  .gbar {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
    margin: 10px 0 4px;
  }

  .gbar span {
    display: block;
    height: 100%;
    background: var(--brand-solid);
  }

  .gnotice {
    padding: 10px 12px;
    border-radius: 12px;
    background: color-mix(in oklab, var(--warn) 10%, var(--card));
  }

  .gactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
  }

  .gflag {
    font-weight: 700;
  }

  .guild-head,
  .pethead,
  .tree-card,
  .jh-head {
    background:
      radial-gradient(24rem 10rem at 100% 0%, color-mix(in oklab, var(--brand) 8%, transparent), transparent 65%),
      var(--card);
  }

  .jh-fight,
  .jh-boss {
    border-color: color-mix(in oklab, var(--warn) 26%, var(--line));
  }

  .fslot.busy {
    border-color: color-mix(in oklab, var(--brand) 38%, transparent);
  }

  .guide-box.rush {
    border-left: 4px solid var(--gold);
  }

  .plots.pens {
    grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
  }

  .ulist.recipe-list li {
    gap: 8px 10px;
  }

  .tree-art {
    width: 120px;
    height: 120px;
    flex: none;
  }

  .t-leaf { fill: var(--t-leaf); }
  .t-trunk { stroke: var(--t-trunk); stroke-linecap: round; fill: none; }
  .t-fruit { fill: var(--t-fruit); stroke: color-mix(in oklab, var(--t-fruit) 60%, #000); stroke-width: 1; }
  .t-flower { fill: var(--t-flower); }
  .t-ground { fill: var(--t-ground); }

  .tree-wrap {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
  }

  .tree-info {
    flex: 1 1 180px;
    min-width: 0;
  }

  .tree-stage {
    font-size: 22px;
    font-weight: 750;
    margin: 0 0 4px;
  }

  .tree-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }

  .tree-mini .tree-art {
    width: 56px;
    height: 56px;
  }

  .tree-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
  }

  .tree-link > span {
    display: grid;
    gap: 2px;
  }

  .chance {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
  }

  .chance.hi { color: var(--ok); font-weight: 600; }
  .chance.lo { color: var(--warn); }

  /* Faces */
  img.em {
    vertical-align: -4px;
    max-width: 100%;
    max-height: 80px;
    height: auto;
  }

  .faces {
    margin: 4px 0;
    flex-basis: 100%;
  }

  .faces summary {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    color: var(--brand);
    font-size: 14px;
    font-weight: 500;
  }

  .face-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 3px;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .face {
    display: grid;
    place-items: center;
    min-height: 40px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    background: none;
    cursor: pointer;
  }

  .face:hover,
  .face:focus-visible {
    background: var(--card);
  }

  .face img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }

  .face-table {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px 10px;
  }

  .face-table li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-size: 14px;
  }

  .face-table img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }

  .face-table code {
    font-size: 13px;
  }

  .codes {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 14px;
  }

  .review {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  .review .preview {
    max-height: 240px;
    overflow: auto;
    border: 1px dashed var(--control-border);
    padding: 8px;
    margin: 6px 0;
    border-radius: 8px;
  }

  /* QQ Show & Avatars & Frames */
  .xiu-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 8px;
  }

  .xiu-grid li {
    display: grid;
    justify-items: center;
    gap: 3px;
    text-align: center;
    padding: 8px 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 13px;
  }

  .xiu-worn {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0;
  }

  .xiu-worn img {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FFFFFF;
  }

  .av {
    display: inline-block;
    vertical-align: middle;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
  }

  .av img {
    display: block;
    object-fit: cover;
  }

  .av-s {
    border-radius: 6px;
    margin-right: 4px;
    vertical-align: -5px;
  }

  .av-m {
    border-radius: 8px;
  }

  .av-l {
    border-radius: 12px;
  }

  .af-bronze { box-shadow: 0 0 0 2px #B87333; }
  .af-silver { box-shadow: 0 0 0 2px #9AA0A6, 0 0 0 4px #E5E7EB; }
  .af-gold { box-shadow: 0 0 0 2px #D4A017, 0 0 0 4px #FFF1B8; }
  .af-s-tuohuang { box-shadow: 0 0 0 3px #B35C1E; }
  .af-s-yuanhang { box-shadow: 0 0 0 3px #1C6FB8; }
  .af-s-xiaying { box-shadow: 0 0 0 3px #2F7D4A; }
  .af-s-xinghe { box-shadow: 0 0 0 3px #6B3FB5; }
  .af-card { box-shadow: 0 0 0 2px #8E24AA, 0 0 0 4px #F3D9FA; }
  .af-mentor-jade { box-shadow: 0 0 0 2px #1F7A6E, 0 0 0 4px #C9EFE8; }
  .af-mentor-gold { box-shadow: 0 0 0 2px #C88A04, 0 0 0 4px #FFEBA8; }

  .av-l.af-bronze,
  .av-l.af-silver,
  .av-l.af-gold,
  .av-l[class*="af-s-"],
  .av-l.af-card,
  .av-l.af-mentor-jade,
  .av-l.af-mentor-gold {
    margin: 4px;
  }

  .av-pick {
    list-style: none;
    margin: 8px 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
  }

  .av-btn {
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    line-height: 0;
  }

  .av-btn.on {
    border-color: var(--brand);
  }

  .av-head {
    margin: 0 0 8px;
  }

  .giftpick {
    border: 0;
    padding: 0;
    margin: 8px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
  }

  .giftpick legend {
    padding: 0;
    margin-bottom: 6px;
  }

  .giftpick label {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 8px 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    text-align: center;
    min-width: 0;
    cursor: pointer;
  }

  .giftpick label:has(input:checked) {
    border-color: var(--brand);
    background: var(--ok-bg);
  }

  .giftpick input {
    margin: 0;
  }

  .album-grid {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
  }

  .album-grid li {
    display: grid;
    gap: 3px;
    justify-items: start;
    min-width: 0;
  }

  .album-grid a {
    display: grid;
    gap: 4px;
    width: 100%;
    color: inherit;
  }

  .album-grid img,
  .album-grid .album-empty {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background: var(--surface);
    display: grid;
    place-items: center;
    color: var(--muted);
  }

  .album-grid.photos img {
    height: auto;
  }

  /* Medals & Achievements */
  .medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 3px;
    border-radius: 50%;
    border: 2px solid;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    color: #FFFFFF;
    vertical-align: -4px;
  }

  .medal.t1 { background: #B87333; border-color: #7A4A1E; }
  .medal.t2 { background: #9AA0A6; border-color: #5F6368; }
  .medal.t3 { background: #D4A017; border-color: #8C6A00; }
  .medal.big { width: 44px; height: 44px; margin: 0; font-size: 20px; border-width: 3px; vertical-align: middle; }
  .medal.off { background: var(--surface); border-color: var(--control-border); color: var(--muted); }

  .achs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
  }

  .achs li {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .achs .bar {
    height: 6px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
  }

  .achs .bar i {
    display: block;
    height: 100%;
    background: var(--brand-solid);
  }

  .wall {
    list-style: none;
    margin: 8px 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 10px;
    text-align: center;
    font-size: 12px;
  }

  .wall li {
    display: grid;
    justify-items: center;
    gap: 4px;
  }

  .record {
    list-style: none;
    margin: 6px 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 14px;
  }

  /* Seasonal Chat Bubbles & Handbook */
  .cl.bubble {
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 14px;
    border: 2px solid var(--bub);
    background: color-mix(in oklab, var(--bub) 11%, var(--card));
  }

  .cl.bubble.stuohuang { --bub: #B35C1E; }
  .cl.bubble.syuanhang { --bub: #1C6FB8; }
  .cl.bubble.sxiaying { --bub: #2F7D4A; }
  .cl.bubble.sxinghe { --bub: #6B3FB5; }

  .sbar {
    height: 10px;
    background: var(--surface);
    border-radius: 999px;
    overflow: hidden;
    margin: 6px 0;
  }

  .sbar i {
    display: block;
    height: 100%;
    background: var(--brand-solid);
  }

  .sshop {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
  }

  .sshop li {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .sshop .pic {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface);
    font-weight: 700;
  }

  .jlist > li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .jlist > li:last-child {
    border-bottom: 0;
  }

  .jbody {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
  }

  .jact {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
  }

  .jicon {
    width: 48px;
    height: 48px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #6D4C41;
    color: #FFFFFF;
    font-weight: 700;
  }

  /* Admin fallback styles if an admin page renders under H5 layout */
  .adm-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 12px;
  }

  .adm-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    margin: 0 0 12px;
  }

  .adm-tabs a {
    padding: 8px 14px;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 2px solid transparent;
  }

  .adm-tabs a.on {
    color: var(--brand);
    border-bottom-color: var(--brand);
    font-weight: 600;
  }

  .adm-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
  }

  .adm-note {
    font-size: 13px;
    color: var(--muted);
    margin: 4px 0 0;
  }
}

@layer games {
  /* Farm & Ranch & Workshop */
  .farmhead h1 { margin: 0; }
  .fh-row { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; align-items: baseline; }
  .meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; margin-top: 10px; }
  .meters > div { display: grid; gap: 4px; }
  .meters .bar { max-width: none; }
  .bar.gc span { background: var(--ok); }
  .bar.thin { height: 5px; margin: 4px 0 2px; }
  .sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
  .sec-head h2 { margin: 0; }

  .plots {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
    gap: 10px;
  }

  .plot {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    gap: 5px;
    align-content: start;
    background: linear-gradient(180deg, var(--surface) 50%, color-mix(in oklab, #8D6E63 14%, var(--surface)));
    min-height: 144px;
  }

  .plot.ripe {
    border-color: color-mix(in oklab, var(--ok) 45%, transparent);
    background: var(--ok-bg);
  }

  .plot.empty {
    border-style: dashed;
    border-color: var(--control-border);
    background: var(--surface);
  }

  .pl-top { display: flex; gap: 6px; align-items: center; min-height: 20px; }
  .pl-body { display: flex; gap: 8px; align-items: center; }

  .bug {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--warn-bg);
    color: var(--warn);
  }

  .crop-glyph {
    --s: 36px;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: #16A34A;
    color: #FFFFFF;
    display: inline-grid;
    place-items: center;
    font-weight: 700;
    font-size: calc(var(--s) * 0.5);
    flex: none;
  }

  .crop-glyph.sm { --s: 28px; }
  .crop-glyph.none { background: var(--surface); color: var(--muted); }
  .plot .btn { margin-top: 2px; width: 100%; }
  .clears { display: flex; flex-wrap: wrap; gap: 4px 12px; }

  .seeds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .seed {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    min-height: 52px;
  }

  .seed:has(input:checked) {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 1px var(--brand);
  }

  .seed.locked { opacity: 0.55; cursor: not-allowed; }
  .seed input { margin: 0; }
  .star { color: #F59E0B; }

  .orders,
  .barn {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .orders li {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }

  .orders li:last-child,
  .barn li:last-child { border-bottom: 0; }
  .orders .o-info { flex: 1 1 160px; min-width: 0; }
  .orders .o-act { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
  .orders li.done { opacity: 0.6; }

  .barn li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
  }

  .sellf { margin: 0 0 0 auto; }
  .sellf input.tiny { width: 4.5em; flex: 0 0 4.5em; }
  .barn .sellf { flex-wrap: nowrap; margin-bottom: 0; }
  .ripe-tag { color: var(--ok); }

  .fland {
    position: relative;
    display: inline-block;
    width: 72px;
    height: 72px;
    flex: none;
    border-radius: 12px;
    overflow: hidden;
    background: url(/static/h5/art/farm/soil/0.svg) center / cover no-repeat;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.08);
  }

  .fland.soil1 {
    background-image: url(/static/h5/art/farm/soil/1.svg);
    box-shadow: inset 0 0 0 2px #22C55E;
  }

  .fland.soil2 {
    background-image: url(/static/h5/art/farm/soil/2.svg);
    box-shadow: inset 0 0 0 2px #38BDF8;
  }

  .fland.soil3 {
    background-image: url(/static/h5/art/farm/soil/3.svg);
    box-shadow: inset 0 0 0 2px #C084FC;
  }

  .fland.ripe {
    box-shadow: inset 0 0 0 2px #FACC15;
  }

  .fland .fcrop {
    position: absolute;
    inset: 6px;
    width: 60px;
    height: 60px;
  }

  .fland .fbadges {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 1px;
  }

  .fland .fbadges img {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 50%;
  }

  .crop-pic { width: 28px; height: 28px; flex: none; }
  .crop-pic.sm { width: 20px; height: 20px; vertical-align: middle; }
  .guide-box ol { margin: 6px 0; padding-left: 20px; }
  .guide-box li.done { color: var(--muted); text-decoration: line-through; }

  .dex {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
  }

  .dex li {
    display: grid;
    justify-items: center;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 8px 4px;
    text-align: center;
  }

  .dex .dex-pic { width: 48px; height: 48px; }
  .dex li.unlit .dex-pic { filter: grayscale(1) brightness(0.45); opacity: 0.55; }
  .dqs { display: flex; gap: 2px; }
  .dq { font-size: 11px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line); }
  .dq.off { color: var(--muted); opacity: 0.55; }
  .dq.dq0 { background: var(--surface); }
  .dq.dq1 { background: color-mix(in oklab, #2563EB 14%, var(--card)); color: var(--brand); border-color: color-mix(in oklab, #2563EB 32%, transparent); }
  .dq.dq2 { background: color-mix(in oklab, #F59E0B 18%, var(--card)); color: var(--gold); border-color: color-mix(in oklab, #F59E0B 40%, transparent); font-weight: 700; }

  .pen {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: color-mix(in oklab, #D97706 16%, var(--surface));
    flex: none;
  }

  .pen .pen-pic { position: absolute; inset: 4px; width: 56px; height: 56px; }
  .pen .pen-pic.young { inset: 16px; width: 32px; height: 32px; }
  .pen .pen-bug { position: absolute; top: 0; right: 0; width: 24px; height: 24px; }

  .jobs {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 8px;
  }

  .jobs li {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 8px;
    display: grid;
    gap: 3px;
    justify-items: start;
  }

  .jobs li.done { border-color: color-mix(in oklab, var(--ok) 45%, transparent); background: var(--ok-bg); }
  .jobs li.free { border-style: dashed; border-color: var(--control-border); }

  .recipes,
  .animals {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
  }

  .recipes li,
  .animals li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border-top: 1px dashed var(--line);
    padding-top: 6px;
  }

  .machine.locked { opacity: 0.6; }
  .farm-nav a { white-space: nowrap; }
  .decor-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; min-height: 8px; }
  .decor-row img { width: 40px; height: 40px; }

  .decor-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  .decor-list li {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 8px 4px;
    display: grid;
    justify-items: center;
    gap: 3px;
    text-align: center;
  }

  .decor-list li.worn { border-color: var(--ok); background: var(--ok-bg); }
  .decor-list li.locked img { filter: grayscale(1); opacity: 0.5; }
  .decor-list img { width: 48px; height: 48px; }
  .rank-list li.me { background: var(--ok-bg); border-radius: 10px; padding-inline: 8px; }
  .ratbox img, .scorebox img { vertical-align: middle; }
  .dex.mini { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
  .dex.mini li { padding: 4px 2px; gap: 0; border-radius: 8px; }
  .dex.mini .dex-pic { width: 36px; height: 36px; }

  /* Car */
  .cars { list-style: none; margin: 0; padding: 0; }
  .cars li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .cars li:last-child { border-bottom: 0; }
  .cars .c-info { flex: 1 1 160px; min-width: 0; }
  .lot { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 8px; }
  .lot li { border: 1px dashed var(--control-border); border-radius: 12px; background: var(--surface); padding: 10px; display: grid; gap: 6px; align-content: start; min-height: 112px; }
  .lot li.taken { border-style: solid; border-color: var(--line); }
  .lot li .btn { margin-top: 0; width: 100%; }
  .car-pic { width: 60px; height: 36px; flex: none; }
  .car-big { width: 100px; height: 60px; }

  /* Garden */
  .bar.rep span { background: #9333EA; }
  .crossf { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .crossf .select { flex: 1 1 120px; min-width: 0; }
  .crossf .btn { margin-top: 0; }
  .tag.r0 { background: var(--surface); color: var(--ink); }
  .tag.r1 { background: color-mix(in oklab, #2563EB 16%, var(--card)); color: var(--brand); }
  .tag.r2 { background: color-mix(in oklab, #9333EA 16%, var(--card)); color: color-mix(in oklab, #9333EA 82%, var(--ink)); }
  .tag.r3 { background: color-mix(in oklab, #EA580C 16%, var(--card)); color: color-mix(in oklab, #EA580C 82%, var(--ink)); }
  .tag.r4 { background: color-mix(in oklab, #D97706 18%, var(--card)); color: var(--gold); font-weight: 700; }

  .atlas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
  .atlas li { display: flex; gap: 10px; align-items: flex-start; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .atlas li > div { min-width: 0; }
  .atlas li.dark { opacity: 0.7; }

  /* Arena */
  .schools { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
  .school-card { display: grid; justify-items: center; gap: 6px; padding: 14px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: center; }
  .school-card .btn { margin-top: 4px; }
  .bar.hp span { background: #DC2626; }
  .opps { list-style: none; margin: 0; padding: 0; }
  .opps li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .opps li:last-child { border-bottom: 0; }
  .opps .o-info { flex: 1 1 160px; min-width: 0; }
  .fight-result { font-size: 22px; font-weight: 800; margin: 4px 0; }
  .fight-result.win { color: var(--ok); }
  .fight-result.lose { color: var(--warn); }
  .fightlog td:nth-child(n+4) { font-variant-numeric: tabular-nums; text-align: right; }

  /* Pet */
  .pet-hero { display: flex; gap: 14px; align-items: center; }
  .pet-hero h1 { margin: 0; }
  .pet-hero p { margin: 4px 0 0; }
  .bar.mood span { background: #EC4899; }
  .pet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
  .pet-actions .btn { margin-top: 0; }
  .skills { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
  .skills li { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); opacity: 0.68; }
  .skills li.learned { opacity: 1; border-color: color-mix(in oklab, var(--ok) 45%, transparent); background: var(--ok-bg); }
  .pet-big { width: 96px; height: 96px; flex: none; }
  .pet-mid { width: 48px; height: 48px; flex: none; vertical-align: middle; }
  .statrow { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.9em; }
  .battle-log { margin: 6px 0 0; padding-left: 1.4em; font-size: 0.85em; color: var(--muted); }

  /* Wheel & Checkin */
  .wheel { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .wheel li { display: grid; justify-items: center; gap: 3px; padding: 12px 4px; border-radius: 12px; background: var(--surface); border: 2px solid transparent; }
  .wheel li b { font-size: 19px; font-variant-numeric: tabular-nums; }
  .wheel li.hit { border-color: var(--ok); background: var(--ok-bg); }
  .wheel li img.pix { display: block; margin: 0 auto; }
  .wheel li b.small { font-size: 12px; text-align: center; line-height: 1.3; }
  .streak { font-size: 16px; margin: 4px 0 10px; }
  .milestones { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
  .milestones li { display: grid; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .milestones li.done { border-color: color-mix(in oklab, var(--ok) 45%, transparent); background: var(--ok-bg); }

  .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
  .cal-h { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
  .cal-d { min-height: 54px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 4px; display: grid; align-content: space-between; justify-items: center; font-size: 13px; }
  .cal-d .num { font-variant-numeric: tabular-nums; color: var(--muted); }
  .cal-d.signed { background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 45%, transparent); }
  .cal-d.signed .mark { color: var(--ok); font-weight: 700; }
  .cal-d.makeup .mark { color: var(--muted); }
  .cal-d.today { box-shadow: inset 0 0 0 2px var(--brand); }
  .cal-d.future { opacity: 0.45; }
  .cal-d .link { font-size: 12px; }
  .cal-d img.stamp { display: block; margin: 2px auto 0; }
  .cal-d img.stamp.mk { opacity: 0.6; }

  .badge-grid { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .badge-grid li { text-align: center; display: grid; justify-items: center; gap: 3px; }
  .badge-grid li.empty img { filter: grayscale(1); opacity: 0.35; }

  /* ZTYX */
  .rules { margin: 6px 0; }
  .lineup { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
  .lane { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px; margin: 0; display: grid; gap: 6px; }
  .lane legend { font-weight: 700; padding: 0 6px; }
  .opts { display: flex; flex-wrap: wrap; gap: 5px; }
  .opt { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); min-height: 36px; cursor: pointer; color: var(--ink); margin: 0; font-size: 13px; }
  .opt:has(input:checked) { border-color: var(--brand); background: color-mix(in oklab, var(--brand) 14%, var(--card)); font-weight: 600; }
  .opt input { margin: 0; }
  .lane-win { font-weight: 700; color: var(--ok); }

  /* Mini games */
  .mini-hub { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
  .mini-hub a { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); transition: border-color 150ms ease, background-color 150ms ease, scale 140ms ease; }
  .mini-hub a:hover { border-color: color-mix(in oklab, var(--brand) 42%, transparent); background: var(--card); text-decoration: none; }
  .mini-hub a > span:last-child { display: grid; gap: 2px; min-width: 0; }
  .mini-vars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  .mini-vars li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
  .mini-best { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }

  /* Cards (集卡炼卡馆) */
  .furnace-grid { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
  .fslot { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; gap: 6px; min-width: 0; }
  .fslot.ready { border-color: var(--ok); background: var(--ok-bg); }
  .fslot.locked { opacity: 0.65; border-style: dashed; border-color: var(--control-border); }
  .fslot-body { display: flex; gap: 8px; align-items: center; min-width: 0; }
  .fslot-body > div { min-width: 0; overflow-wrap: anywhere; }
  .cards-form { display: grid; gap: 8px; margin: 8px 0 12px; }
  .cards-pick3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; }
  .pcard-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .pcard-grid.album { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); }
  .pcard { display: grid; justify-items: center; align-content: start; gap: 3px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: center; min-width: 0; }
  .pcard.t1 { border-color: #B87333; }
  .pcard.t2 { border-color: #3B82F6; }
  .pcard.t3 { border-color: #D97706; }

  .pcard.foil {
    position: relative;
    overflow: hidden;
    border-width: 2px;
    border-color: #D4A017;
    background: linear-gradient(155deg, rgba(255, 244, 184, 0.46), var(--surface) 52%, rgba(255, 214, 92, 0.34));
    box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.55), 0 3px 12px rgba(212, 160, 23, 0.26);
  }

  .pcard.foil::before {
    content: "✦";
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 11px;
    line-height: 1;
    color: #C98A00;
    pointer-events: none;
  }

  .pcard.foil::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 250, 210, 0.55) 48%, transparent 66%);
    transform: translateX(-120%);
    animation: foil-glint 3.6s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes foil-glint {
    0%, 60% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
  }

  @media (prefers-reduced-motion: reduce) {
    .pcard.foil::after { animation: none; opacity: 0; }
  }

  .pcard.unlit { opacity: 0.55; }
  .pcard.unlit img { filter: grayscale(1); opacity: 0.45; }
  .foil-tag { background: #FFF0AD; color: #7A4B00; border: 1px solid #D4A017; font-weight: 600; }
  .fslot.foil { border-color: #D4A017; box-shadow: inset 0 0 0 1px rgba(212, 160, 23, 0.4); }

  .card-wall { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .card-wall .pcard { min-width: 0; overflow: hidden; padding: 6px 4px; }
  .card-wall .pcard b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card-wall .pcard img { max-width: 100%; height: auto; }
  .card-wall-act { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; margin-top: 2px; width: 100%; }
  .card-wall-act select { font-size: 12px; padding: 2px 4px; min-height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); max-width: 100%; }
  .card-wall-act .btn.small { padding: 2px 6px; min-height: 26px; font-size: 12px; margin-top: 0; }

  .trade-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
  .card-lore { font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
  .ctier-1 { background: #F3E0CD; color: #6E3D14; }
  .ctier-2 { background: #DCEEFF; color: #194B82; }
  .ctier-3 { background: #FFF2BE; color: #7A5200; font-weight: 600; }
  .set-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
  .set-head p { margin: 2px 0 0; }
  .recipe-info { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
  .ok-txt { color: var(--ok); font-weight: 600; }

  /* Jianghu, Duobao, Chuanqi, ZHSH RPG systems */
  .jh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
  .jh-top h1 { margin: 0; }
  .jh-nav { display: flex; flex-wrap: wrap; gap: 6px 12px; }
  .jh-nav a { white-space: nowrap; }
  .jh-say { margin: 8px 0; padding: 10px 12px; border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0; background: var(--surface); }
  .jh-scene { font-style: italic; }
  .jh-bars { display: grid; gap: 4px; margin: 8px 0; }
  .jh-bars p { margin: 4px 0 0; }
  .jh-bars .pr-bar { order: 0; }
  .jh-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .hpbar { display: block; height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
  .hpbar span { display: block; height: 100%; }
  .hpbar.me span { background: var(--ok); }
  .hpbar.mon span { background: #DC2626; }
  .hpbar.qi span { background: var(--brand-solid); }
  .hpbar.mp > span { background: #38BDF8; }
  .jh-exits { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
  .jh-enc { border-left: 4px solid var(--warn); }
  .jh-choices { display: grid; gap: 8px; margin-top: 10px; }
  .jh-choice-btn { width: 100%; text-align: left; justify-content: flex-start; white-space: normal; height: auto; padding: 10px 14px; }
  .jh-arts-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
  .jh-news { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 5px; }
  .jh-news li { font-size: 14px; line-height: 1.5; }
  .jh-loc-desc { margin: 6px 0; line-height: 1.65; }
  .jh-flog { margin: 8px 0; padding: 9px 12px; border-radius: 10px; background: var(--surface); font-size: 14px; line-height: 1.55; }
  .jh-karma-pos { color: var(--ok); font-weight: 600; }
  .jh-karma-neg { color: var(--warn); font-weight: 600; }
  .jh-boxes { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
  .jh-box { width: 74px; height: 74px; font-size: 24px; border-radius: 14px; background: #9A6A1E; color: #FFF1D6; border: 0; }
  .jh-log { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 3px; }
  .jh-log li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
  .jh-log li:nth-child(even) { background: var(--surface); }
  .jh-log .jh-crit span:first-child, .jh-log .jh-skill span:first-child { color: var(--warn); font-weight: 600; }
  .jh-log .num { white-space: nowrap; }
  .jh-shophead { border-bottom: 0; padding-top: 12px; }
  .jh-float { padding: 12px; border-radius: 12px; background: var(--surface); }
  .jh-float.f4 { color: var(--warn); font-weight: 600; }
  .jh-num { width: 6.5em; font: inherit; padding: 6px 8px; border: 1px solid var(--control-border); border-radius: 9px; background: var(--surface); color: var(--ink); min-height: 36px; }
  .jh-bosshead { display: flex; gap: 12px; align-items: center; }
  .jh-bosshead > div { flex: 1; min-width: 0; }
  .jh-bosshead h2 { margin: 0 0 4px; }
  .jh-stars { color: var(--warn); letter-spacing: 2px; white-space: nowrap; }
  .jh-sockets form.buy { display: flex; gap: 4px; flex-wrap: wrap; }

  /* Duobao */
  .db-room { display: flex; gap: 12px; align-items: flex-start; }
  .db-room > div { flex: 1; min-width: 0; }
  .db-room h2 { margin: 0 0 4px; }
  .db-exits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .db-grid { display: grid; gap: 5px; margin-top: 8px; }
  .db-grid .db-cell { font-size: 12px; text-align: center; padding: 7px 3px; border-radius: 8px; background: var(--surface); color: var(--muted); overflow-wrap: anywhere; }
  .db-grid .db-cell.seen { color: var(--ink); }
  .db-grid .db-cell.here { background: var(--ok-bg); color: var(--ink); font-weight: 700; outline: 2px solid var(--ok); }
  .db-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 8px 0; }
  .db-bars p { margin: 0 0 3px; }
  .db-bars .pr-bar { display: block; }

  /* ZHSH 4.0 */
  .zh-ev { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--control-border); }
  .zh-ev.storm, .zh-ev.pirates { border-color: var(--warn); }
  .zh-ev.flotsam { border-color: var(--ok); }
  .zh-far summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; color: var(--muted); }
  .zh-farport { display: inline-block; margin: 2px 10px 2px 0; }
  .zh-intro-art { display: block; width: 100%; max-width: 320px; height: auto; aspect-ratio: 16 / 10; margin: 8px auto; border-radius: 14px; border: 1px solid var(--line); }
  .zh-vitals { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 9px 12px; margin: 8px 0; border-radius: 12px; background: var(--surface); font-size: 13px; max-width: 100%; }
  .zh-dpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 340px; width: 100%; margin: 10px auto; }
  .zh-dpad-cell { display: grid; place-items: center; min-width: 0; }
  .zh-dpad-cell form { width: 100%; margin: 0; }
  .zh-dpad-btn { width: 100%; min-height: 44px; padding: 6px 4px; margin: 0; text-align: center; line-height: 1.25; font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  .zh-dpad-here { width: 100%; min-height: 44px; display: grid; place-items: center; text-align: center; padding: 4px; border: 2px solid var(--brand); border-radius: 10px; background: color-mix(in oklab, var(--brand) 10%, var(--card)); font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
  .zh-fastgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; max-width: 100%; }
  .zh-fastgrid form { margin: 0; min-width: 0; }
  .zh-fastgrid .btn { width: 100%; margin: 0; padding: 6px 4px; min-height: 36px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .zh-npc { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 8px; background: var(--surface); min-width: 0; max-width: 100%; }
  .zh-npc h3 { margin: 0 0 4px; font-size: 15px; }
  .zh-npc-say { margin: 4px 0 8px; padding-left: 8px; border-left: 3px solid var(--brand); font-size: 13px; overflow-wrap: anywhere; }
  .zh-dur-bar { display: inline-block; width: 72px; max-width: 100%; height: 6px; border-radius: 999px; background: var(--card); overflow: hidden; vertical-align: middle; }
  .zh-dur-bar span { display: block; height: 100%; background: var(--ok); }
  .zh-dur-bar.low span { background: var(--warn); }
  .zh-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; max-width: 100%; }
  .zh-slot { border: 1px solid var(--line); border-radius: 12px; padding: 9px; display: grid; gap: 4px; align-content: start; min-width: 0; background: var(--surface); }
  .zh-slot.empty { border-style: dashed; border-color: var(--control-border); opacity: 0.75; }
  .zh-fight-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
  .zh-fight-head > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .zh-mon-art { width: 56px; height: 56px; flex: none; }
  .zh-cap-art { width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
  .zh-ico { width: 28px; height: 28px; flex: none; vertical-align: middle; }
  .zh-item-row { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
  .zh-item-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .zh-banner { border: 1px solid var(--brand); background: color-mix(in oklab, var(--brand) 9%, var(--card)); }
  .zh-banner-warn { border: 1px solid var(--warn); background: var(--warn-bg); }
  .zh-arrive { border-left: 4px solid var(--ok); }

  @media (max-width: 420px) {
    .zh-slots { grid-template-columns: 1fr; }
  }
}

@layer utilities {
  .sr,
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nowrap {
    white-space: nowrap;
  }
}

@media (forced-colors: active) {
  .card,
  .gtile > a,
  .btn.ghost,
  .h5-dock,
  .top.h5-top,
  .h5-side-card {
    border: 1px solid CanvasText;
  }

  .h5-dock a[aria-current="page"],
  .h5-side-nav a[aria-current="page"],
  .tabs a.current,
  .chips a.current {
    outline: 2px solid Highlight;
    forced-color-adjust: auto;
  }

  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid Highlight;
  }
}
