#app{
  /* --- Brand colors (refined from #E3405F) --- */
  --brand-50:  #fff1f3;
  --brand-100: #ffe0e5;
  --brand-200: #ffc2cc;
  --brand-400: #ef5470;
  --brand-500: #e3405f;   /* original primary, kept for continuity */
  --brand-600: #c62c4a;
  --brand-700: #a11f3a;

  --accent-orange-100: #ffe9dc;
  --accent-orange-400: #ff9457;

  --success-500: #16a34a;
  --success-600: #128a3e;
  --danger-500:  #dc2626;
  --danger-600:  #b91c1c;

  --ink-900: #1a1a1a;
  --ink-700: #3a3a3f;
  --ink-500: #6b7280;
  --ink-400: #9ca3af;
  --ink-200: #e5e7eb;
  --ink-100: #f1f2f5;
  --ink-50:  #f8f9fb;

  --surface: #ffffff;
  --surface-soft: #fbfbfd;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20,20,30,.06);
  --shadow-md: 0 8px 24px rgba(20,20,30,.08);
  --shadow-lg: 0 16px 40px rgba(20,20,30,.12);
  --shadow-brand: 0 10px 24px rgba(227,64,95,.28);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font-sans: "Inter", "Noto Sans HK", "PingFang HK", "Microsoft JhengHei", -apple-system, sans-serif;
  --font-mono: "Doulos SIL", "Charis SIL", "Noto Sans Mono", ui-monospace, monospace;

  --ease: cubic-bezier(.4,0,.2,1);
}#app /* ---------- Base ---------- */
*{ box-sizing: border-box; }#app{
  font-family: var(--font-sans);
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-900);
  padding: var(--space-6) var(--space-4);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}#app a{ color: var(--brand-600); text-decoration: none; }#app a:hover{ text-decoration: underline; }#app ::selection{ background: var(--brand-200); color: var(--ink-900); }#app /* Visible focus ring everywhere,
#app for accessibility */
:focus-visible{
  outline: 3px solid var(--brand-200);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}#app /* ---------- Main card / container ---------- */
.jyutpairs-container{
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6) var(--space-5);
  width: 100%;
  max-width: 520px;
  text-align: center;
  border: 1px solid var(--ink-100);
  animation: rise .45s var(--ease);
}

