/* ===== CUSTOM FONTS ===== */
@font-face {
  font-family: Aero;
  src: url('aero.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f5f0;
  --color-surface: #eaeae5;
  --color-accent: #bd590c;
  --color-accent-hover: #a34e0a;
  --color-text: #1a1a1a;
  --color-text-muted: #595955;
  --color-heading: #111111;
  --color-link: #bd590c;
  --color-link-hover: #a34e0a;
  --color-border: rgba(26, 26, 26, 0.12);
  --color-green: #38803a;
  --color-green-bg: #bfcfb8;
  --color-highlight: rgba(189, 89, 12, 0.1);
  --color-highlight-subtle: rgba(189, 89, 12, 0.05);
  --color-header-bg: rgba(255, 255, 255, 0.94);
  --color-btn-text: #fff;
  --color-callout-amber: #fef5ec;
  --color-callout-green: #eef5ee;
  --color-callout-green-border: #38803a;
  --color-error: #c03030;
  --color-overlay: rgba(0, 0, 0, 0.85);
  --color-shadow-strong: rgba(0, 0, 0, 0.6);
  --color-shadow-dropdown: rgba(0, 0, 0, 0.4);
  --color-focus-ring: rgba(189, 89, 12, 0.18);
  --color-hover-subtle: rgba(189, 89, 12, 0.05);
  --color-tag-free-bg: rgba(106, 168, 79, 0.15);
  --color-tag-free: #4a7a2e;
  --color-tag-paid-bg: rgba(189, 89, 12, 0.12);
  --color-tag-platform-bg: rgba(26, 26, 26, 0.07);
  --color-tag-oss-bg: rgba(59, 130, 246, 0.12);
  --color-tag-oss: #2563b0;
  --color-han-1: #38803a;
  --color-han-2: #2b6cb0;
  --color-han-3: #6b4f96;
  --color-han-5: #8a6508;
  --color-han-6: #a34e0a;
  --color-yakuman: #b52828;
  --color-tile-back: #2a6b3c;
  --max-width: 1200px;
  --nav-height: 60px;
  --font-body: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Aero', 'DM Serif Display', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1e;
    --color-bg-alt: #242428;
    --color-surface: #2e2e33;
    --color-text: #e8e8e3;
    --color-text-muted: #a0a09a;
    --color-heading: #f0f0eb;
    --color-link: #e8872e;
    --color-link-hover: #f09535;
    --color-border: rgba(255, 255, 255, 0.12);
    --color-green: #48a84b;
    --color-green-bg: #2a3328;
    --color-highlight: rgba(232, 135, 46, 0.12);
    --color-highlight-subtle: rgba(232, 135, 46, 0.06);
    --color-header-bg: rgba(26, 26, 30, 0.94);
    --color-btn-text: #fff;
    --color-callout-amber: #2e2614;
    --color-callout-green: #1a2e1e;
    --color-callout-green-border: #48a84b;
    --color-error: #e06060;
    --color-overlay: rgba(0, 0, 0, 0.9);
    --color-shadow-strong: rgba(0, 0, 0, 0.8);
    --color-shadow-dropdown: rgba(0, 0, 0, 0.6);
    --color-focus-ring: rgba(232, 135, 46, 0.2);
    --color-hover-subtle: rgba(232, 135, 46, 0.08);
    --color-tag-free-bg: rgba(106, 168, 79, 0.2);
    --color-tag-free: #6cc070;
    --color-tag-paid-bg: rgba(232, 135, 46, 0.15);
    --color-tag-platform-bg: rgba(255, 255, 255, 0.08);
    --color-tag-oss-bg: rgba(96, 165, 250, 0.15);
    --color-tag-oss: #60a5fa;
    --color-han-1: #48a84b;
    --color-han-2: #4488cc;
    --color-han-3: #8068b0;
    --color-han-5: #c09818;
    --color-han-6: #cc6520;
    --color-yakuman: #d03838;
    --color-tile-back: #3a8a4c;
  }
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body), sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--color-link-hover); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-heading), serif;
  color: var(--color-heading);
  line-height: 1.3;
}

hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: 2.5rem 0;
}

/* ===== ANCHOR OFFSET FOR STICKY HEADER ===== */
[id] {
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}

/* ===== HEADER / NAV ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.site-logo {
  font-family: var(--font-heading), serif;
  font-size: 1.35rem;
  color: var(--color-heading);
  text-decoration: none;
  white-space: nowrap;
}
.site-logo:hover { color: var(--color-accent); }

/* Desktop nav */
.main-nav { display: flex; align-items: center; gap: 0; }

.main-nav > li {
  list-style: none;
  position: relative;
}

.main-nav > li > a {
  display: block;
  padding: 0.5rem 0.9rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.main-nav > li > a:hover,
.main-nav > li > a.active {
  color: var(--color-accent);
}

/* Dropdown */
.main-nav .dropdown { position: relative; }
.main-nav .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0;
  min-width: 180px;
  box-shadow: 0 8px 24px var(--color-shadow-dropdown);
  list-style: none;
  z-index: 200;
}
.main-nav .dropdown:hover .dropdown-menu,
.main-nav .dropdown.open .dropdown-menu { display: block; }
.main-nav .dropdown-menu li a {
  display: block;
  padding: 0.45rem 1rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
}
.main-nav .dropdown-menu li a:hover {
  background: var(--color-highlight);
  color: var(--color-accent);
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 24px;
  position: relative;
}
.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: '';
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: 2px;
  position: absolute;
  left: 0;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle::before { top: 0; }
