:root {
  /* Color Palette - Duolingo Theme */
  --bg-dark: #eff7e1;
  --bg-gradient: #eff7e1;
  --primary: #58cc02;
  --primary-hover: #89e219;
  --secondary: #1cb0f6;
  --accent: #58cc02;
  --error: #ea2b2b;
  --text-primary: #3c3c3c;
  --text-secondary: #777777;
  
  /* Solid shadow instead of Glassmorphism */
  --glass-bg: #ffffff;
  --glass-border: #e5e5e5;
  --glass-shadow: 0 4px 0 #e5e5e5;
  
  /* Layout & Animation */
  --radius-lg: 16px;
  --radius-xl: 24px;
  --trans-fast: 0.2s ease;
  --trans-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hidden { display: none !important; }

body {
  font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* Prevent body scroll, manage in containers */
}

/* Typography */
h1, h2, h3 { font-weight: 800; }
p { color: var(--text-secondary); line-height: 1.5; }

/* ---------------------------------
   Layout 
   --------------------------------- */
#app {
  width: 100%;
  max-width: 600px;
  height: 100vh;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 100%;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.view-active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ---------------------------------
   Components - Glass Card
   --------------------------------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  padding: 2rem;
  transition: transform var(--trans-bounce), box-shadow var(--trans-fast);
}

/* ---------------------------------
   Buttons
   --------------------------------- */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: all var(--trans-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:active { transform: scale(0.95); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: rgba(236, 72, 153, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(236, 72, 153, 0.3);
}
.btn-secondary:hover { background: rgba(236, 72, 153, 0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.btn-block { width: 100%; }

.btn-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.2rem;
  background: rgba(255,255,255,0.1);
  color: white;
}
.btn-icon:hover { background: var(--primary); }

/* ---------------------------------
   Forms
   --------------------------------- */
.input-group { margin-bottom: 1.5rem; }
.input-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  background: white;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--trans-fast);
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.2);
}

.error-msg {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
  min-height: 1.5rem;
}

/* ---------------------------------
   App Specific UI
   --------------------------------- */
/* Login Screen */
.login-card {
  margin-top: 10vh;
}
.logo-container {
  text-align: center;
  margin-bottom: 2rem;
}
.logo-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Dashboard & Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  padding-top: 1rem;
}
.duo-header { border-bottom: none; }
.avatar-icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  /* 預設頭像（圓形裁切，無邊框） */
  background-image: url(../img/avatar-default.png);
  background-size: cover;
  background-position: center top;
  background-color: #e8f4d6;
  transition: transform 0.12s, opacity 0.12s;
}
.avatar-icon:hover { opacity: 0.85; transform: scale(1.05); }
/* Settings 分頁大頭像 */
.avatar-icon.avatar-lg {
  width: 80px; height: 80px;
}
.btn-pill {
  background: white;
  color: #111;
  font-weight: 800;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  border: 2px solid var(--glass-border);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  font-size: 1rem;
  cursor: pointer;
}
/* 手機版難度按鈕縮小，避免擠壓標題列 */
@media (max-width: 480px) {
  .btn-pill {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
  }
}
.name-tag { font-weight: 800; font-size: 1.2rem; }
.points-tag {
  background: rgba(245, 158, 11, 0.2);
  color: #d97706; /* deeper gold */
  padding: 0.6rem 1rem;
  border-radius: 20px;
  font-weight: 800;
  margin-right: 0.5rem;
}

/* Tab Content */
.tab-content { display: none; padding-bottom: 100px; }
.tab-content.active { display: block; animation: popIn 0.3s ease-out; }

/* Level Path UI */
.path-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0 5rem 0; /* extra padding bottom to clear the fixed bar */
  gap: 1.5rem; /* Gap between tiers */
  position: relative;
}
.map-tier {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 3rem; 
  width: 100%;
}
.path-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  transition: transform 0.2s;
}