@keyframes rise{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}#app .site-name{
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}#app h1{
  font-size: 17px;
  margin-bottom: var(--space-1);
  color: var(--ink-700);
  font-weight: 700;
}#app h2{
  font-size: 15px;
  color: var(--ink-500);
  margin-top: 0;
  margin-bottom: var(--space-5);
  font-weight: 400;
}#app /* ---------- Form elements ---------- */
label{
  display: block;
  text-align: left;
  font-size: 13px;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  color: var(--ink-700);
  font-weight: 600;
  letter-spacing: .2px;
}#app select,
#app input[type="number"],
#app input[type="text"],
#app input[type="email"]{
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ink-200);
  font-size: 15px;
  background: var(--surface-soft);
  color: var(--ink-900);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
  font-family: inherit;
}#app select:hover,
#app input:hover{ border-color: var(--ink-400); }#app select:focus,
#app input:focus{
  outline: none;
  border-color: var(--brand-500);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-100);
}#app .pair-row{ display: flex; gap: var(--space-3); }#app .pair-row select{ flex: 1; }#app /* ---------- Buttons ---------- */
button{ font-family: inherit; }#app button.primary{
  margin-top: var(--space-6);
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
}#app button.primary:hover:not(:disabled){ transform: translateY(-2px); filter: brightness(1.04); }#app button.primary:active:not(:disabled){ transform: translateY(0); }#app button.primary:disabled{
  background: var(--ink-200); color: var(--ink-400);
  box-shadow: none; cursor: not-allowed;
}#app button.next{
  margin-top: var(--space-5);
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(22,163,74,.25);
  transition: transform .15s var(--ease), filter .15s var(--ease);
}#app button.next:hover{ transform: translateY(-2px); filter: brightness(1.05); }#app .backbtn{
  margin-top: var(--space-2);
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}#app .backbtn:hover{ background: var(--ink-50); border-color: var(--ink-400); }#app .reviewbtn{
  margin-top: var(--space-2);
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--brand-200);
  transition: background .15s var(--ease);
}#app .reviewbtn:hover{ background: var(--brand-100); }#app .mode-change-btn{
  border: none;
  background: var(--brand-500);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .15s var(--ease);
}#app .mode-change-btn:hover{ background: var(--brand-600); }#app /* ---------- Hints / meta text ---------- */
.hint{ font-size: 12px; color: var(--ink-400); margin-top: var(--space-2); text-align: left; }#app .progress{
  font-size: 13px; font-weight: 600; color: var(--ink-500);
  margin-bottom: var(--space-3); letter-spacing: .3px;
}#app .small-note{ font-size: 12px; color: var(--ink-400); margin-top: var(--space-2); text-align: left; }#app .brand{ font-size: 12px; color: var(--ink-400); margin-top: var(--space-5); }#app .quiz-info{
  background: var(--brand-50);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  text-align: left;
  border: 1px solid var(--brand-100);
}#app .quiz-info-row{
  font-size: 13px; color: var(--ink-700);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); padding: 3px 0; font-weight: 500;
}#app /* ---------- Quiz question ---------- */
.char-display{
  font-size: 76px;
  font-weight: 800;
  margin: var(--space-6) 0 var(--space-2);
  color: var(--ink-900);
  line-height: 1;
  letter-spacing: 1px;
}#app .readings-list{ font-size: 13px; color: var(--ink-400); margin-bottom: var(--space-5); }#app .question-row{
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); margin: var(--space-6) 0 var(--space-2);
}#app .question-row .char-display{ margin: 0; flex: 1; text-align: center; }#app .options{ display: flex; flex-direction: column; gap: var(--space-3); }#app .opt-btn{
  padding: 17px;
  border-radius: var(--radius-md);
  border: 2px solid var(--ink-200);
  background: var(--surface-soft);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s var(--ease);
  font-family: var(--font-mono);
  text-align: center;
  color: var(--ink-900);
}#app .opt-btn:hover:not(:disabled){
  border-color: var(--brand-500);
  background: var(--brand-50);
  transform: translateY(-1px);
}#app .opt-btn:disabled{ cursor: default; }#app .opt-btn.correct{
  background: var(--success-500) !important;
  border-color: var(--success-500) !important;
  color: #fff !important;
  animation: pop .25s var(--ease);
}#app .opt-btn.wrong{
  background: var(--danger-500) !important;
  border-color: var(--danger-500) !important;
  color: #fff !important;
  animation: shake .3s var(--ease);
}