.nav-toggle span { top: 50%; transform: translateY(-50%); }
.nav-toggle::after { bottom: 0; }

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 1rem 0;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
  }
  .main-nav.open { display: flex; }
  .main-nav > li {
    width: 100%;
    text-align: center;
  }
  .main-nav > li > a {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.03em;
  }
  .main-nav > li > a:hover,
  .main-nav > li > a.active { color: var(--color-accent); }
  .main-nav .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
    padding-left: 0;
    text-align: center;
  }
  .main-nav .dropdown-menu { display: block; }
  .main-nav .dropdown-menu li a {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--color-text-muted);
    padding: 0.35rem 1.5rem;
  }
  .main-nav .dropdown-menu li a:hover { color: var(--color-accent); background: transparent; }
}

/* ===== MAIN CONTENT ===== */
.page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Restore list indentation inside page content */
.page-content ul,
.page-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}
.page-content li {
  margin-bottom: 0;
}

.page-title {
  font-size: 2.4rem;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}
.page-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  margin-top: 0.5rem;
  border-radius: 2px;
}

/* ===== HOME: HERO ===== */
.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-text {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto 1.8rem;
  color: var(--color-text);
  line-height: 1.8;
}

.hero-text h1 {
  margin-bottom: 1.2rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--color-accent);
  color: var(--color-btn-text);
  font-family: var(--font-body), sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: background 0.2s, transform 0.15s;
}
.btn:hover {
  background: var(--color-accent-hover);
  color: var(--color-btn-text);
  transform: translateY(-1px);
}

/* ===== HOME: CCRO ANNOUNCEMENT ===== */
.ccro-announce-wrap {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

/* ===== HOME: FEATURES BAND ===== */
.features-band {
  background: var(--color-green-bg);
  width: 100%;
  margin-bottom: 3rem;
}

/* ===== HOME: FEATURES GRID ===== */
.features {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Top row: 2 wide cards */
.feature-card:nth-child(1),
.feature-card:nth-child(2) {
  grid-column: span 3;
}

/* Bottom row: 3 equal cards */
.feature-card:nth-child(3),
.feature-card:nth-child(4),
.feature-card:nth-child(5) {
  grid-column: span 2;
}

.feature-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: border-color 0.25s, transform 0.2s;
}
.feature-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}
.feature-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.feature-card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Tablet: 2 columns, drop all spans */
@media (max-width: 1024px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
  .feature-card:nth-child(1),
  .feature-card:nth-child(2),
  .feature-card:nth-child(3),
  .feature-card:nth-child(4),
  .feature-card:nth-child(5) {
    grid-column: span 1;
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .features {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
}

/* ===== HOME: PHOTO GALLERY ===== */
.gallery {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 210px;
  gap: 0.75rem;
  grid-auto-flow: dense;
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: transform 0.25s, border-color 0.25s;
  cursor: pointer;
  display: block;
}
.gallery img:hover {
  transform: scale(1.03);
  border-color: var(--color-accent);
}
/* Primary emphasis: images 1 and 4 */
.gallery img:nth-child(1)  { grid-column: span 2; grid-row: span 2; }
.gallery img:nth-child(4)  { grid-column: span 2; grid-row: span 2; }

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 160px;
  }
}

/* ===== HOME: HERO WITH BACKGROUND IMAGE ===== */
.hero--home {
  position: relative;
  padding: 5rem 1.5rem 4rem;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.60)),
    url('../mahjong images/cool hands/open baiman.webp') center 70%/cover no-repeat;
  color: #fff;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: none;
}
.hero--home .hero-text {
  color: #fff;
  max-width: 700px;
}
.hero--home .hero-text h1 {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.hero--home .hero-text p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.15rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn--outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}
.btn--outline:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: #fff;
}

@media (max-width: 768px) {
  .hero--home {
    padding: 3.5rem 1.5rem 3rem;
    min-height: 300px;
  }
}

/* ===== HOME: COMMUNITY PHOTO STRIP ===== */
.community-strip {
  max-width: var(--max-width);
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
}
.community-strip-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.community-strip-inner img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s;
}
.community-strip-inner img:hover {
  transform: scale(1.03);
  border-color: var(--color-accent);
}
@media (max-width: 768px) {
  .community-strip-inner {
    grid-template-columns: 1fr 1fr;
  }
  .community-strip-inner img:nth-child(3) {
    display: none;
  }
}
@media (max-width: 480px) {
  .community-strip-inner {
    grid-template-columns: 1fr;
  }
  .community-strip-inner img {
    height: 180px;
  }
  .community-strip-inner img:nth-child(2),
  .community-strip-inner img:nth-child(3) {
    display: none;
  }
}

/* ===== HOME: SCHEDULE AT-A-GLANCE ===== */
.schedule-glance {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
  padding: 3rem 1.5rem 0;
  text-align: center;
}
.schedule-glance h2 {
  margin-bottom: 1.5rem;
}
.schedule-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.schedule-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  transition: border-color 0.2s;
}
.schedule-card:hover {
  border-color: var(--color-accent);
}
.schedule-card-day {
  font-family: var(--font-heading), serif;
  font-size: 1.2rem;
  color: var(--color-heading);
  font-weight: 700;
}
.schedule-card-time {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-accent);
}
.schedule-card-venue {
  font-size: 0.9rem;
  color: var(--color-text);
}
.schedule-card-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}
.schedule-glance-link {
  margin-top: 1.25rem;
  font-size: 0.92rem;
}
@media (max-width: 768px) {
  .schedule-cards {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
  }
}

/* ===== HOME: FAQ AT-A-GLANCE ===== */
.faq-glance {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}
.faq-glance h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}
.faq-list {}
.faq-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-border);
}
.faq-item:first-child {
  border-top: 1px solid var(--color-border);
}
.faq-item dt {
  font-family: var(--font-heading), serif;
  font-size: 1.05rem;
  color: var(--color-heading);
  margin-bottom: 0.4rem;
}
.faq-item dd {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}
.faq-glance-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.92rem;
}