/* Legacy path-row for simple vertical list */
.path-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  transition: transform 0.2s;
  margin-bottom: 2rem;
}
.mode-row {
  display: flex;
  width: 100%;
  justify-content: center;
  gap: 3rem;
}
.mode-row .path-row {
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .mode-row {
    gap: 1.25rem;
  }
  /* 手機版預設（≤8字母）：略縮讓短單字也不會太擁擠 */
  .slot-tile {
    width: 48px; height: 62px;
    font-size: 1.8rem;
    border-radius: 10px;
  }
  .option-tile {
    width: 48px; height: 62px;
    font-size: 1.8rem;
    border-radius: 10px;
  }
  /* 長單字的 row-gap 由上方 data-wlen 規則各自控制，此處僅給預設值 */
  #word-display:not([data-wlen]) { gap: 4px; row-gap: 8px; }
}
.path-node {
  width: 90px; height: 90px;
  border-radius: 50%;
  border: none;
  background: #89e219;
  box-shadow: 0 8px 0 #58a700;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: white;
  cursor: pointer;
  margin-bottom: 1rem;
  position: relative;
}
.path-node:active { transform: translateY(8px); box-shadow: 0 0px 0 #58a700; margin-bottom: calc(1rem + 8px); }
.path-node.locked {
  background: #e5e5e5;
  box-shadow: 0 8px 0 #cecece;
  cursor: not-allowed;
  color: #a5a5a5;
}
.path-node-label { font-weight: 800; font-size: 1.2rem; color: #3c3c3c; user-select: none; }

/* Floating Bottom Tab Bar */
.bottom-tab-bar {
  position: fixed;
  bottom: 20px;
  left: 5%;
  width: 90%;
  max-width: 500px;
  background: #f7fad7;
  border: 2px solid rgba(0,0,0,0.05);
  border-radius: 40px;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
@media (min-width: 600px) {
  .bottom-tab-bar { left: 50%; transform: translateX(-50%); }
}
.tab-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #333;
  cursor: pointer;
  flex: 1;
  padding: 5px 0;
  border-radius: 30px;
  font-family: inherit;
  transition: background 0.2s;
}
.tab-btn .tab-icon { font-size: 1.5rem; margin-bottom: 4px; filter: grayscale(1); opacity: 0.6; }
.tab-btn .tab-label { font-size: 0.8rem; font-weight: 800; }
.tab-btn.active {
  background: #e6f6cb;
}
.tab-btn.active .tab-icon { filter: none; opacity: 1; }
.tab-btn.active .tab-label { color: #58cc02; }

/* Leaderboard */
.dashboard-widgets { margin-top: 2rem; }
.widget { padding: 1.5rem; margin-bottom: 1rem; }
.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.leaderboard-list { list-style: none; }
.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: background 0.15s;
}
.leaderboard-list li:last-child { border: none; }
.leaderboard-me {
  background: rgba(88, 204, 2, 0.1) !important;
  border-bottom-color: rgba(88, 204, 2, 0.15) !important;
}
.lb-medal { font-size: 1.2rem; margin-right: 8px; }
.lb-rank {
  display: inline-block;
  min-width: 2rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 8px;
}
.lb-me-tag { font-size: 0.7rem; color: #16a34a; margin-left: 4px; }
.rank-points {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
}
.lb-pts { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.lb-sub { font-size: 0.65rem; color: var(--text-secondary); }

/* ---------------------------------
   PR Hero Card
   --------------------------------- */
.pr-hero-card { padding-bottom: 1rem; }

.rank-rings-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rank-ring-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}

.rank-ring-wrap {
  position: relative;
  width: 88px;
  height: 88px;
}

.rank-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-ring-number {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.rank-ring-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.3rem;
}

.rank-ring-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.rank-ring-pct {
  font-size: 0.82rem;
  font-weight: 800;
}

.rank-ring-divider {
  width: 1px;
  background: #e5e5e5;
  align-self: stretch;
  margin: 0.25rem 0;
  flex-shrink: 0;
}

.pr-stats-row {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  padding: 0.85rem 0 0.6rem;
  border-top: 1px solid var(--glass-border);
  margin-top: 0.25rem;
}

.pr-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.pr-stat-icon { font-size: 1.1rem; }

.pr-stat-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
}

.pr-stat-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.pr-cheer {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.4rem 0 0;
}

/* Game Area */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.timer-bar-container {
  height: 8px; width: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 1rem;
  display: inline-block;
  vertical-align: middle;
}
.timer-bar {
  height: 100%; width: 100%;
  background: var(--accent);
  transform-origin: left;
  transition: transform 0.1s linear, background-color 0.3s ease;
}

.game-area { text-align: center; margin-top: 4rem; }
.word-display {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 5px;
  margin-bottom: 2rem;
  min-height: 4rem;
}
.word-char {
  display: inline-block;
  width: 40px;
  border-bottom: 4px solid var(--glass-border);
  margin: 0 5px;
  text-align: center;
}
.word-char.filled { border-color: var(--primary); }

.tts-controls { margin-bottom: 3rem; display: flex; justify-content: center; gap: 1rem; }

.game-input-form input {
  font-size: 2rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: 3px;
  border: none;
  background: transparent;
  color: white;
  border-bottom: 2px solid var(--primary);
  border-radius: 0;
}
.game-input-form input:focus { box-shadow: none; }

/* Overlay Result */
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1; transition: opacity 0.3s;
}
.overlay.hidden {
  opacity: 0; pointer-events: none;
}
.result-card { text-align: center; width: 80%; max-width: 400px; }
.result-points {
  font-size: 3rem; font-weight: 800; color: var(--accent);
  margin: 1rem 0;
  animation: popIn var(--trans-bounce);
}
.result-correction {
  color: var(--error); margin-bottom: 1rem; font-size: 1.2rem;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------
   Duolingo-like Game Theme
   --------------------------------- */
.theme-duo {
  background: #eff7e1;
  color: #111;
}

.theme-duo .game-header {
  justify-content: space-between;
}

.theme-duo .timer-bar-container {
  background: #d1d8c5;
}
.theme-duo .timer-bar {
  background: #8ac847;
}

.theme-duo .btn-ghost {
  background: #e6f7d6; /* Light pill close button */
  color: #111;
  font-weight: 800;
  border-radius: 50%;
  width: 40px; height: 40px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}

.game-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: left;
  padding-left: 10px;
}

/* Word Slots (Top row) */
.slots-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* #word-display 使用 flex-wrap 讓複合詞換行顯示 */
#word-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  row-gap: 10px;
}

