/* ================================================================
   3F GAME — SHARED CSS (All Pages)
   Mobile First | Dark Mode | Responsive | Accessible
   ================================================================ */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --hdr-h: 60px;
  --max-w: 1100px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --trans: 0.28s cubic-bezier(.4,0,.2,1);
  --shadow: 0 4px 20px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.18);
}

/* ── GLOBAL RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  font-family: var(--font);
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  line-height: 1.78;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
img { max-width: 100%; height: auto; display: block; }
a { transition: color var(--trans); }
button { cursor: pointer; font-family: var(--font); }

/* ── SKIP LINK ── */
.skip-link {
  position: absolute; top: -120px; left: 16px;
  background: #e94560; color: #fff;
  padding: 10px 20px; border-radius: var(--radius-sm);
  z-index: 9999; font-weight: 700; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* ── READING PROGRESS BAR ── */
#reading-progress {
  position: fixed; top: 0; left: 0; width: 0%;
  height: 3px; z-index: 10000;
  border-radius: 0 2px 2px 0;
  transition: width 0.1s linear;
}

/* ── PAGE LOADER ── */
.page-loader {
  position: fixed; inset: 0;
  background: #0f3460; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo { font-size: 2.2rem; font-weight: 900; color: #fff; animation: ldr 1s ease-in-out infinite; }
.loader-logo span { color: #f5a623; }
@keyframes ldr { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 900;
  height: var(--hdr-h);
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header__inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 20px; height: 100%;
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.site-header__logo { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 900; text-decoration: none; letter-spacing: 1px; flex-shrink: 0; }
.site-header__nav { display: flex; align-items: center; gap: 2px; }
.site-header__nav a {
  text-decoration: none; padding: 8px 11px;
  font-size: 0.87rem; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}

/* ── HEADER CONTROLS ── */
.header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-btn, .hamburger {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.1); color: #fff;
  transition: background var(--trans);
}
.theme-btn:hover, .hamburger:hover { background: rgba(255,255,255,.2); }
.hamburger { flex-direction: column; justify-content: center; gap: 5px; padding: 10px; display: none; }
.hamburger span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; transition: transform var(--trans), opacity var(--trans); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── OFF-CANVAS MENU ── */
.mobile-menu {
  position: fixed; top: var(--hdr-h); right: -100%;
  width: min(300px, 85vw); height: calc(100dvh - var(--hdr-h));
  background: #fff; z-index: 850;
  padding: 20px 16px; display: flex;
  flex-direction: column; gap: 6px;
  box-shadow: -4px 0 30px rgba(0,0,0,.2);
  transition: right var(--trans); overflow-y: auto;
}
.mobile-menu.open { right: 0; }
.mobile-menu a {
  text-decoration: none; padding: 12px 14px;
  font-weight: 600; font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid #e0e7f0;
  display: flex; align-items: center; gap: 8px;
  min-height: 48px;
  color: #1a1a2e;
  transition: background var(--trans), color var(--trans);
}
.mobile-menu a:hover { background: #f4f6fb; }
.menu-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 840;
  backdrop-filter: blur(4px);
}
.menu-overlay.open { display: block; }

/* ── BREADCRUMB ── */
.breadcrumb { padding: 10px 20px; font-size: 0.8rem; }
.breadcrumb__inner { max-width: var(--max-w); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.breadcrumb a { text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 2px; }

/* ── HERO ── */
.hero {
  padding: clamp(44px, 8vw, 80px) 20px clamp(40px, 7vw, 70px);
  text-align: center; position: relative; overflow: hidden;
}
.hero__inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.hero__badge {
  display: inline-block; font-size: 0.76rem; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 5px 16px; border-radius: 30px; margin-bottom: 18px;
}
.hero__title { font-size: clamp(1.65rem, 5vw, 2.9rem); font-weight: 900; line-height: 1.18; margin-bottom: 14px; }
.hero__meta { font-size: 0.83rem; margin-bottom: 18px; }
.hero__desc { font-size: clamp(0.93rem, 2vw, 1.06rem); max-width: 620px; margin: 0 auto 30px; }
.hero__cta-group { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 26px; border-radius: var(--radius-sm);
  font-size: 0.94rem; font-weight: 700; text-decoration: none;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.18s, box-shadow 0.18s, background 0.2s;
  letter-spacing: 0.3px; min-height: 48px;
  position: relative; overflow: hidden; user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid #f5a623; outline-offset: 3px; }
.btn--lg { padding: 15px 34px; font-size: 1.03rem; border-radius: var(--radius); }
.btn--sm { padding: 9px 18px; font-size: 0.84rem; min-height: 40px; }
.btn--block { display: flex; width: 100%; }
/* Ripple */
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.3); transform: scale(0); animation: ripple 0.55s linear; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ── RESPONSIVE IMAGES ── */
.img-wrap {
  width: 100%; border-radius: var(--radius);
  overflow: hidden; margin: 22px 0;
  position: relative;
  background: #e0e7f0;
}
.img-wrap img {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius);
  object-fit: cover; object-position: center;
  aspect-ratio: 16/9;
  transition: transform 0.4s ease;
}
.img-wrap:hover img { transform: scale(1.02); }
.img-wrap figcaption {
  font-size: 0.8rem; color: #777;
  text-align: center; padding: 8px 12px;
  font-style: italic; background: #fff;
}
/* Backward compat: old .img-placeholder classes */
.img-placeholder { width: 100%; border-radius: var(--radius); overflow: hidden; margin: 22px 0; }
.img-placeholder img { width: 100%; max-width: 100%; height: auto; display: block; border-radius: var(--radius); object-fit: cover; aspect-ratio: 16/9; }
.img-placeholder__caption { font-size: 0.8rem; color: #777; text-align: center; margin-top: 6px; margin-bottom: 14px; font-style: italic; }
.img-placeholder__box { display: none; } /* Hide empty placeholder boxes */

/* ── MAIN LAYOUT ── */
.main-wrapper {
  max-width: var(--max-w); margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(12px, 3vw, 20px);
  display: grid; grid-template-columns: 1fr 300px;
  gap: 28px; align-items: start;
}
@media (max-width: 900px) { .main-wrapper { grid-template-columns: 1fr; } }

/* ── ARTICLE ── */
.article-content {
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 36px);
  min-width: 0;
}
.article-content h2 { font-size: clamp(1.18rem, 3vw, 1.5rem); font-weight: 800; margin: clamp(28px, 4vw, 40px) 0 14px; padding-bottom: 9px; border-bottom: 3px solid; scroll-margin-top: calc(var(--hdr-h) + 12px); }
.article-content h3 { font-size: clamp(1rem, 2vw, 1.18rem); font-weight: 700; margin: 22px 0 10px; }
.article-content p { margin-bottom: 16px; max-width: 72ch; line-height: 1.8; }
.article-content ul, .article-content ol { margin: 10px 0 18px 22px; }
.article-content li { margin-bottom: 8px; line-height: 1.7; }
.article-content a { text-decoration: underline; font-weight: 600; }
.article-content strong { }

/* ── DIRECT ANSWER ── */
.direct-answer { border-left: 5px solid; border-radius: var(--radius-sm); padding: 20px 22px; margin: 0 0 28px; }
.direct-answer__label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px; }
.direct-answer p { font-size: 1rem; margin: 0; max-width: 100%; }

/* ── INFO BOXES ── */
.info-box { border-radius: var(--radius); padding: 18px 20px; margin: 22px 0; border-left: 5px solid; }
.info-box__title { font-weight: 800; margin-bottom: 8px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.info-box p { margin: 0 !important; font-size: 0.95rem; }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; margin: 24px 0; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
.comparison-table thead th { padding: 13px 16px; text-align: left; font-weight: 700; white-space: nowrap; }
.comparison-table tbody tr { border-bottom-width: 1px; border-bottom-style: solid; transition: background var(--trans); }
.comparison-table td { padding: 12px 16px; }
.comparison-table td:first-child { font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }

/* ── STEPS LIST ── */
.steps-list { list-style: none; margin: 16px 0 24px; padding: 0; }
.steps-list li { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; padding: 15px 17px; border-radius: var(--radius-sm); border-left: 4px solid; transition: transform 0.2s; }
.steps-list li:hover { transform: translateX(4px); }
.steps-list__num { min-width: 32px; height: 32px; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.88rem; flex-shrink: 0; }
.steps-list__text { line-height: 1.65; }

/* ── FAQ ── */
.faq-section { margin: 36px 0 0; }
.faq-item { border: 1px solid; border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.faq-item__question { padding: 16px 20px; font-weight: 700; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 0.97rem; border: none; width: 100%; text-align: left; transition: background var(--trans); gap: 12px; min-height: 54px; }
.faq-arrow { font-size: 1rem; transition: transform var(--trans); flex-shrink: 0; }
.faq-item__answer { max-height: 0; overflow: hidden; border-top: 1px solid; transition: max-height 0.4s ease; }
.faq-item__answer-inner { padding: 16px 20px; line-height: 1.75; }
.faq-item.open .faq-item__answer { max-height: 600px; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }

/* ── SIDEBAR ── */
.sidebar { position: sticky; top: calc(var(--hdr-h) + 16px); display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 900px) { .sidebar { position: static; } }
.sidebar-card { border-radius: var(--radius); padding: 20px 18px; border: 1px solid; }
.sidebar-card__title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.3px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid; }
.sidebar-card ul { list-style: none; padding: 0; margin: 0; }
.sidebar-card ul li { padding: 8px 0; border-bottom: 1px solid; font-size: 0.88rem; display: flex; align-items: center; gap: 5px; }
.sidebar-card ul li:last-child { border-bottom: none; }
.sidebar-card ul li::before { font-size: 0.6rem; flex-shrink: 0; }
.sidebar-card ul li a { text-decoration: none; font-weight: 600; transition: color var(--trans); }

/* ── QUICK FACTS ── */
.quick-facts dt { font-weight: 700; font-size: 0.85rem; margin-top: 10px; }
.quick-facts dd { font-size: 0.85rem; margin-left: 0; margin-bottom: 2px; }

/* ── RATING ── */
.rating-block { text-align: center; padding: 10px 0 14px; }
.rating-block__stars { font-size: 1.8rem; color: #f5a623; letter-spacing: 2px; }
.rating-block__score { font-size: 2rem; font-weight: 900; }
.rating-block__count { font-size: 0.8rem; }

/* ── CTA BANNER ── */
.cta-banner { border-radius: var(--radius); padding: clamp(22px, 4vw, 36px) clamp(18px, 4vw, 32px); text-align: center; margin: 32px 0; position: relative; overflow: hidden; }
.cta-banner h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); margin-bottom: 8px; position: relative; }
.cta-banner p { margin-bottom: 20px; max-width: 100%; position: relative; }
.cta-banner .btn-group { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }

/* ── SECTION DIVIDER ── */
.section-divider { height: 3px; border: none; border-radius: 2px; margin: 36px 0; }

/* ── HIGHLIGHTS GRID ── */
.highlights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.highlight-card { border-radius: var(--radius); padding: 16px 12px; text-align: center; border: 1px solid; transition: transform 0.25s, box-shadow 0.25s; }
.highlight-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.highlight-card__icon { font-size: 1.65rem; margin-bottom: 6px; }
.highlight-card__value { font-size: 1.12rem; font-weight: 900; }
.highlight-card__label { font-size: 0.73rem; margin-top: 2px; }

/* ── FOOTER ── */
.site-footer { padding: clamp(28px, 5vw, 48px) 20px; font-size: 0.87rem; line-height: 1.8; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; margin-bottom: 32px; text-align: left; }
.footer-col h4 { font-weight: 700; margin-bottom: 12px; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 1px; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { text-decoration: none; font-size: 0.85rem; transition: color var(--trans); }
.footer-social { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.social-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1rem; transition: background var(--trans), color var(--trans); }
.footer-bottom { border-top-width: 1px; border-top-style: solid; padding-top: 20px; text-align: center; font-size: 0.8rem; }
.footer-bottom a { text-decoration: none; }
.footer-bottom a:hover { text-decoration: underline; }

/* ── DISCLAIMER ── */
.disclaimer { font-size: 0.79rem; padding: 16px 20px; text-align: center; line-height: 1.7; }

/* ── SCROLL TO TOP ── */
#scroll-top {
  position: fixed; bottom: 20px; right: calc(20px + env(safe-area-inset-right));
  width: 46px; height: 46px; border-radius: 50%;
  color: #fff; border: none; font-size: 1.2rem;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.2); z-index: 800;
  transition: transform 0.2s, opacity 0.3s;
}
#scroll-top.visible { display: flex; }
#scroll-top:hover { transform: translateY(-3px); }

/* ── STICKY DOWNLOAD ── */
.sticky-download { position: fixed; bottom: 76px; right: calc(20px + env(safe-area-inset-right)); z-index: 800; display: none; }
.sticky-download.visible { display: block; }
.sticky-download .btn { border-radius: 50px; animation: float-btn 3s ease-in-out infinite; }
@keyframes float-btn { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }

/* ── SHARE BAR ── */
.share-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 24px 0; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.share-bar span { font-size: 0.83rem; font-weight: 700; margin-right: 2px; }
.share-btn { min-height: 36px; padding: 6px 13px; border-radius: 30px; font-size: 0.8rem; font-weight: 700; border: 1px solid; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }

/* ── SCROLL REVEAL ANIMATIONS ── */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-scale { opacity: 0; transform: scale(0.94); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* ── SAFE AREA (iPhone notch) ── */
.site-header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.site-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .site-header__nav { display: none; }
  .hamburger { display: flex; }
}
@media (max-width: 480px) {
  .hero__cta-group { flex-direction: column; align-items: center; }
  .hero__cta-group .btn { width: 100%; max-width: 300px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .cta-banner .btn-group { flex-direction: column; align-items: center; }
  .cta-banner .btn-group .btn { width: 100%; max-width: 280px; }
}
@media (max-width: 360px) {
  .footer-grid { grid-template-columns: 1fr; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .hero { padding: 28px 20px; }
  .hero__title { font-size: 1.5rem; }
}
@media (min-width: 1920px) { :root { --max-w: 1300px; } html { font-size: 18px; } }
@media (min-width: 2560px) { :root { --max-w: 1600px; } html { font-size: 20px; } }

/* ── PRINT ── */
@media print {
  .site-header, .sidebar, .sticky-download, #scroll-top, #reading-progress, .mobile-menu, .menu-overlay, .share-bar, .page-loader { display: none !important; }
  .main-wrapper { grid-template-columns: 1fr; }
  body { font-size: 12pt; }
  .article-content { box-shadow: none; padding: 0; }
  .btn { display: none; }
}

/* ── FOCUS ── */
:focus-visible { outline: 3px solid #f5a623; outline-offset: 3px; border-radius: 4px; }

/* ── SHARED SCRIPT INJECTOR MARKER ── */
.shared-ready { display: none; }
