/* ==========================================================================
   MahjongKit — styles.css
   Material Design 3 (Expressive) tokens and components, written in plain CSS.
   One file for the whole site. No framework, no build step.

   To re-theme: change the color roles in section 1. Everything else uses
   those variables. Never type a hex color in a page.

   1. Color roles (light + dark)          7. Homepage
   2. Shape, type, motion, spacing         8. Article template + components
   3. Base and typography                  9. Section pages, search, 404
   4. Top app bar, navigation bar,        10. Flower Match game
      navigation drawer, footer           11. Motion, print
   5. Buttons, chips, cards, lists
   6. Tile motif
   ========================================================================== */


/* 1. COLOR ROLES ----------------------------------------------------------
   Pure white canvas, bubblegum pink primary, powder blue secondary, soft
   lilac tertiary. All pairings meet WCAG AA for normal text.               */
:root {
  --md-sys-color-background: #FFFFFF;
  --md-sys-color-on-background: #211A1E;

  --md-sys-color-primary: #C13B7A;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #FFD9E8;
  --md-sys-color-on-primary-container: #3E0A25;

  --md-sys-color-secondary: #4C6D91;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #D8ECFF;
  --md-sys-color-on-secondary-container: #17324A;

  --md-sys-color-tertiary: #6B5D91;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #EEE5FF;
  --md-sys-color-on-tertiary-container: #26183F;

  --md-sys-color-error: #BA1A1A;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #FFDAD6;
  --md-sys-color-on-error-container: #410002;

  --md-sys-color-surface: #FFFFFF;
  --md-sys-color-surface-dim: #E4DEE1;
  --md-sys-color-surface-bright: #FFFFFF;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #FBF8FA;
  --md-sys-color-surface-container: #F6F2F5;
  --md-sys-color-surface-container-high: #F0EAEE;
  --md-sys-color-surface-container-highest: #EAE3E8;

  --md-sys-color-on-surface: #211A1E;
  --md-sys-color-on-surface-variant: #62595F;
  --md-sys-color-outline: #81777E;
  --md-sys-color-outline-variant: #DDD3D9;

  --md-sys-color-inverse-surface: #362F33;
  --md-sys-color-inverse-on-surface: #FBEEF3;
  --md-sys-color-scrim: rgba(33, 26, 30, .32);

  /* Brand tints used by the tiles, the search field and the game board */
  --mc-blue-tint: #F3F9FF;
  --mc-pink-tint: #FFF4F8;
  --mc-blue-halo: #B9DFFF;
  --mc-pink-halo: #F29BC0;
  --mc-tile-face: #FFFDFC;
  --mc-tile-edge: #EEE5E9;
  --mc-tile-bottom: #F0A1C2;
  --mc-focus: #C13B7A;
  --mc-shadow-ink: 55, 35, 48;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-sys-color-background: #16121A;
    --md-sys-color-on-background: #ECE0E6;

    --md-sys-color-primary: #FFB0CF;
    --md-sys-color-on-primary: #5E1138;
    --md-sys-color-primary-container: #7C2B56;
    --md-sys-color-on-primary-container: #FFD9E8;

    --md-sys-color-secondary: #B4CBE8;
    --md-sys-color-on-secondary: #1E3448;
    --md-sys-color-secondary-container: #35506A;
    --md-sys-color-on-secondary-container: #D8ECFF;

    --md-sys-color-tertiary: #D3C4F5;
    --md-sys-color-on-tertiary: #382D55;
    --md-sys-color-tertiary-container: #4E4272;
    --md-sys-color-on-tertiary-container: #EEE5FF;

    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;

    --md-sys-color-surface: #16121A;
    --md-sys-color-surface-dim: #16121A;
    --md-sys-color-surface-bright: #3D3640;
    --md-sys-color-surface-container-lowest: #110D14;
    --md-sys-color-surface-container-low: #1E1A22;
    --md-sys-color-surface-container: #231E27;
    --md-sys-color-surface-container-high: #2D2831;
    --md-sys-color-surface-container-highest: #38333C;

    --md-sys-color-on-surface: #ECE0E6;
    --md-sys-color-on-surface-variant: #CFC3CA;
    --md-sys-color-outline: #988C94;
    --md-sys-color-outline-variant: #4D434A;

    --md-sys-color-inverse-surface: #ECE0E6;
    --md-sys-color-inverse-on-surface: #362F33;
    --md-sys-color-scrim: rgba(0, 0, 0, .55);

    --mc-blue-tint: #1D2632;
    --mc-pink-tint: #2A1E25;
    --mc-blue-halo: #6FA3D6;
    --mc-pink-halo: #E07CA7;
    --mc-tile-face: #F7F1F4;
    --mc-tile-edge: #D9CDD3;
    --mc-tile-bottom: #C97A9E;
    --mc-focus: #FFB0CF;
    --mc-shadow-ink: 0, 0, 0;
  }
}