.slot-tile {
  width: 60px; height: 75px;
  border-radius: 12px;
  font-size: 2.2rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  text-transform: lowercase;
}

.slot-tile.filled { /* Found letter or Correct */
  background: #8fcb52;
  color: white;
  box-shadow: 0 4px 0 #7aba3f;
  margin-bottom: 4px; /* compensate for shadow */
}

.slot-tile.empty { /* The missing hole */
  background: #a9d970;
  color: transparent;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.1); /* Recessed look */
  margin-top: 4px; /* match height */
}

/* 母音缺漏格：藍底 + 白色字（填入後可見）+ 深藍粗框，對比鮮明 */
.slot-tile.empty.vowel-slot {
  background: #3b82f6;          /* 藍底，與綠色一般格明顯區隔 */
  color: white;                  /* 填入字母後顯示白色 */
  border: 4px solid #1d4ed8;    /* 深藍粗框 4px */
  box-shadow: 0 0 0 3px rgba(59,130,246,0.40), /* 淡藍外暈 */
              0 4px 0 #1e40af;   /* 底部立體陰影，與一般 filled tile 一致 */
  margin-top: 0;
}

/* 複合詞空格分隔（如 elementary school）：視覺分隔線，不顯示為字母格 */
.slot-tile.word-gap {
  width: 18px;
  min-width: 18px;
  background: transparent;
  box-shadow: none;
  border: none;
  position: relative;
  color: transparent;
  pointer-events: none;
}
.slot-tile.word-gap::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}

/* ── 動態字長縮放（game.js _applyWordSize() 設定 data-wlen） ─────────────────
   short/未設定 (≤8):  預設尺寸 60×75 px
   mid             (9–11): 52×66 px
   long            (12–14): 44×56 px
   xl              (15+):   36×46 px
   ─────────────────────────────────────────────────────────────────────────── */
#word-display[data-wlen="mid"] { gap: 5px; }
#word-display[data-wlen="mid"] .slot-tile {
  width: 52px; height: 66px; font-size: 1.95rem; border-radius: 11px;
}
#word-display[data-wlen="mid"] .slot-tile.word-gap { width: 14px; min-width: 14px; }

#word-display[data-wlen="long"] { gap: 4px; row-gap: 8px; }
#word-display[data-wlen="long"] .slot-tile {
  width: 44px; height: 56px; font-size: 1.65rem; border-radius: 9px;
}
#word-display[data-wlen="long"] .slot-tile.word-gap { width: 12px; min-width: 12px; }

#word-display[data-wlen="xl"] { gap: 3px; row-gap: 7px; }
#word-display[data-wlen="xl"] .slot-tile {
  width: 36px; height: 46px; font-size: 1.35rem; border-radius: 8px;
}
#word-display[data-wlen="xl"] .slot-tile.word-gap { width: 10px; min-width: 10px; }

@media (max-width: 600px) {
  #word-display[data-wlen="mid"] .slot-tile {
    width: 42px; height: 54px; font-size: 1.6rem;
  }
  #word-display[data-wlen="long"] { gap: 3px; row-gap: 6px; }
  #word-display[data-wlen="long"] .slot-tile {
    width: 34px; height: 44px; font-size: 1.3rem; border-radius: 8px;
  }
  #word-display[data-wlen="xl"] { gap: 2px; row-gap: 5px; }
  #word-display[data-wlen="xl"] .slot-tile {
    width: 28px; height: 36px; font-size: 1.05rem; border-radius: 6px;
  }
}

/* Options Keyboard (Bottom row) */
.options-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4rem;
  flex-wrap: wrap;
}