/* ===== LIGHTBOX ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox.active {
  display: flex;
}
#lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  cursor: default;
  box-shadow: 0 8px 40px var(--color-shadow-strong);
  outline: none;
}
#lightbox img:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--color-btn-text);
  font-size: 2.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: transform 0.15s, opacity 0.15s;
  outline: none;
}
.lightbox-close:hover {
  opacity: 0.8;
  transform: scale(1.1);
}
.lightbox-close:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== EVENTS PAGE ===== */
.event-block {
  margin-bottom: 2rem;
}

/* Two-column layout matching live site */
.event-row {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}
.event-row-left {
  flex: 0 0 40%;
  min-width: 0;
}
.event-row-right {
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .event-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .event-row-left {
    flex: none;
    width: 100%;
  }
}

.event-block h2 {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}
.event-block h2 a { color: var(--color-heading); }
.event-block h2 a:hover { color: var(--color-accent); }

.event-meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}
.event-meta a { color: var(--color-text-muted); text-decoration: underline; }
.event-meta a:hover { color: var(--color-accent); }

.event-block p, .event-block ul {
  margin-bottom: 0.6rem;
}

.event-block em {
  color: var(--color-text-muted);
}

/* Google Calendar embed */
.calendar-embed {
  margin: 2rem 0;
}
.calendar-embed iframe {
  border-radius: 8px;
  border: 1px solid var(--color-border);
  display: block;
  width: 100%;
  height: 600px;
}

@media (max-width: 640px) {
  .calendar-embed iframe {
    height: 400px;
  }
}

/* ===== SUBPAGE CONTENT ===== */
.content-section {
  margin-bottom: 2rem;
}
.content-section h2 {
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.content-section h3 {
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content-section ul {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}
.content-section li {
  margin-bottom: 0.3rem;
}

/* Photo strip for one-day events — horizontal scroll */
.photo-grid {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) var(--color-surface);
}
.photo-grid::-webkit-scrollbar {
  height: 6px;
}
.photo-grid::-webkit-scrollbar-track {
  background: var(--color-surface);
  border-radius: 3px;
}
.photo-grid::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 3px;
}
.photo-grid img {
  flex: 0 0 auto;
  max-width: none;
  width: 320px;
  height: 220px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s;
}
.photo-grid img:hover {
  transform: scale(1.03);
  border-color: var(--color-accent);
}

/* ===== SCHEDULE TABLE ===== */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
}
.schedule-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  color: var(--color-heading);
  font-weight: 600;
  border-bottom: 2px solid var(--color-green);
}
.schedule-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.schedule-table tr:hover td {
  background: var(--color-highlight-subtle);
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
}
.site-footer a { color: var(--color-accent); }

/* ===== 404 PAGE ===== */
.page-content--centered { text-align: center; padding-top: 4rem; padding-bottom: 4rem; }
.page-content--centered .next-steps-grid { text-align: left; margin-top: 2.5rem; }
.error-cta { margin-top: 1.5rem; }