/* 2. SHAPE, TYPE, MOTION, SPACING ------------------------------------------ */
:root {
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-large-increased: 20px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-extra-extra-large: 36px;
  --md-sys-shape-corner-full: 9999px;

  --md-sys-typescale-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 300ms;
  --md-sys-motion-duration-long: 450ms;
  --md-sys-motion-easing-standard: cubic-bezier(.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(.3, 0, 0, 1);
  --md-sys-motion-spring: cubic-bezier(.34, 1.3, .64, 1);

  --md-sys-elevation-1: 0 1px 2px rgba(var(--mc-shadow-ink), .12), 0 1px 3px 1px rgba(var(--mc-shadow-ink), .06);
  --md-sys-elevation-2: 0 1px 2px rgba(var(--mc-shadow-ink), .14), 0 2px 6px 2px rgba(var(--mc-shadow-ink), .08);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(var(--mc-shadow-ink), .10), 0 1px 3px rgba(var(--mc-shadow-ink), .16);

  --mc-page-gutter: 20px;
  --mc-content-max: 1120px;
  --mc-measure: 740px;
  --mc-nav-bar-height: 80px;
  --mc-top-bar-height: 64px;
}
@media (min-width: 600px) { :root { --mc-page-gutter: 28px; } }
@media (min-width: 840px) { :root { --mc-page-gutter: 40px; } }


/* 3. BASE AND TYPOGRAPHY --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--md-sys-typescale-font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
  background: var(--md-sys-color-surface);
}
@media (min-width: 840px) { html { font-size: 18px; } }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  overflow-x: hidden;
  padding-bottom: calc(var(--mc-nav-bar-height) + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 840px) { body { padding-bottom: 0; } }

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

a { color: var(--md-sys-color-primary); text-decoration-thickness: 1px; text-underline-offset: .16em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--mc-focus);
  outline-offset: 3px;
  border-radius: var(--md-sys-shape-corner-small);
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--md-sys-color-on-surface);
  margin: 0;
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(1.9rem, 4.6vw, 2.35rem); line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.45rem, 3.4vw, 1.7rem); }
h3 { font-size: 1.18rem; }

/* Material 3 type scale (tuned for reading on phones) */
.display-large, .display-lg { font-size: clamp(2.45rem, 7vw, 3.6rem); line-height: 1.06; letter-spacing: -0.03em; font-weight: 800; }
.display-medium, .display-md { font-size: clamp(2.1rem, 5.4vw, 2.9rem); line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; }
.headline-large, .headline-lg { font-size: clamp(1.9rem, 4.6vw, 2.35rem); line-height: 1.15; letter-spacing: -0.02em; }
.headline-medium, .headline-md { font-size: clamp(1.55rem, 3.8vw, 1.85rem); line-height: 1.2; letter-spacing: -0.015em; }
.headline-small, .headline-sm { font-size: clamp(1.3rem, 3vw, 1.5rem); line-height: 1.25; }
.title-large, .title-lg { font-size: 1.28rem; line-height: 1.3; font-weight: 700; }
.title-medium, .title-md { font-size: 1.05rem; line-height: 1.4; font-weight: 700; }
.body-large, .body-lg { font-size: 1.08rem; line-height: 1.6; }
.body-medium, .body-md { font-size: .95rem; line-height: 1.55; }
.label-large  { font-size: .92rem; line-height: 1.3; font-weight: 600; letter-spacing: .01em; }

p { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.35em; }
li { margin-bottom: .45em; }
li > ul, li > ol { margin-top: .45em; margin-bottom: 0; }
strong { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--md-sys-color-outline-variant); margin: 2rem 0; }
small { font-size: .88rem; }
mark { background: var(--md-sys-color-secondary-container); color: inherit; border-radius: 3px; padding: 0 2px; }
kbd, code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }

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

.skip-link {
  position: absolute; left: 12px; top: -80px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-full);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--mc-content-max);
  margin-inline: auto;
  padding-inline: var(--mc-page-gutter) !important;
}

.js-only { display: none; }
.js .js-only { display: inline-flex; }


/* 4. TOP APP BAR, NAVIGATION BAR, DRAWER, FOOTER --------------------------- */
.top-app-bar, .top-bar { position: sticky; top: 0; z-index: 30; background: var(--md-sys-color-surface); }
.top-app-bar__inner, .top-bar__inner {
  padding-inline: var(--mc-page-gutter);
  max-width: var(--mc-content-max);
  margin-inline: auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--mc-top-bar-height);
  padding-block: 8px;
}
.logo, .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
  min-height: 48px;
  margin-right: auto;
  white-space: nowrap;
}
.logo:hover, .brand:hover { text-decoration: none; }
.logo__mark, .brand__mark { width: 34px; height: 34px; flex: none; }
.logo b, .brand b { color: var(--md-sys-color-primary); font-weight: 800; }

/* Horizontal navigation (desktop, inside the app bar) */
.top-nav { display: none; }
@media (min-width: 840px) {
  .top-nav { display: flex; gap: 2px; }
  .top-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
  .top-nav li { margin: 0; }
  .top-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
    font-size: .97rem;
    text-decoration: none;
    transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard), color var(--md-sys-motion-duration-short);
  }
  .top-nav a:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }
  .top-nav a[aria-current="page"], .top-nav a.is-active {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
  }
}
@media (min-width: 840px) and (max-width: 1000px) { .top-nav a { padding-inline: 12px; font-size: .92rem; } }

/* Search bar in the app bar (desktop) */
.app-search, .search-form {
  display: none;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 8px 0 16px;
  width: 230px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  margin-left: 6px;
}
.app-search:focus-within { background: var(--md-sys-color-surface); box-shadow: 0 0 0 2px var(--md-sys-color-secondary) inset; }
.app-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .95rem;
  color: var(--md-sys-color-on-surface);
  outline: none;
}
.app-search input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.app-search input::-webkit-search-decoration, .app-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.app-search .md-icon { flex: none; width: 22px; height: 22px; }
@media (min-width: 840px) { .app-search { display: flex; } }
@media (min-width: 1100px) { .app-search { width: 280px; } }