@keyframes pop{ 0%{transform:scale(1);} 50%{transform:scale(1.03);} 100%{transform:scale(1);} }
@keyframes shake{ 0%,100%{transform:translateX(0);} 25%{transform:translateX(-4px);} 75%{transform:translateX(4px);} }#app .audio-option-row{ display: flex; align-items: center; gap: var(--space-3); }#app .audio-option-row .opt-btn{ flex: 1; text-align: center; }#app .audio-icon-btn{
  width: 48px; height: 48px; min-width: 48px;
  border-radius: 50%;
  border: 2px solid var(--brand-500);
  background: var(--surface);
  color: var(--brand-500);
  font-size: 20px;
  cursor: pointer;
  transition: all .15s var(--ease);
  display: flex; align-items: center; justify-content: center;
}#app .audio-icon-btn:hover:not(:disabled){ background: var(--brand-50); transform: scale(1.05); }#app .audio-icon-btn:disabled{ border-color: var(--ink-200); color: var(--ink-400); cursor: default; }#app .audio-play-btn{
  width: 100%;
  max-width: 320px;
  height: 84px;
  min-width: 100px;
  padding: 13px;
  border-radius: var(--radius-md);
  border: 2px solid var(--brand-500);
  background: var(--surface);
  color: var(--brand-500);
  font-size: 28px;
  cursor: pointer;
  transition: all .15s var(--ease);
  margin: var(--space-6) auto var(--space-5);
  display: block;
  box-shadow: var(--shadow-sm);
}#app .audio-play-btn:hover:not(:disabled){ background: var(--brand-50); transform: translateY(-2px); }#app .audio-play-btn:disabled{ border-color: var(--ink-200); color: var(--ink-400); cursor: default; }#app .audio-toggle-item{ display: flex; flex-direction: column; align-items: center; gap: var(--space-1); flex-shrink: 0; }#app .audio-toggle-label{ font-size: 11px; color: var(--ink-400); font-weight: 600; margin: 0; white-space: nowrap; }#app /* ---------- Toggles ---------- */
.toggle-row{ display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-4); }#app .toggle-row label{ margin: 0; }#app .dual-toggle-row{ gap: var(--space-7); justify-content: center; flex-wrap: wrap; }#app .toggle-item{ display: flex; align-items: center; gap: var(--space-2); justify-content: center; }#app .toggle-item label{ font-size: 13px; color: var(--ink-700); font-weight: 600; white-space: nowrap; }#app .switch{ position: relative; display: inline-block; width: 46px; height: 24px; flex-shrink: 0; }#app .switch input{ opacity: 0; width: 0; height: 0; }#app .slider{
  position: absolute; cursor: pointer; inset: 0;
  background-color: var(--ink-200);
  transition: background-color .2s var(--ease);
  border-radius: 24px;
}#app .slider::before{
  position: absolute; content: "";
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease);
  border-radius: 50%;
}#app input:checked + .slider{ background-color: var(--brand-500); }#app input:checked + .slider::before{ transform: translateX(22px); }#app /* ---------- Difficulty slider ---------- */
.difficulty-slider{
  position: relative;
  display: flex;
  background: var(--ink-100);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-top: var(--space-1);
}#app .difficulty-track{
  position: absolute;
  top: 4px; bottom: 4px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  border-radius: var(--radius-sm);
  transition: left .25s var(--ease), width .25s var(--ease);
  z-index: 0;
  box-shadow: var(--shadow-brand);
}#app .diff-btn{
  position: relative; z-index: 1; flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-500);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color .2s var(--ease);
}#app .diff-btn.active{ color: #fff; }#app /* ---------- Score / result ---------- */
.score-box{ font-size: 44px; font-weight: 800; margin: var(--space-5) 0 var(--space-1); color: var(--brand-600); }#app .score-label{ color: var(--ink-500); font-size: 14px; margin-bottom: var(--space-3); }#app .score-comment{ font-size: 19px; font-weight: 700; margin-bottom: var(--space-6); color: var(--ink-900); }#app .leaderboard-submit{
  text-align: left;
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-100);
}#app .leaderboard-submit label{ display: block; font-size: 13px; color: var(--ink-700); margin-bottom: var(--space-2); }#app .leaderboard-submit input{ box-sizing: border-box; }#app /* ---------- Review list ---------- */
.review-item{
  text-align: left;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}#app .review-char{ font-size: 28px; font-weight: 700; margin-bottom: var(--space-2); color: var(--ink-900); }#app .review-opt{ font-size: 15px; padding: 4px 0; color: var(--ink-500); }#app .review-opt.correct{ color: var(--success-600); font-weight: 700; }#app .review-opt.wrong{ color: var(--danger-600); font-weight: 700; }#app .review-header{ font-size: 12px; color: var(--ink-400); margin-bottom: var(--space-1); font-weight: 600; }#app .review-title-row{ display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-1); margin-bottom: var(--space-1); }#app .review-filter-label{ display: flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--ink-700); font-weight: 600; cursor: pointer; }#app .review-filter-label input{ width: auto; margin: 0; }#app /* ---------- Mobile ---------- */