/* ===== UTILITIES ===== */
.mt-sm { margin-top: 0.4rem; }
.mt-md { margin-top: 0.8rem; }
.mt-lg { margin-top: 1rem; }
.mt-xl { margin-top: 1.5rem; }
.mt-2xl { margin-top: 2rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

strong { font-weight: 600; }

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

/* Scoring page section headings */
.scoring-section-title {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

/* Payment calculator heading gets extra top spacing */
.scoring-section-title--calc {
  margin-bottom: 1rem;
  margin-top: 2rem;
}

/* Payment label in results */
.ccr-payment-label {
  margin-top: 1rem;
}

/* ===== SCORE CALCULATOR ===== */
.ccr-calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  /* Removed max-width and padding so it uses the full page-content width */
  margin: 1rem 0 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .ccr-calculator-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ccr-form-row {
    flex-direction: column;
    gap: 0.9rem;
  }
  .ccr-calculator-container input[type="number"],
  .ccr-calculator-container select {
    max-width: 100%;
  }
}

.ccr-calculator-container { max-width: 100%; }
.ccr-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0;
}
.ccr-header { text-align: center; margin-bottom: 2rem; border-bottom: 1px solid var(--color-border); padding-bottom: 1.5rem; }
.ccr-header h2 { font-family: var(--font-heading), serif; font-size: 1.6rem; color: var(--color-heading); }
.ccr-form-row { display: flex; gap: 1.5rem; margin-bottom: 0.9rem; }
.ccr-form-row .ccr-form-group { flex: 1; margin-bottom: 0; }
.ccr-form-group { margin-bottom: 0.9rem; }
.ccr-form-group > label { display: block; margin-bottom: 0.35rem; font-weight: 600; color: var(--color-text); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.ccr-radio-group { display: flex; gap: 1.25rem; }
.ccr-radio-group label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; cursor: pointer; color: var(--color-text); text-transform: none; letter-spacing: normal; font-size: 0.95rem; margin: 0; white-space: nowrap; }
.ccr-radio-group input { cursor: pointer; accent-color: var(--color-accent); }
.ccr-calculator-container input[type="number"],
.ccr-calculator-container select {
  width: 100%; max-width: 160px; padding: 0.4rem 0.6rem; border: 1px solid var(--color-border); border-radius: 6px;
  font-size: 0.95rem; font-weight: 500; background: var(--color-surface); color: var(--color-text); font-family: var(--font-body), sans-serif;
}
.ccr-calculator-container input[type="number"]:focus,
.ccr-calculator-container select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-focus-ring); }
.ccr-button {
  width: 100%; padding: 0.6rem; margin-top: 0.6rem; font-weight: 700; font-size: 0.95rem;
  background: var(--color-accent); color: var(--color-btn-text); border: none; border-radius: 6px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 1px; font-family: var(--font-body), sans-serif; transition: background 0.2s, transform 0.15s;
}
.ccr-button:hover { background: var(--color-accent-hover); transform: translateY(-1px); }
.ccr-calc-note { margin: 0.9rem 0 0; font-size: 0.8rem; color: var(--color-text-muted); line-height: 1.5; }
.ccr-calc-note strong { color: var(--color-text); font-weight: 600; }
.ccr-result-card {
  background: var(--color-surface); padding: 1.25rem; border-radius: 10px; margin-top: 0;
  border-left: 4px solid var(--color-accent); display: none;
  height: fit-content;
}
.ccr-result-card.show { display: block; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.ccr-result-title { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; font-weight: 700; }
.ccr-result-value { font-size: 2rem; font-weight: 700; font-family: var(--font-heading), serif; color: var(--color-heading); margin-bottom: 1rem; }
.ccr-result-details { font-size: 0.95rem; color: var(--color-text); line-height: 1.8; }
.ccr-result-details strong { color: var(--color-heading); }
.ccr-error { color: var(--color-error); font-size: 0.8rem; margin-top: 0.4rem; display: none; font-weight: 500; }
.ccr-error.show { display: block; }
.ccr-hidden { display: none !important; }

/* ===== SCORING TABLES ===== */
.scoring-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}
.scoring-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  background: var(--color-surface);
  color: var(--color-heading);
  font-weight: 600;
  border-bottom: 2px solid var(--color-green);
}
.scoring-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.scoring-table tr:hover td {
  background: var(--color-hover-subtle);
}
.scoring-table td:nth-child(2),
.scoring-table td:nth-child(3) {
  text-align: center;
  white-space: nowrap;
  width: 60px;
}
.fu-table td:nth-child(2),
.fu-table td:nth-child(3) {
  width: 80px;
}
.yaku-en {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ===== YAKU INTERACTIVE TABLE ===== */
.yaku-interactive { margin-bottom: 2rem; }

.yaku-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.yaku-search {
  flex: 1 1 200px;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-body), sans-serif;
  background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='%23666660' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 0.65rem center;
  outline: none;
  transition: border-color 0.2s;
}
.yaku-search:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-focus-ring); }

.yaku-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.yaku-filter {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  font-size: 0.8rem;
  font-family: var(--font-body), sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--color-text-muted);
}
.yaku-filter:hover { background: var(--color-bg-alt); border-color: var(--color-accent); color: var(--color-accent); }
.yaku-filter.active {
  background: var(--color-accent);
  color: var(--color-btn-text);
  border-color: var(--color-accent);
}
.yaku-filter:focus-visible,
.yaku-search:focus-visible,
.ccr-button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.yaku-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.yaku-master-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.yaku-master-table th.sortable:hover { color: var(--color-accent); }
.yaku-master-table th .sort-arrow {
  display: inline-block;
  margin-left: 3px;
  opacity: 0.3;
  font-size: 0.7rem;
}
.yaku-master-table th.sorted .sort-arrow { opacity: 1; color: var(--color-accent); }

/* Description column min-width so it doesn't get squeezed */
.yaku-master-table td:last-child,
.yaku-master-table th:last-child {
  min-width: 220px;
}

.yaku-en-cell {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.yaku-han-tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-btn-text);
  white-space: nowrap;
}
.yaku-han-tag.han-1 { background: var(--color-han-1); }
.yaku-han-tag.han-2 { background: var(--color-han-2); }
.yaku-han-tag.han-3 { background: var(--color-han-3); }
.yaku-han-tag.han-5 { background: var(--color-han-5); }
.yaku-han-tag.han-6 { background: var(--color-han-6); }
.yaku-han-tag.yakuman { background: var(--color-yakuman); }

@media (prefers-color-scheme: dark) {
  .yaku-han-tag.han-1,
  .yaku-han-tag.han-5 {
    color: var(--color-bg);
  }
}

.yaku-closed-x {
  color: var(--color-yakuman);
  font-weight: 700;
  font-size: 0.9rem;
}

.yaku-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: right;
  padding: 0.5rem 0.25rem;
}

/* ===== FU GRID ===== */
.fu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.fu-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.fu-card:hover { border-color: var(--color-accent); }

.fu-card-header {
  background: var(--color-surface);
  padding: 0.55rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-heading);
  border-bottom: 2px solid var(--color-green);
}

.fu-card-body {
  padding: 0.75rem 0.85rem;
}
.fu-card-body p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.fu-card .scoring-table { margin: 0; font-size: 0.85rem; }
.fu-card .scoring-table th { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
.fu-card .scoring-table td { padding: 0.3rem 0.5rem; }

.fu-card-formula {
  grid-column: 1 / -1;
  text-align: center;
  background: var(--color-surface);
  border-color: var(--color-green);
}
.fu-card-formula .fu-card-header {
  background: var(--color-green);
  color: var(--color-btn-text);
}

@media (prefers-color-scheme: dark) {
  .fu-card-formula .fu-card-header {
    color: var(--color-bg);
  }
}

@media (max-width: 768px) {
  .fu-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .fu-grid { grid-template-columns: 1fr; }
  .yaku-controls { flex-direction: column; }
  .yaku-search { width: 100%; }
}

/* ===== HOW TO PLAY PAGE ===== */

/* Table of contents */
.htp-toc {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.1rem 1.4rem 1.2rem;
  float: right;
  margin-top: 0;
  margin-right: 2.5rem;
  margin-bottom: 1.5rem;
  min-width: 200px;
  max-width: 220px;
}

@media (max-width: 640px) {
  .htp-toc {
    float: none;
    max-width: 100%;
    margin-right: 0;
    margin-bottom: 2rem;
  }
}

.htp-toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-muted);
  margin-bottom: 0.7rem;
}