.search-link { display: inline-flex; }
.menu-btn { display: inline-flex; }
@media (min-width: 840px) { .search-link, .menu-btn { display: none !important; } }

.md-icon { width: 24px; height: 24px; flex: none; }

/* Icon button (48px touch target) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--md-sys-motion-duration-short);
}
.icon-btn:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }

/* Bottom navigation bar (phones and tablets) */
.nav-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: var(--md-sys-color-surface);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -1px 0 var(--md-sys-color-outline-variant);
}
.nav-bar ul {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: var(--mc-nav-bar-height);
}
.nav-bar li { margin: 0; }
.nav-bar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  padding: 10px 2px 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-bar__ind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 32px;
  border-radius: var(--md-sys-shape-corner-full);
  transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring);
}
.nav-bar a:hover .nav-bar__ind { background: var(--md-sys-color-surface-container-highest); }
.nav-bar a[aria-current="page"], .nav-bar a.is-active { color: var(--md-sys-color-on-surface); }
.nav-bar a[aria-current="page"] .nav-bar__ind, .nav-bar a.is-active .nav-bar__ind {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.nav-bar a:active .nav-bar__ind { transform: scale(.94); }
@media (min-width: 840px) { .nav-bar { display: none; } }

/* Modal navigation drawer (<dialog>) */
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  margin: 0;
  width: min(360px, 88vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0 0 24px;
  border: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border-radius: 0 var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0;
  box-shadow: var(--md-sys-elevation-3);
  overflow: auto;
}
.drawer[open] { animation: drawer-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized); }
@keyframes drawer-in { from { transform: translateX(-32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer::backdrop { background: var(--md-sys-color-scrim); }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 8px 4px 20px;
}
.drawer__head .logo, .drawer__head .brand { margin-right: 0; }
.drawer__section {
  font-size: .82rem; font-weight: 700; letter-spacing: .02em;
  color: var(--md-sys-color-on-surface-variant);
  padding: 12px 28px 4px;
  margin: 0;
}
.drawer__list { list-style: none; margin: 0; padding: 4px 12px; }
.drawer__list li { margin: 0; }
.drawer__list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 600;
  text-decoration: none;
}
.drawer__list a small { margin-left: auto; font-weight: 500; color: var(--md-sys-color-on-surface-variant); }
.drawer__list a:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }
.drawer__list a[aria-current="page"], .drawer__list a.is-active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.drawer__list a .md-icon { width: 22px; height: 22px; }
.drawer hr { margin: 8px 24px; }

/* Footer */
.footer {
  margin-top: 64px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  padding: 40px 0 32px;
}
.footer__inner {
  display: grid;
  gap: 32px 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 840px) { .footer__inner { grid-template-columns: 1.1fr 3fr; } }
.footer__brand .logo, .footer__brand .brand { margin-right: 0; margin-bottom: 8px; }
.footer__brand p { max-width: 28ch; font-size: .95rem; }
.footer__cols { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (min-width: 600px) { .footer__cols { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .footer__cols { grid-template-columns: repeat(5, 1fr); } }
.footer h2 { font-size: .95rem; font-weight: 700; color: var(--md-sys-color-on-surface); margin-bottom: 8px; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0; }
.footer li a {
  display: inline-block;
  padding: 7px 0;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: .95rem;
}
.footer li a:hover { color: var(--md-sys-color-primary); text-decoration: underline; }
.footer__legal {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: .88rem;
}
.footer__legal p { margin-bottom: .5em; max-width: 78ch; }


/* 5. BUTTONS, CHIPS, CARDS, LISTS ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .005em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard),
              box-shadow var(--md-sys-motion-duration-short),
              border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring),
              transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring);
}
.btn:hover { text-decoration: none; }
.btn:active { border-radius: var(--md-sys-shape-corner-medium); transform: scale(.98); }
.btn .md-icon { width: 20px; height: 20px; }
.btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn--filled:hover { box-shadow: var(--md-sys-elevation-1); }
.btn--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn--tonal:hover { box-shadow: var(--md-sys-elevation-1); }
.btn--pink { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.btn--pink:hover { box-shadow: var(--md-sys-elevation-1); }
.btn--outlined { background: var(--md-sys-color-surface); color: var(--md-sys-color-secondary); box-shadow: inset 0 0 0 1px #B9D6EE; }
.btn--outlined:hover { background: var(--mc-blue-tint); }
.btn--text { background: transparent; color: var(--md-sys-color-primary); padding-inline: 14px; }
.btn--text:hover { background: var(--md-sys-color-surface-container-high); }
.btn--large, .btn--lg { min-height: 56px; padding-inline: 30px; font-size: 1.06rem; }
.btn--sm { min-height: 40px; padding-inline: 18px; font-size: .92rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--md-sys-motion-duration-short);
}
.chip:hover { background: var(--md-sys-color-surface-container-high); text-decoration: none; }
.chip--tonal { box-shadow: none; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.chip--pink { box-shadow: none; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.chip .md-icon { width: 18px; height: 18px; }
.chip-set { display: flex; flex-wrap: wrap; gap: 10px; }

/* Category label (small chip, not interactive) */
.cat {
  display: inline-flex; align-items: center;
  min-height: 30px; padding: 2px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: .82rem; font-weight: 700; letter-spacing: .01em;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.cat--gear, .cat--community { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.cat--play { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

/* Cards */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}
.card--outlined { background: var(--md-sys-color-surface); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.card--pink { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); box-shadow: none; }
.card--blue { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); box-shadow: none; }
.card--lilac { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); box-shadow: none; }
.card--soft { background: var(--md-sys-color-surface-container-low); box-shadow: none; }
a.card { transition: box-shadow var(--md-sys-motion-duration-short), transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring); }
a.card:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant), var(--md-sys-elevation-1); }
a.card--pink:hover, a.card--blue:hover, a.card--lilac:hover, a.card--soft:hover { box-shadow: var(--md-sys-elevation-1); }
a.card:active { transform: scale(.985); }
.card__title { font-size: 1.15rem; line-height: 1.3; font-weight: 700; }
.card h2, .card h3 { font-size: 1.15rem; line-height: 1.3; }
.card p, .card__desc { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: .97rem; }
.card--pink p, .card--pink .card__desc, .card--blue p, .card--blue .card__desc, .card--lilac p, .card--lilac .card__desc { color: inherit; }
.card__foot { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; color: var(--md-sys-color-primary); font-weight: 700; font-size: .95rem; }
.card__foot .md-icon { width: 20px; height: 20px; }
.card--pink .card__foot, .card--lilac .card__foot { color: inherit; }
.card--blue .card__foot { color: var(--md-sys-color-secondary); }
.card .cat { align-self: flex-start; }
.card--pink .cat { background: rgba(255,255,255,.65); color: inherit; }
.card--blue .cat { background: rgba(255,255,255,.7); color: inherit; }

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid--3 { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 1024px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* Material list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { margin: 0 0 6px; }
.list a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-large-increased);
  background: var(--md-sys-color-surface);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}