.mobile-inline-field{ display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-4); }#app .mobile-inline-field label{ margin: 0; flex-shrink: 0; white-space: nowrap; }#app .mobile-inline-field select,
#app .mobile-inline-field input[type="number"]{ width: auto; flex: 1; min-width: 0; }

@media (max-width: 767.98px) {
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden; /* 徹底鎖死橫向滾動條，防止右側溢出 */
  }
  
  #jyutpairs-section {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;     /* 讓平板上的 Container 也在正中央 */
    box-sizing: border-box;
    padding: 30px 20px;      /* 平板稍微增加一點上下留白 */
    overflow-x: hidden;
  }

  /* 強制清除 Bootstrap 在平板模式（≥768px）自帶的固定 max-width 限制 */
  #jyutpairs-section > .container {
    width: 100% !important;     /* 加上 !important 強制覆蓋 Bootstrap */
    max-width: 100% !important; /* 阻止它在平板寬度時鎖死在 720px */
    margin: 0 auto !important;  /* 左右自動平分，回歸中心點 */
    padding: 0;
  }
  
  #jyutpairs-section .row {
    margin: 0 !important;       /* 清除 Bootstrap row 帶來的 -15px 左右負邊距 */
    padding: 0;
  }
  
  #jyutpairs-section .jyutpairs-app {
    width: 100%;
    max-width: 600px;           /* 💡 在平板上限制主畫面最大寬度，避免畫面橫向拉得太寬 */
    margin: 0 auto;             /* 確保主畫面的左右外邊距完全對稱 */
  }
}



@media (max-width: 540px){
  #app .jyutpairs-container {
    width: 100%;
    box-sizing: border-box;
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-md);
    
  }
  #app .char-display{ font-size: 58px; }
  #app .dual-toggle-row{
    gap: var(--space-4);
    display: flex;
    justify-content: center;
  }
  #app .audio-play-btn{
    width: 100%;
    max-width: 220px;
    height: 70px;
    font-size: 22px;
    margin: var(--space-5) auto var(--space-4);
    display: block;
  }
  #app #displayModeToggleItem{ display: none; }
}#app /* ---------- Navigation (index.html / info / learn / leaderboard / problem pages) ---------- */
.navbar,
#app nav{
  background: rgba(255,255,255,.85) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}#app .nav-link,
#app .navbar a{
  color: var(--ink-700) !important;
  font-weight: 600;
  transition: color .15s var(--ease);
}#app .nav-link:hover,
#app .navbar a:hover{ color: var(--brand-600) !important; }#app /* ---------- Generic content sections outside the app card ---------- */
.section-card{
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  max-width: 720px;
  margin: var(--space-6) auto;
  border: 1px solid var(--ink-100);
}#app .footer,
#app footer{
  color: var(--ink-400);
  font-size: 13px;
  text-align: center;
  padding: var(--space-5) 0;
}#app /* ---------- Scrollbar polish (review list,
#app etc.) ---------- */
::-webkit-scrollbar{ width: 8px; }#app ::-webkit-scrollbar-thumb{ background: var(--ink-200); border-radius: var(--radius-pill); }#app ::-webkit-scrollbar-thumb:hover{ background: var(--ink-400); }