.htp-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.htp-toc ol li {
  counter-increment: toc-counter;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.htp-toc ol li::before {
  content: "0" counter(toc-counter);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-accent);
  min-width: 1.6em;
  flex-shrink: 0;
  font-family: var(--font-body), sans-serif;
}

.htp-toc ol li a {
  font-size: 0.88rem;
  color: var(--color-text);
  font-weight: 500;
}

.htp-toc ol li a:hover,
.htp-toc ol li a.active { color: var(--color-accent); font-weight: 600; }

/* Section label (small overline above H2) */
.section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}

/* H2 improvements for content sections */
.content-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.1rem;
}

.section-label + h2 {
  margin-top: 0;
}

/* Callout boxes */
.callout {
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
}

.callout--amber {
  background: var(--color-callout-amber);
  border-left: 4px solid var(--color-accent);
}

.callout--green {
  background: var(--color-callout-green);
  border-left: 4px solid var(--color-callout-green-border);
}

.callout-title {
  font-weight: 700;
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.callout ol,
.callout p + p {
  margin-top: 0.6rem;
}

.callout p {
  margin: 0 0 0;
}

.callout p + p {
  margin-top: 0.65rem;
}

.callout p.callout-note {
  font-size: 0.91rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

/* Tile type cards */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
}

.tile-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.tile-card-label {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.45rem;
  color: var(--color-heading);
}

.tile-card ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.87rem;
}

.tile-card ul li {
  margin-bottom: 0.2rem;
}

/* Beginner yaku styled list */
.yaku-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.yaku-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.7rem 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  line-height: 1.55;
}

.yaku-item-name {
  font-weight: 700;
  font-style: italic;
  color: var(--color-accent);
  white-space: nowrap;
  min-width: 85px;
  font-size: 0.95rem;
  padding-top: 0.05rem;
  flex-shrink: 0;
}

.yaku-item-desc {
  font-size: 0.91rem;
  color: var(--color-text);
}

/* Next steps card grid */
.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.1rem 0 1.5rem;
}

.next-step-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  transition: border-color 0.2s, transform 0.2s;
}

.next-step-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.next-step-card a {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.3rem;
}

.next-step-card p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .tile-grid { grid-template-columns: 1fr; }
  .next-steps-grid { grid-template-columns: 1fr; }
  .yaku-item-name { min-width: 72px; }
}

/* How to Play hub — 2x2 card grid on the landing page */
.htp-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 2rem 0 1.5rem;
}

.htp-hub-card {
  display: block;
  padding: 1.5rem 1.6rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.htp-hub-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
}

.htp-hub-card-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.htp-hub-card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
  color: var(--color-heading);
}

.htp-hub-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .htp-hub-grid { grid-template-columns: 1fr; }
}

/* ===== PLAY ONLINE PAGE ===== */
.platform-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 1.25rem 0 2rem;
}

.platform-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.platform-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
}

.platform-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
}

.platform-card h3 a {
  color: var(--color-heading);
  text-decoration: none;
}

.platform-card h3 a:hover {
  color: var(--color-accent);
}

.platform-card p {
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0.6rem 0 0;
}

.platform-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.tag-paid {
  background: var(--color-tag-paid-bg);
  color: var(--color-accent);
}

.tag-platform {
  background: var(--color-tag-platform-bg);
  color: var(--color-text-muted);
}

.tag-open-source {
  background: var(--color-tag-oss-bg);
  color: var(--color-tag-oss);
}

.platform-note {
  font-size: 0.85rem !important;
  color: var(--color-text-muted);
  font-style: italic;
}

.play-online-cta {
  text-align: center;
  background: var(--color-green-bg);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  margin-top: 1rem;
}

.play-online-cta h2 {
  margin-top: 0;
}

.play-online-cta p {
  max-width: 700px;
  margin: 0 auto 1.25rem;
}


/* ===== SCORE TRAINER ===== */
.trainer-card { max-width: 100%; }
.trainer-hint {
  margin: 0;
  color: var(--color-text);
  opacity: 0.75;
  font-size: 0.9rem;
}
.trainer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.trainer-split {
  display: grid;
  grid-template-columns: 55% 45%;
  gap: 0 1.5rem;
  align-items: start;
}
.trainer-question { min-width: 0; }
.trainer-answer {
  border-left: 2px solid var(--color-accent);
  padding-left: 1.25rem;
  min-width: 0;
}
@media (max-width: 768px) {
  .trainer-split {
    grid-template-columns: 1fr;
  }
  .trainer-answer {
    border-left: none;
    border-top: 2px solid var(--color-accent);
    padding-left: 0;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
  }
}

/* Options bar */
.st-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.st-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}
.st-toggle span {
  font-weight: 600;
}
.st-toggle input[type="checkbox"] {
  accent-color: var(--color-accent, #e8872e);
  margin: 0;
  width: 15px;
  height: 15px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  cursor: pointer;
}
.st-toggle input[type="checkbox"]:checked + span {
  color: var(--color-text);
  font-weight: 700;
}

.trainer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}
.trainer-meta-item { display: flex; flex-direction: column; }
.trainer-meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  font-weight: 700;
}
.trainer-meta-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-heading);
}
.trainer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.4rem 1rem;
  margin-bottom: 0.75rem;
}
.trainer-row--first {
  margin-top: 1.25rem;
}
.trainer-result-separator {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.trainer-row-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  font-weight: 700;
  min-width: 7rem;
  padding-top: 0.4rem;
}
.trainer-row-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--color-heading);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2px;
}
.trainer-row-value--win {
  color: var(--color-accent);
  font-weight: 700;
}