.option-tile {
  width: 60px; height: 75px;
  border-radius: 12px;
  font-size: 2.2rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  background: #e1f4ca; /* Paler green */
  color: #111;
  box-shadow: 0 4px 0 #c2df9e;
  cursor: pointer;
  text-transform: lowercase;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-bottom: 4px;
}

.option-tile:active {
  transform: translateY(4px);
  box-shadow: none;
  margin-bottom: 0;
  margin-top: 4px;
}

.option-tile.hidden {
  visibility: hidden;
}

/* ── Word Recognition (聽音辨字) ── */
.wr-prompt {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  padding: 1rem 0;
}

.wr-choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
  padding: 0 8px;
}

.wr-choice-tile {
  min-height: 56px;
  border-radius: 14px;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e1f4ca;
  color: #111;
  border: 3px solid transparent;
  box-shadow: 0 4px 0 #c2df9e;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.15s, background 0.15s;
  padding: 8px 12px;
  text-align: center;
  word-break: break-word;
}

.wr-choice-tile:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: none;
}

.wr-choice-tile.selected {
  border-color: var(--accent, #58cc02);
  background: #d4edbc;
  box-shadow: 0 4px 0 var(--accent, #58cc02);
}

.wr-choice-tile.wr-correct {
  background: #86efac;
  border-color: #22c55e;
  box-shadow: 0 4px 0 #16a34a;
  color: #14532d;
}

.wr-choice-tile.wr-wrong {
  background: #fca5a5;
  border-color: #ef4444;
  box-shadow: 0 4px 0 #dc2626;
  color: #7f1d1d;
}

.wr-choice-tile:disabled {
  cursor: default;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .wr-choices-grid {
    max-width: 100%;
    gap: 10px;
  }
  .wr-choice-tile {
    min-height: 50px;
    font-size: 1.2rem;
  }
}

/* Sub controls (Repeat word etc) */
.duo-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 3rem;
}

.btn-duo-sub {
  background: #def6c1;
  color: #111;
  border: none;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 20px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-duo-sub:hover { background: #d0efab; }
.btn-duo-sub:active { transform: translateY(2px); }

/* Main Check Button */
.btn-duo-main {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  border: none;
  border-radius: 24px;
  padding: 16px;
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  color: white;
  background: #c7dea6; /* Disabled state color */
  cursor: not-allowed;
  transition: 0.2s;
}

.btn-duo-main.active {
  background: #58cc02;
  box-shadow: 0 4px 0 #58a700;
  cursor: pointer;
  margin-bottom: 4px;
}

.btn-duo-main.active:active {
  transform: translateY(4px);
  box-shadow: none;
  margin-bottom: 0px;
}

/* ---------------------------------
   Badges Grid UI
   --------------------------------- */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 1rem;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #e5e5e5;
  border-radius: 14px;
  padding: 12px 8px 8px;
  box-shadow: 0 3px 0 #e5e5e5;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: help;
  gap: 4px;
}

.badge-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #e5e5e5;
}

.badge-icon {
  line-height: 1;
  margin-bottom: 2px;
}

.badge-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.badge-emoji {
  font-size: 2.2rem;
  display: block;
}

.badge-name {
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.2;
}

.badge-date {
  font-size: 0.6rem;
  color: var(--text-secondary);
}

/* ---------------------------------
   Admin Settings Section Cards
   --------------------------------- */
.settings-section-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}

.settings-section-header:hover {
  background: #f8fafc;
}

.settings-section-header.open {
  border-bottom-color: #e2e8f0;
}

.settings-section-header .section-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.settings-section-header .section-titles {
  flex: 1;
  min-width: 0;
}

.settings-section-header .section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.15rem;
}

.settings-section-header .section-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: normal;
  margin: 0;
}

.settings-section-header .section-chevron {
  font-size: 0.9rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.settings-section-header.open .section-chevron {
  transform: rotate(180deg);
}

.settings-section-body {
  padding: 1.5rem;
  display: none;
}

.settings-section-body.open {
  display: block;
}

.module-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f5f9;
  color: #64748b;
}

.module-status-badge.active {
  background: #dcfce7;
  color: #16a34a;
}

@media (max-width: 640px) {
  .settings-section-header {
    padding: 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .settings-section-body {
    padding: 1rem;
  }
  .settings-section-header .section-subtitle {
    display: none;
  }
  .settings-section-card .form-input,
  .settings-section-card select,
  .settings-section-card input[type="text"],
  .settings-section-card input[type="number"],
  .settings-section-card input[type="password"] {
    min-height: 44px;
  }
  .settings-section-card input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-height: 22px;
  }
  .settings-section-card .btn {
    min-height: 44px;
  }
}