/* Integrated JyutPairs presentation: visual-only refinements; game markup and scripts are unchanged. */
#jyutpairs-section .jyutpairs-app{
  width:min(100%, 720px);
  min-height:0;
  margin:0 auto;
  overflow:visible;
  border-radius:28px;
}
#app{
  --brand-50:#fdf3ee;
  --brand-100:#fbe4d8;
  --brand-200:#f6c7b0;
  --brand-400:#ea8f6c;
  --brand-500:#e8735a;
  --brand-600:#c85a42;
  --brand-700:#9c4230;
  --accent-orange-100:#fff3e0;
  --accent-orange-400:#eab064;
  max-width:680px;
  padding:clamp(1.5rem, 4vw, 2.75rem);
  border:1px solid rgba(200,90,66,.14);
  border-radius:28px;
  box-shadow:0 18px 44px rgba(156,66,48,.16);
}
#app .site-name{ letter-spacing:.14em; }
#app .char-display{ color:var(--brand-600); text-shadow:0 3px 0 rgba(200,90,66,.08); }
#app .quiz-info{ background:linear-gradient(135deg, var(--brand-50), #fff); }
#app button.primary{ box-shadow:0 12px 25px rgba(200,90,66,.28); }
#app .difficulty-track{ box-shadow:0 7px 14px rgba(200,90,66,.24); }
@media (max-width:767.98px){
  #jyutpairs-section{ padding-top:5.5rem; padding-bottom:4rem; }
  #jyutpairs-section .jyutpairs-app{ width:100%; border-radius:20px; }
  #app{ border-radius:20px; padding:1.5rem 1rem; }
}
@media (prefers-reduced-motion:reduce){
  #app *, #app *::before, #app *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* Layout repair: #app is the card itself, not an outer wrapper. */
#app {
  display: block;
  min-height: 0;
  width: 100%;
  background: var(--surface);
  text-align: center;
}
/* Remove the main app card's border/frame. */
#app.jyutpairs-container {
  border: 0;
  box-shadow: none;
}
/* Bootstrap's .progress styles create the unwanted grey bar. */
#app .progress {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: center;
}
@media (max-width: 767.98px) {
  #app.jyutpairs-container { border: 0; }
}


/* ---------- Home / mode-selection screen: full redesign ----------
   - No boxed panels: everything sits directly on the wallpaper.
   - Compact overall scale, homepage grid locked to a 3:2 ratio.
   - 難度 lines up left, inline with the other setting rows.
   - 開始作答 / Copyright now live in a full-width footer block
     centered under the whole two-column grid, not inside either
     column. ---------- */
#app .home-intro{ text-align: center; }
#app .home-desc{
  color: var(--ink-500);
  font-size: 13px;
  margin: 0 0 var(--space-4);
  line-height: 1.6;
}
#app h1{ font-size: 20px; }
#app h1 .accent{ color: var(--brand-600); }

#app .home-settings,
#app .home-options{
  text-align: left;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* 難度 as an inline row like the other selects: label left,
   difficulty pills take the remaining width. */
#app .difficulty-field .difficulty-slider{
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

/* Full leaderboard embed: no frame around the iframe itself, the
   leaderboard.html page already renders its own glass card. */
#app .home-leaderboard-embed{
  width: 100%;
  max-width: 340px;
  height: 340px;
  margin: 0 auto;
}
#app .home-leaderboard-iframe{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

/* Full-width footer: sits centered below both columns, in the
   middle-bottom of the whole homepage. */
#app .home-footer{
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#app .home-footer .primary{
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
}
#app .home-footer .brand{ text-align: center; }

#app .leaderboard-toggle-btn{ display: none; }