/* -- Tile images -- */
.tile-img {
  display: inline-block;
  width: 40px;
  height: 53px;
  background-size: 70% auto, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: center 55%, center center;
  border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.35);
  vertical-align: bottom;
  flex-shrink: 0;
}
.tile-img--back {
  background-image: none;
  background-color: var(--color-tile-back);
}
/* Rotated (sideways) tile for open calls.
   We want the tile to appear 53w × 40h while the element is 40w × 53h.
   rotate(90deg) around center makes the visual box 53×40 centered on the
   original 40×53 box. Negative vertical margin trims the extra height;
   horizontal margin adds the extra width. */
.tile-img--rotated {
  transform: rotate(90deg);
  margin: -6.5px 6.5px;
}
.tile-call-group {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}
/* Shouminkan: two tiles stacked at the called-from position.
   The existing .tile-img--rotated margins (-6.5px top/bottom, +6.5px left/right)
   work correctly here: each tile occupies 40px height in the column
   and the container widens to 53px. The pair stands taller than upright tiles. */
.tile-kan-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.tile-call-spacer {
  display: inline-block;
  width: 8px;
}

@media (max-width: 600px) {
  .tile-img {
    width: 32px;
    height: 43px;
    border-radius: 3px;
  }
  .tile-img--rotated {
    /* 43 - 32 = 11; half = 5.5 */
    margin: -5.5px 5.5px;
  }
}
.trainer-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}
.trainer-answer-heading {
  font-family: var(--font-heading), serif;
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  color: var(--color-accent);
}
.trainer-answer .trainer-yaku-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.trainer-answer .trainer-yaku-list li {
  line-height: 1.6;
}


/* ===== WAITS TRAINER ===== */
.wt-tile-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}
.wt-answer-tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: border-color 0.1s;
  user-select: none;
}
.wt-answer-tile:hover { border-color: var(--color-border); }
.wt-answer-tile--selected { border-color: var(--color-accent); }
.wt-answer-tile--correct  { border-color: var(--color-han-1); }
.wt-answer-tile--wrong    { border-color: var(--color-yakuman); }
.wt-answer-tile--missed   { border-color: var(--color-han-5); }
.wt-answer-tile--phantom  { border-color: var(--color-border); border-style: dashed; opacity: 0.5; }
.wt-checked .wt-answer-tile { cursor: default; pointer-events: none; }
.wt-answer-tile-label {
  font-size: 0.65rem;
  color: var(--color-text);
  margin-top: 3px;
  opacity: 0.6;
  font-family: var(--font-body), sans-serif;
}
.wt-suit-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text);
  opacity: 0.55;
  margin-bottom: 0.25rem;
}
.wt-verdict {
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
}
.wt-verdict--perfect { color: var(--color-han-1); }
.wt-verdict--partial  { color: var(--color-han-5); }
.wt-verdict--wrong    { color: var(--color-yakuman); }
.wt-phantom-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}
.wt-answer-tile:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Options bar */
.wt-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.wt-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}
.wt-toggle span {
  font-weight: 600;
}
.wt-toggle input[type="checkbox"] {
  accent-color: var(--color-accent, #e8872e);
  margin: 0;
  width: 15px;
  height: 15px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  cursor: pointer;
}
.wt-toggle input[type="checkbox"]:checked + span {
  color: var(--color-text);
  font-weight: 700;
}

/* ===== EFFICIENCY TRAINER ===== */

.et-debug {
  margin-top: 0.5rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--color-text);
  opacity: 0.55;
  word-break: break-all;
}

.et-hand-area {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0;
}
.et-hand-group {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
}
.et-draw-separator {
  display: inline-block;
  width: 16px;
}
.et-hand-waiting .tile-img {
  opacity: 0.6;
  cursor: default;
}
.et-draw-group {
  display: flex;
  align-items: flex-end;
}

.et-hand-tile {
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: flex-end;
}
.et-hand-tile:hover {
  transform: translateY(-4px);
}

/* Options bar */
.et-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.et-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}
.et-toggle span {
  font-weight: 600;
}
.et-toggle input[type="checkbox"] {
  accent-color: var(--color-accent, #e8872e);
  margin: 0;
  width: 15px;
  height: 15px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  cursor: pointer;
}
.et-toggle input[type="checkbox"]:checked + span {
  color: var(--color-text);
  font-weight: 700;
}

/* Pond (discarded tiles above the hand) */
.et-pond {
  display: grid;
  grid-template-columns: repeat(6, 40px);
  grid-template-rows: repeat(3, 53px);
  gap: 2px;
  justify-content: center;
  margin: 0 auto 1rem;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-alt);
  width: fit-content;
}
.et-pond .tile-img {
  width: 40px;
  height: 53px;
}
@media (max-width: 600px) {
  .et-pond {
    grid-template-columns: repeat(6, 32px);
    grid-template-rows: repeat(3, 43px);
  }
  .et-pond .tile-img {
    width: 32px;
    height: 43px;
  }
}

/* Ponds area — default: no special layout */
.et-ponds-area {
  margin-bottom: 1rem;
}