.list a:hover { background: var(--mc-pink-tint); }
.list__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list__headline { font-weight: 700; }
.list__support { font-size: .9rem; color: var(--md-sys-color-on-surface-variant); }
.list__trail { margin-left: auto; color: var(--md-sys-color-primary); }
.list__trail svg { width: 24px; height: 24px; }


/* 6. TILE MOTIF ------------------------------------------------------------
   Original Mahjong-tile UI element: white face, thin soft edge, a chunky
   bubblegum-pink bottom for depth, one simple symbol drawn in SVG.       */
.tile {
  --tile-w: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tile-w);
  height: calc(var(--tile-w) * 1.36);
  flex: none;
  background: var(--mc-tile-face);
  border-radius: calc(var(--tile-w) * .22);
  box-shadow:
    inset 0 0 0 1px var(--mc-tile-edge),
    0 calc(var(--tile-w) * .13) 0 0 var(--mc-tile-bottom),
    0 calc(var(--tile-w) * .2) calc(var(--tile-w) * .3) rgba(var(--mc-shadow-ink), .08);
  color: var(--md-sys-color-primary);
  font-weight: 800;
  font-size: calc(var(--tile-w) * .5);
  line-height: 1;
  font-family: var(--md-sys-typescale-font);
}
.tile svg { width: 64%; height: 64%; }
.tile--sm { --tile-w: 36px; }
.tile--lg { --tile-w: 64px; }
.tile--xl { --tile-w: 76px; }
.tile--pink { color: #D94083; }
.tile--blue { color: #4D7096; }
.tile--lilac { color: #6B5D91; }
.tile--ink { color: #211A1E; }

.tile-hand {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  padding: 6px 4px 22px;
}
.tile-hand .tile { transform: rotate(var(--r, 0deg)); }


/* 7. HOMEPAGE --------------------------------------------------------------- */
.hero { padding-block: 20px 8px; }
@media (min-width: 840px) { .hero { padding-block: 44px 16px; } }
.hero__grid {
  display: grid;
  gap: 24px;
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 840px) { .hero__grid { grid-template-columns: 1.15fr .85fr; gap: 40px; } }
.hero h1 { max-width: 16ch; }
@media (max-width: 599px) { .hero h1 { max-width: none; font-size: 2rem; } }
.hero__lede, .hero__lead {
  margin: 18px 0 24px;
  max-width: 44ch;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--md-sys-color-on-surface-variant);
}
/* Hero tiles: large American Mahjong tiles (2 Bam, 5 Crak, Flower, 3 Dot,
   Joker) fanned like a hand, over soft pink and blue circles. Same drawing
   style as the social share card. Corner numbers use the site sans font. */
.hero__tiles {
  --ht-w: clamp(56px, 16vw, 84px);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 36px 8px 44px;
  isolation: isolate;
}
@media (min-width: 840px) { .hero__tiles { --ht-w: 88px; padding: 56px 0 64px; } }
@media (min-width: 1100px) { .hero__tiles { --ht-w: 96px; } }
.hero__tiles::before, .hero__tiles::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}
.hero__tiles::before {
  width: calc(var(--ht-w) * 3); aspect-ratio: 1;
  left: 4%; top: 0;
  background: var(--md-sys-color-primary-container);
  opacity: .6;
}
.hero__tiles::after {
  width: calc(var(--ht-w) * 3.1); aspect-ratio: 1;
  right: 0; bottom: -4%;
  background: var(--md-sys-color-secondary-container);
  opacity: .75;
}
.htile {
  --base: var(--mc-tile-bottom);
  flex: none;
  display: block;
  width: var(--ht-w);
  aspect-ratio: 100 / 136;
  margin-inline: calc(var(--ht-w) * -.025);
  background: var(--mc-tile-face);
  border-radius: 22% / 16%;
  box-shadow:
    inset 0 0 0 1.5px var(--mc-tile-edge),
    0 calc(var(--ht-w) * .09) 0 0 var(--base),
    0 calc(var(--ht-w) * .16) calc(var(--ht-w) * .34) rgba(var(--mc-shadow-ink), .14);
  transform: translateY(var(--y, 0)) rotate(var(--r, 0deg));
}
.htile svg { display: block; width: 100%; height: 100%; }
.htile--blue { --base: #A9CDF0; }
.htile--pink { --base: #EE9BBE; }
.hero__tiles .htile:nth-child(1) { --r: -12deg; --y: 14px; z-index: 1; }
.hero__tiles .htile:nth-child(2) { --r: -6deg;  --y: -6px; z-index: 2; }
.hero__tiles .htile:nth-child(3) { --r: 0deg;   --y: -16px; z-index: 5; width: calc(var(--ht-w) * 1.12); }
.hero__tiles .htile:nth-child(4) { --r: 6deg;   --y: -6px; z-index: 3; }
.hero__tiles .htile:nth-child(5) { --r: 12deg;  --y: 14px; z-index: 4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .htile--blue { --base: #7FA3C8; }
  :root:not([data-theme="light"]) .htile--pink { --base: #C97A9E; }
}

.section { padding-block: 36px 8px; }
.section__head { margin-bottom: 20px; max-width: 60ch; }
.section__head h2 { margin-bottom: 6px; }
.section__head p { color: var(--md-sys-color-on-surface-variant); margin: 0; }

.path-card .tile { margin-bottom: 4px; }
.path-card__num {
  position: absolute; right: 18px; top: 16px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 700; font-size: .9rem;
}
.card--pink .path-card__num, .card--blue .path-card__num { background: rgba(255,255,255,.7); color: inherit; }

.break-card {
  display: grid;
  gap: 20px;
  align-items: center;
  padding: 26px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .break-card { grid-template-columns: 1fr auto; padding: 30px 34px; } }
.break-card h2 { margin-bottom: 4px; }
.break-card p { margin: 6px 0 18px; max-width: 46ch; }
.break-card .flowers, .break-card__flowers { display: flex; gap: 10px; }
.break-card .flowers .tile, .break-card__flowers .tile { --tile-w: 50px; }
.break-card .flowers svg, .break-card__flowers svg { width: 70%; height: 70%; }


/* 8. ARTICLE TEMPLATE ------------------------------------------------------- */
.article-head { padding-block: 12px 6px; max-width: var(--mc-measure); }
@media (min-width: 840px) { .article-head { padding-block: 24px 6px; } }
.breadcrumb { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 2px; font-size: .9rem; }
.breadcrumb li { margin: 0; display: inline-flex; align-items: center; color: var(--md-sys-color-on-surface-variant); }
.breadcrumb li + li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px; border-top: 2px solid var(--md-sys-color-outline); border-right: 2px solid var(--md-sys-color-outline); transform: rotate(45deg); }
.breadcrumb a { color: var(--md-sys-color-on-surface-variant); text-decoration: none; padding: 6px 0; }
.breadcrumb a:hover { color: var(--md-sys-color-primary); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--md-sys-color-on-surface); font-weight: 600; }

.article-head .cat { margin: 12px 0 14px; }
.article-head h1 { margin-bottom: 14px; }
.standfirst {
  font-size: 1.18rem;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 16px;
  max-width: 52ch;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 6px 0;
  font-size: .88rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 8px;
}
.article-meta span::after { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--md-sys-color-outline); margin: 0 10px; vertical-align: middle; }
.article-meta span:last-child::after { display: none; }

.article-layout { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .article-layout { grid-template-columns: minmax(0, var(--mc-measure)) 280px; } }
.article-body { max-width: var(--mc-measure); padding-top: 8px; }
.article-body > h2 { margin: 2.2rem 0 .8rem; scroll-margin-top: 24px; }
.article-body > h3 { margin: 1.7rem 0 .6rem; }
.article-body > h2:first-child { margin-top: .8rem; }
.article-body p, .article-body li { max-width: 68ch; }
.article-body figure { margin: 1.5rem 0; }
.article-body figcaption { font-size: .88rem; color: var(--md-sys-color-on-surface-variant); margin-top: 10px; }

/* Table of contents */
.toc-col { display: none; }
@media (min-width: 1100px) { .toc-col { display: block; } }
.toc {
  margin: 0 0 20px;
  padding: 8px;
  border-radius: var(--md-sys-shape-corner-large-increased);
  background: var(--md-sys-color-surface-container);
}
@media (min-width: 1100px) { .toc-col .toc { position: sticky; top: 20px; max-height: calc(100dvh - 40px); overflow: auto; } }
.toc summary {
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  font-weight: 700;
  border-radius: var(--md-sys-shape-corner-full);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--md-sys-motion-duration-short); }
.toc[open] summary::after { transform: rotate(-135deg); }
@media (min-width: 1100px) { .toc-col .toc summary { pointer-events: none; } .toc-col .toc summary::after { display: none; } }
.toc ol { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; counter-increment: toc; }
.toc a {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 6px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.toc a::before { content: counter(toc); flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--md-sys-color-surface-container-highest); font-size: .78rem; font-weight: 700; color: var(--md-sys-color-on-surface-variant); }
.toc a:hover { background: var(--md-sys-color-surface-container-high); }
.toc a.is-active { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.toc a.is-active::before { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.toc--inline { margin: 12px 0 24px; }

/* Quick answer */
.quick-answer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 18px 20px;
  margin: 14px 0 26px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.quick-answer .tile { --tile-w: 38px; }
.quick-answer p { margin: 0; max-width: none; }
.quick-answer strong { display: block; font-size: .82rem; letter-spacing: .02em; margin-bottom: 4px; }

/* Callouts: tip, warn, note */
.tip, .warn, .note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  margin: 22px 0;
  border-radius: var(--md-sys-shape-corner-large-increased);
}
.tip { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.tip .tile { --tile-w: 34px; }
.warn { grid-template-columns: 1fr; background: var(--md-sys-color-surface); box-shadow: inset 0 0 0 1.5px var(--md-sys-color-error); }
.warn::before { content: ""; display: none; }
.note { grid-template-columns: 1fr; background: var(--md-sys-color-surface-container); }
.tip p, .warn p, .note p { margin: 0; max-width: none; }
.tip p + p, .warn p + p, .note p + p { margin-top: .5em; }
.tip strong:first-child, .warn strong:first-child, .note strong:first-child { display: block; margin-bottom: 3px; }
.warn strong:first-child { color: var(--md-sys-color-error); }

/* Affiliate disclosure (small, readable) */
.disclosure {
  padding: 12px 16px;
  margin: 14px 0 22px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: .9rem;
  max-width: none !important;
}

/* Steps */
.steps { list-style: none; margin: 1.2rem 0 1.6rem; padding: 0; counter-reset: step; }
.steps > li {
  position: relative;
  counter-increment: step;
  padding-left: 62px;
  margin-bottom: 18px;
  min-height: 48px;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 800; font-size: 1.1rem;
}
.steps > li > strong:first-child { display: block; margin-bottom: 2px; font-size: 1.05rem; }
.steps p:last-child { margin-bottom: 0; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2rem 0 1.6rem;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
}
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
th { background: var(--md-sys-color-surface-container); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { font-weight: 600; }
.yes { font-weight: 700; color: var(--md-sys-color-primary); }
.no { font-weight: 700; color: var(--md-sys-color-error); }

/* FAQ (details) */
.faq { margin: 1rem 0 1.5rem; }
.faq details {
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container);
  margin-bottom: 10px;
  padding: 0 18px;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 0;
  font-weight: 700;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--md-sys-motion-duration-short); }
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq details > *:not(summary) { padding-bottom: 6px; }
.faq details p { max-width: none; }

/* Glossary */
.glossary dt { font-weight: 700; font-size: 1.12rem; margin-top: 1.4rem; scroll-margin-top: 24px; }
.glossary dd { margin: .3rem 0 0; max-width: 68ch; }

/* Tile grid (meet the tiles) */
.tile-grid {
  list-style: none;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin: 1.2rem 0 1.6rem;
  padding: 0;
}
.tile-grid li {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  margin: 0;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-large-increased);
  background: var(--md-sys-color-surface-container);
}
.tile-grid b { font-size: 1rem; }
.tile-grid p { font-size: .88rem; color: var(--md-sys-color-on-surface-variant); margin: 0; }

/* Charleston diagram */
.charleston {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin: 0;
}
@media (min-width: 600px) { .charleston { grid-template-columns: 1fr 1fr; } }
.charleston__stage {
  padding: 20px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.charleston__stage.is-second { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.charleston__stage h3 { margin: 0 0 12px; font-size: 1.05rem; }
.charleston__stage ol { list-style: none; margin: 0; padding: 0; }
.charleston__stage li {
  display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 12px;
  min-height: 56px; margin: 0 0 8px; max-width: none;
  padding: 6px 10px 6px 6px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
}
.charleston__stage li > span:first-child {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font-size: 1.35rem; font-weight: 800; line-height: 1;
}
.charleston__stage.is-second li > span:first-child { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.charleston__stage li b { display: block; }
.charleston__stage li small { color: var(--md-sys-color-on-surface-variant); display: block; font-size: .85rem; line-height: 1.35; }

/* Wall diagram */
.wall-diagram {
  margin: 1.2rem 0 1.6rem;
  padding: 18px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.wall-diagram svg { width: 100%; height: auto; max-width: 520px; margin: 0 auto; }
.wall-diagram figcaption { color: inherit; text-align: center; margin-top: 10px; font-size: .9rem; }

/* Product blocks (gear pages) */
.product {
  padding: 22px;
  margin: 1.3rem 0 1.6rem;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container);
}
.product__badge {
  display: inline-flex; align-items: center;
  min-height: 30px; padding: 2px 12px; margin-bottom: 10px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: .82rem; font-weight: 700;
}
.product h3 { margin: 0 0 8px; font-size: 1.22rem; }
.product ul { margin-bottom: .8em; }
.product__price { margin: 0; font-size: .92rem; color: var(--md-sys-color-on-surface-variant); }

/* Related guides, next break, trust */
.related { margin-top: 44px; }
.related h2 { margin-bottom: 16px; }
.related .card { padding: 18px 20px; }
.related .card__title { font-size: 1.05rem; }
.next-break { margin-top: 24px; }
.trust {
  margin-top: 28px;
  padding: 18px 22px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-low);
  font-size: .93rem;
  color: var(--md-sys-color-on-surface-variant);
  max-width: var(--mc-measure);
}
.trust p { margin: 0; }


/* 9. SECTION PAGES, SEARCH, 404 --------------------------------------------- */
.section-head { padding-block: 20px 12px; max-width: 64ch; }
@media (min-width: 840px) { .section-head { padding-block: 36px 16px; } }
.section-head h1 { margin-bottom: 12px; }
.section-head p { font-size: 1.12rem; color: var(--md-sys-color-on-surface-variant); }
.section-block { padding-block: 24px 8px; }
.section-block h2 { margin-bottom: 14px; }
.section-block > p { max-width: 68ch; }
.prose { max-width: var(--mc-measure); padding-top: 8px; }
.prose h2 { margin: 2rem 0 .7rem; }
.prose h3 { margin: 1.5rem 0 .5rem; }
.prose p, .prose li { max-width: 68ch; }
.prose .lede { font-size: 1.15rem; color: var(--md-sys-color-on-surface-variant); }

.search-page { max-width: 760px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 0 12px 0 20px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  margin: 16px 0 20px;
}
.search-box:focus-within { background: var(--md-sys-color-surface-container-highest); box-shadow: 0 0 0 2px var(--md-sys-color-primary) inset; }
.search-box input { flex: 1; min-width: 0; height: 52px; border: 0; background: transparent; font: inherit; font-size: 1.1rem; color: var(--md-sys-color-on-surface); outline: none; }
.search-box input::-webkit-search-decoration, .search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-status { color: var(--md-sys-color-on-surface-variant); margin: 0 0 12px; }

.not-found { text-align: center; padding-block: 48px 24px; max-width: 560px; margin-inline: auto; }
.not-found .tile-hand { justify-content: center; margin-bottom: 8px; }
.not-found .btn-row { justify-content: center; }


/* 10. FLOWER MATCH GAME ----------------------------------------------------- */
.game-page { max-width: 720px; margin-inline: auto; }
.game-head { text-align: center; padding-block: 8px 14px; }
.game-head h1 { margin-bottom: 6px; }
.game-head .game-lead { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.game-head .game-sub { margin: 0; color: var(--md-sys-color-on-surface-variant); }
.game-status { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
.game-status .chip { min-height: 36px; padding: 4px 14px; gap: 4px; pointer-events: none; }
.game-status .chip b { font-weight: 800; }
.board-wrap {
  padding: 12px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--mc-blue-tint);
}
@media (min-width: 600px) { .board-wrap { padding: 20px; } }
.board {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(var(--board-cols, 4), 1fr);
  margin: 0 auto;
  max-width: 600px;
}
@media (min-width: 600px) { .board { gap: 12px; } }
.board-wrap { position: relative; }
/* Each tile is a button holding a 3D card: a white flower face and a pink
   back. After a match every tile flips to its back in a ripple, the next
   board is dealt face-down, then everything flips face-up again. */
.ftile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 18%;
  background: none;
  cursor: pointer;
  perspective: 800px;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-spring), outline-color var(--md-sys-motion-duration-short);
  outline: 4px solid transparent;
  outline-offset: 3px;
}
.ftile__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 380ms cubic-bezier(.45, .05, .25, 1.15);
  transition-delay: var(--flip-delay, 0ms);
}
.ftile.is-down .ftile__inner { transform: rotateY(180deg); }
.ftile__face, .ftile__back {
  position: absolute;
  inset: 0;
  border-radius: 18%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.ftile__face {
  display: block;
  padding: 10%;
  background: var(--mc-tile-face);
  box-shadow: inset 0 0 0 1px var(--mc-tile-edge), 0 7px 0 var(--mc-tile-bottom), 0 10px 18px rgba(var(--mc-shadow-ink), .08);
}
.ftile__back {
  display: grid;
  place-items: center;
  transform: rotateY(180deg);
  background: #F4A7C2;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45), 0 7px 0 #E283AC, 0 10px 18px rgba(var(--mc-shadow-ink), .1);
}
.ftile svg { display: block; width: 100%; height: 100%; }
.ftile__back svg { width: 58%; height: auto; }
.ftile.is-down { cursor: default; }
.ftile:not(.is-down):hover { transform: translateY(-2px); }
.ftile:focus-visible { outline-color: var(--mc-focus); }
.ftile.is-picked { outline-color: var(--mc-blue-halo); transform: translateY(-2px); }
.ftile.is-hint { animation: hint-pulse 1s ease-in-out 2; }
.ftile.is-matched { outline-color: var(--mc-pink-halo); animation: match-pop .5s var(--md-sys-motion-spring); }
.ftile.is-wrong { animation: shake .35s ease-in-out; }
@keyframes hint-pulse { 0%, 100% { outline-color: transparent; } 50% { outline-color: var(--mc-pink-halo); } }
@keyframes match-pop { 0% { transform: scale(1); } 45% { transform: scale(1.14) rotate(-3deg); } 100% { transform: scale(1.04); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.fm-petal {
  position: absolute;
  z-index: 5;
  width: 11px;
  height: 11px;
  border-radius: 70% 0 70% 0;
  pointer-events: none;
  animation: fm-burst .8s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes fm-burst {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; }
}
.chip.is-bump { animation: match-pop .45s var(--md-sys-motion-spring); }
.game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 20px 0 14px; }
.game-size-wrap { text-align: center; margin: 0 0 10px; }
.game-size-wrap .label { display: block; font-size: .85rem; font-weight: 600; color: var(--md-sys-color-on-surface-variant); margin-bottom: 8px; }
.game-size { display: inline-flex; border-radius: var(--md-sys-shape-corner-full); overflow: hidden; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
.game-size button {
  min-height: 44px; padding: 0 18px; border: 0; background: var(--md-sys-color-surface); font: inherit; font-weight: 600; cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
}
.game-size button + button { box-shadow: inset 1px 0 0 var(--md-sys-color-outline-variant); }
.game-size button[aria-pressed="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.game-note { text-align: center; font-size: .9rem; color: var(--md-sys-color-on-surface-variant); margin: 0; }
.game-done {
  display: none;
  text-align: center;
  margin-top: 16px;
  padding: 28px 16px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.game-done.is-open { display: block; }
.game-done h2 { margin-bottom: 6px; }
.game-done p { color: inherit; }
.game-done .btn-row { justify-content: center; margin-top: 14px; }
.game-about { max-width: 60ch; margin: 28px auto 0; text-align: center; font-size: .92rem; color: var(--md-sys-color-on-surface-variant); }
.no-js-note { padding: 14px 18px; border-radius: var(--md-sys-shape-corner-large); background: var(--md-sys-color-surface-container-low); }
.js .no-js-note { display: none; }
body.page-game .breadcrumb { display: none; }
@media (min-width: 840px) { body.page-game .breadcrumb { display: flex; justify-content: center; } }


/* 11. MOTION, PRINT --------------------------------------------------------- */
.muted { color: var(--md-sys-color-on-surface-variant); }
.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .top-app-bar, .nav-bar, .drawer, .footer, .related, .next-break, .app-search, .search-link, .toc-col { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  a { color: #000; }
}

/* 12. PRINTABLE DOWNLOAD --------------------------------------------------- */
.download-card {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  padding: 22px;
  margin: 22px 0 26px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--mc-blue-tint);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-secondary-container);
}
@media (min-width: 600px) { .download-card { grid-template-columns: 200px 1fr; align-items: center; padding: 24px; } }
.download-card__thumb { display: block; border-radius: var(--md-sys-shape-corner-medium); overflow: hidden; box-shadow: 0 6px 0 var(--mc-tile-bottom), 0 10px 18px rgba(var(--mc-shadow-ink), .1); background: #fff; margin-bottom: 8px; }
.download-card__thumb img { width: 100%; height: auto; display: block; }
.download-card__body .cat { margin-bottom: 8px; }
.download-card__title { font-size: 1.2rem; margin-bottom: 6px; }
.download-card__body p { margin: 0 0 14px; color: var(--md-sys-color-on-surface-variant); max-width: 52ch; }
.download-card .btn-row { gap: 8px; }
.download-card--compact { padding: 18px; margin: 26px 0; }
.download-card--compact .download-card__title { font-size: 1.08rem; }
.download-card--compact p { font-size: .95rem; }
.sheet-preview { display: grid; gap: 20px; grid-template-columns: 1fr; margin: 24px 0 8px; max-width: 980px; }
@media (min-width: 720px) { .sheet-preview { grid-template-columns: 1fr 1fr; } }
.sheet-preview figure { margin: 0; }
.sheet-preview a { display: block; border-radius: var(--md-sys-shape-corner-large); overflow: hidden; box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant), 0 8px 0 var(--mc-tile-bottom), 0 14px 24px rgba(var(--mc-shadow-ink), .1); background: #fff; }
.sheet-preview img { width: 100%; height: auto; display: block; }
.sheet-preview figcaption { margin-top: 16px; font-weight: 600; font-size: .95rem; color: var(--md-sys-color-on-surface-variant); }

/* 13. PLAY: links out to online platforms, and the real-game card under
   Flower Match. */
.visit-link { margin: 4px 0 28px; }
.visit-link .btn .md-icon { width: 18px; height: 18px; }
.real-game-card { max-width: 620px; margin: 22px auto 0; }

/* 14. TILE GALLERY (American Mahjong tiles guide) -------------------------- */
.tile-gallery {
  --ht-w: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 8px;
  margin: 1.2rem 0 1.8rem;
  padding: 16px 12px 18px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--mc-blue-tint);
}
@media (min-width: 600px) { .tile-gallery { --ht-w: 56px; gap: 18px 12px; padding: 20px 18px 22px; } }
.article-body .tile-spec { margin: 0; width: calc(var(--ht-w) + 6px); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tile-spec .htile { margin: 0; transform: none; }
.article-body .tile-spec figcaption { margin: 0; font-size: .8rem; font-weight: 600; line-height: 1.25; text-align: center; color: var(--md-sys-color-on-surface-variant); }
@media print { .tile-gallery { background: none; } }
.printables { display: grid; gap: 0; max-width: 980px; }
.printables .download-card { margin: 0 0 18px; }

/* 15. 404 PAGE TILES: 4 - flower - 4, same drawing style as the homepage hero */
.nf-tiles { --ht-w: 76px; position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 0; padding: 34px 0 40px; margin-bottom: 8px; isolation: isolate; }
@media (min-width: 600px) { .nf-tiles { --ht-w: 96px; padding: 44px 0 52px; } }
.nf-tiles::before, .nf-tiles::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; aspect-ratio: 1; }
.nf-tiles::before { width: calc(var(--ht-w) * 2.6); left: calc(50% - var(--ht-w) * 2.2); top: 0; background: var(--md-sys-color-primary-container); opacity: .6; }
.nf-tiles::after { width: calc(var(--ht-w) * 2.8); left: calc(50% - var(--ht-w) * .4); bottom: -6%; background: var(--md-sys-color-secondary-container); opacity: .75; }
.nf-tiles .htile { margin-inline: calc(var(--ht-w) * -.03); }
.nf-tiles .htile:nth-child(1) { --r: -9deg; --y: 8px; z-index: 1; }
.nf-tiles .htile:nth-child(2) { --r: 0deg; --y: -14px; z-index: 2; width: calc(var(--ht-w) * 1.1); }
.nf-tiles .htile:nth-child(3) { --r: 9deg; --y: 8px; z-index: 1; }