/* ==========================================================================
   1. 統一的手機與平板置中與 Bootstrap 清除代碼 (900px 以下)
   ========================================================================== */
   @media (max-width: 899.98px) {
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

 #jyutpairs-section {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    
    /* ⚡ 關鍵修正 1：將原本的 center 改為 flex-start，讓內容從上方依序排列，不再死死卡在正中間 */
    justify-content: flex-start; 
    align-items: center;     
    box-sizing: border-box;
    
    /* ⚡ 關鍵修正 2：增加 padding-top（例如 40px 或 60px），增加與上方導覽列的呼吸空間 */
    padding: 150px 20px 30px 20px; /* 格式依序為：上 50px、右 20px、下 30px、左 20px */
    overflow-x: hidden;
  }

  /* ⚡ 核心修正：徹底閹割 900px 以下 Bootstrap 的左右不對稱拉扯 */
  #jyutpairs-section > .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important; /* ⚡ 左右自動平分，回歸中心點 */
    padding: 0;
  }

  #jyutpairs-section .row {
    margin: 0 !important;      /* ⚡ 移除 Bootstrap 造成左右不均的負邊距 */
    padding: 0;
  }

  #jyutpairs-section .jyutpairs-app {
    width: 100%;
    max-width: 540px;          /* 💡 限制平板主卡片寬度，避免橫向拉太肥 */
    margin: 0 auto;
  }

  /* 你原本的 .home-grid 手機版留白設定 */
  #app .home-grid {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  /* 你原本的排行榜按鈕手機/平板版設定 */
  #app .leaderboard-toggle-btn {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0 auto var(--space-3);
    padding: 10px 14px;
    border: 1.5px solid var(--brand-200);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,.85);
    color: var(--brand-600);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  #app .leaderboard-toggle-btn:hover { background: var(--brand-50); }
  #app .home-leaderboard-embed { display: none; }
  #app .home-leaderboard-embed.is-open { display: block; }
}

/* ==========================================================================
   2. 桌機版雙欄佈局 (900px 以上) - 保持你原本的設定不變
   ========================================================================== */

@media (min-width: 900px) {
  #jyutpairs-section .jyutpairs-app {
    width: min(100%, 980px);
    margin: 0 auto; /* ⚡ 確保桌機版也是置中的 */
  }
  #app.jyutpairs-container {
    max-width: 980px;
    padding: clamp(1.5rem, 3vw, 2.25rem);
  }
  #app .home-intro { text-align: center; max-width: 620px; margin: 0 auto var(--space-5); }
  #app h1 { font-size: 22px; }
  #app .home-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    align-items: start;
    gap: clamp(2rem, 5vw, 3.5rem);
  }
  #app .home-settings .dual-toggle-row {
    justify-content: center;
    gap: var(--space-6);
  }
  #app .home-leaderboard-embed { max-width: 100%; height: 380px; }
}


/* ---------- App card wallpaper: coral line-icon pattern on cream,
   layered under a translucent white wash so text stays crisp
   while the pattern still shows through around the edges. ---------- */
#app.jyutpairs-container {
  position: relative;
  overflow: hidden;
  z-index: 1;  
}

#app.jyutpairs-container::before {
  content: "";
  position: absolute;
  top: -10px;    
  left: -10px;
  right: -10px;
  bottom: -10px;
  z-index: -1;   

  background-image:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.8)),
    url("../images/app_back.png");
  /* Fixed pixel tile size + repeat keeps the pattern's scale
     constant regardless of how tall #app gets between screens.
     background-position is pinned to the box's own top-left
     corner (0 0) rather than "center" — centering recalculates
     the tile grid's start point every time the box's width/height
     changes, which is what caused the residual drift. Anchoring to
     a fixed corner means the grid never re-centers; the box just
     reveals more/less of the same fixed pattern. */
  background-size: 100% 100%, 420px auto;
  background-position: center, 0 0;
  background-repeat: no-repeat, repeat;

  filter: blur(0.8px);
  /* Scale from the same top-left anchor as background-position,
     so the zoom doesn't shift depending on the box's own height. */
  transform-origin: top left;
  transform: scale(1.1);
}

#app .quiz-info{
  background: linear-gradient(135deg, rgba(253,243,238,.9), rgba(255,255,255,.85));
  border: 1px solid rgba(200,90,66,.14);
}
#app select,
#app input[type="number"],
#app input[type="text"],
#app input[type="email"]{
  background: rgba(255,255,255,.85);
}
#app .opt-btn{
  background: rgba(255,255,255,.85);
}