/* Cross layout for 4 ponds: Across on top, Left/Right in middle, User on bottom */
.et-ponds-cross {
  display: grid;
  grid-template-areas:
    ".    center ."
    "left .      right"
    ".    self   .";
  grid-template-columns: auto auto auto;
  gap: 0.75rem 1rem;
  justify-content: center;
  justify-items: center;
  align-items: center;
}
.et-ponds-cross .et-pond-wrap--kamicha  { grid-area: left; }
.et-ponds-cross .et-pond-wrap--toimen   { grid-area: center; }
.et-ponds-cross .et-pond-wrap--shimocha { grid-area: right; }
.et-ponds-cross .et-pond-wrap--self     { grid-area: self; }

.et-pond-wrap {
  text-align: center;
}
.et-pond-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

/* Opponent ponds — base (center/toimen: upside-down tiles, normal grid) */
.et-pond-other {
  display: grid;
  grid-template-columns: repeat(6, 30px);
  grid-template-rows: repeat(3, 40px);
  gap: 1px;
  justify-content: center;
  padding: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-alt);
  width: fit-content;
}
.et-pond-other .tile-img {
  width: 30px;
  height: 40px;
  border-width: 1px;
}

/* Center player (toimen) — tiles upside down */
.et-pond-toimen .tile-img {
  transform: rotate(180deg);
}

/* Left player (kamicha) — 90° CW: 3-col × 6-row grid, tiles rotated 90° CW */
/* 30×40 tile rotated → visual 40×30, cells 40w × 30h */
.et-pond-kamicha {
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(6, 30px);
}
.et-pond-kamicha .tile-img {
  transform: rotate(90deg);
  margin: -5px 5px;
}

/* Right player (shimocha) — 90° CCW: 3-col × 6-row grid, tiles rotated 90° CCW */
.et-pond-shimocha {
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(6, 30px);
}
.et-pond-shimocha .tile-img {
  transform: rotate(-90deg);
  margin: -5px 5px;
}

@media (max-width: 600px) {
  .et-pond-other {
    grid-template-columns: repeat(6, 24px);
    grid-template-rows: repeat(3, 32px);
  }
  .et-pond-other .tile-img {
    width: 24px;
    height: 32px;
  }
  /* 24×32 rotated → visual 32×24; margin = (32-24)/2 = 4 */
  .et-pond-kamicha,
  .et-pond-shimocha {
    grid-template-columns: repeat(3, 32px);
    grid-template-rows: repeat(6, 24px);
  }
  .et-pond-kamicha .tile-img,
  .et-pond-shimocha .tile-img {
    margin: -4px 4px;
  }
}

/* Big tiles mode — opponent ponds */
.et-big-tiles .et-pond-other {
  grid-template-columns: repeat(6, 40px);
  grid-template-rows: repeat(3, 53px);
}
.et-big-tiles .et-pond-other .tile-img {
  width: 40px;
  height: 53px;
  border-width: 2px;
}
/* 40×53 rotated → visual 53×40; margin = (53-40)/2 = 6.5 */
.et-big-tiles .et-pond-kamicha,
.et-big-tiles .et-pond-shimocha {
  grid-template-columns: repeat(3, 53px);
  grid-template-rows: repeat(6, 40px);
}
.et-big-tiles .et-pond-kamicha .tile-img,
.et-big-tiles .et-pond-shimocha .tile-img {
  margin: -6.5px 6.5px;
}
@media (max-width: 600px) {
  .et-big-tiles .et-pond-other {
    grid-template-columns: repeat(6, 30px);
    grid-template-rows: repeat(3, 40px);
  }
  .et-big-tiles .et-pond-other .tile-img {
    width: 30px;
    height: 40px;
    border-width: 1px;
  }
  /* 30×40 rotated → visual 40×30; margin = 5 */
  .et-big-tiles .et-pond-kamicha,
  .et-big-tiles .et-pond-shimocha {
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(6, 30px);
  }
  .et-big-tiles .et-pond-kamicha .tile-img,
  .et-big-tiles .et-pond-shimocha .tile-img {
    margin: -5px 5px;
  }
}

/* Big tiles mode */
.et-big-tiles .et-hand-area .tile-img {
  width: 56px;
  height: 74px;
}
.et-big-tiles .et-pond {
  grid-template-columns: repeat(6, 56px);
  grid-template-rows: repeat(3, 74px);
}
.et-big-tiles .et-pond .tile-img {
  width: 56px;
  height: 74px;
}
.et-big-tiles .et-log-hand .tile-img {
  width: 40px;
  height: 53px;
  border-width: 2px;
}
@media (max-width: 600px) {
  .et-big-tiles .et-hand-area .tile-img {
    width: 44px;
    height: 58px;
  }
  .et-big-tiles .et-pond {
    grid-template-columns: repeat(6, 44px);
    grid-template-rows: repeat(3, 58px);
  }
  .et-big-tiles .et-pond .tile-img {
    width: 44px;
    height: 58px;
  }
  .et-big-tiles .et-log-hand .tile-img {
    width: 32px;
    height: 43px;
  }
}

/* Shanten display */
.et-shanten {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  text-align: center;
}

/* Log entry hand snapshot */
.et-log-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  width: 100%;
  padding-top: 0.3rem;
  border-top: 1px solid var(--color-border);
}
.et-log-hand .tile-img {
  width: 28px;
  height: 37px;
  border-width: 1px;
}
.et-log-show-hand {
  font-size: 0.75rem;
  color: var(--color-text);
  cursor: pointer;
  text-decoration: underline;
  margin-left: auto;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  opacity: 0.7;
}
.et-log-show-hand:hover {
  opacity: 1;
}

/* Discard log */
.et-log {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.et-log-entry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}
.et-log-entry--green  { background: rgba(56, 128, 58, 0.15); }
.et-log-entry--yellow { background: rgba(200, 160, 40, 0.15); }
.et-log-entry--red    { background: rgba(192, 48, 48, 0.15); }
.et-log-turn {
  font-weight: 600;
  min-width: 1.8em;
}
.et-log-ukeire {
  white-space: nowrap;
}
.et-log-best {
  font-size: 0.85rem;
  opacity: 0.75;
}

/* Log legend */
.et-log-legend {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg-alt);
  border-radius: 4px;
  font-size: 0.9rem;
}
.et-log-legend-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.et-log-legend-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.et-log-legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.et-log-legend-list li:last-child {
  margin-bottom: 0;
}
.et-legend-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.et-legend-swatch--green  { background: rgba(56, 128, 58, 0.15); border: 1px solid rgba(56, 128, 58, 0.4); }
.et-legend-swatch--yellow { background: rgba(200, 160, 40, 0.15); border: 1px solid rgba(200, 160, 40, 0.4); }
.et-legend-swatch--red    { background: rgba(192, 48, 48, 0.15); border: 1px solid rgba(192, 48, 48, 0.4); }

/* End screen */
.et-result {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}
.et-result-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}
.et-result-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.et-tenpai-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
}
.et-result-stats {
  font-size: 0.95rem;
}
.et-stat {
  margin: 0.2rem 0;
}
.et-stat--rating {
  margin-top: 0.6rem;
  font-weight: 600;
  color: var(--color-accent);
}

@media (max-width: 600px) {
  .et-draw-separator { width: 10px; }
  .et-log-entry { font-size: 0.8rem; gap: 0.25rem; padding: 0.25rem 0.4rem; }
}

/* Dark mode: stronger log entry colors for distinguishability */
@media (prefers-color-scheme: dark) {
  .tile-img {
    border-color: rgba(255, 255, 255, 0.4);
  }
  .et-log-entry--green  { background: rgba(56, 180, 58, 0.25); border-left: 3px solid rgba(56, 180, 58, 0.7); }
  .et-log-entry--yellow { background: rgba(220, 180, 40, 0.2); border-left: 3px solid rgba(220, 180, 40, 0.7); }
  .et-log-entry--red    { background: rgba(220, 60, 60, 0.2); border-left: 3px solid rgba(220, 60, 60, 0.7); }
  .et-legend-swatch--green  { background: rgba(56, 180, 58, 0.25); border-color: rgba(56, 180, 58, 0.7); }
  .et-legend-swatch--yellow { background: rgba(220, 180, 40, 0.2); border-color: rgba(220, 180, 40, 0.7); }
  .et-legend-swatch--red    { background: rgba(220, 60, 60, 0.2); border-color: rgba(220, 60, 60, 0.7); }
}

/* ===== WAITS TRAINER BIG TILES ===== */
.wt-big-tiles .trainer-row-value .tile-img {
  width: 56px;
  height: 74px;
}
.wt-big-tiles .wt-tile-selector .tile-img {
  width: 56px;
  height: 74px;
}
@media (max-width: 600px) {
  .wt-big-tiles .trainer-row-value .tile-img {
    width: 44px;
    height: 58px;
  }
  .wt-big-tiles .wt-tile-selector .tile-img {
    width: 44px;
    height: 58px;
  }
}

/* ===== SCORE TRAINER BIG TILES ===== */
.st-big-tiles .trainer-row-value .tile-img {
  width: 56px;
  height: 74px;
}
.st-big-tiles .tile-call-group .tile-img {
  width: 56px;
  height: 74px;
  margin: -9px 9px;
}
@media (max-width: 600px) {
  .st-big-tiles .trainer-row-value .tile-img {
    width: 44px;
    height: 58px;
  }
  .st-big-tiles .tile-call-group .tile-img {
    width: 44px;
    height: 58px;
    margin: -7px 7px;
  }
}

/* ===== FOCUS-VISIBLE STYLES ===== */
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.feature-card:focus-visible,
.gallery img:focus-visible,
.photo-grid img:focus-visible,
.next-step-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

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

/* ===== PRINT ===== */
@media print {
  /* Hide navigation and footer */
  .site-header,
  .site-footer,
  .nav-toggle,
  .main-nav {
    display: none !important;
  }

  /* Hide interactive elements */
  .btn,
  button,
  .lightbox-close,
  #lightbox {
    display: none !important;
  }

  /* Remove backgrounds, optimize for ink */
  body {
    background: #ffffff;
    color: #000000;
  }
  .hero,
  .features-band,
  .features,
  .feature-card,
  .page-content,
  .gallery,
  .photo-grid,
  .event-row {
    background: transparent !important;
  }

  /* Simplify spacing for paper */
  .page-content {
    padding: 0;
    margin: 0;
  }
  hr {
    margin: 1.5rem 0;
    border: 1px solid #cccccc;
    border-top: none;
  }

  /* Improve readability */
  h1, h2, h3, h4 {
    page-break-after: avoid;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  p {
    orphans: 3;
    widows: 3;
    page-break-inside: avoid;
  }

  /* Content sections should stay together when possible */
  .content-section {
    page-break-inside: avoid;
  }

  /* Show URLs for links */
  a[href]:not([href^="#"])::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555555;
    word-break: break-all;
  }

  /* Hide gallery, photo grids, and image strips */
  .gallery,
  .photo-grid,
  .lightbox,
  .community-strip {
    display: none !important;
  }

  /* Hero background image: make text readable on paper */
  .hero--home {
    background: transparent !important;
    color: #000 !important;
    min-height: 0 !important;
  }
  .hero--home .hero-text,
  .hero--home .hero-text h1,
  .hero--home .hero-text p {
    color: #000 !important;
  }

  /* Tables */
  table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  tr {
    page-break-inside: avoid;
  }
}
