/* ============================================================
   医心试炼 - 国潮中医风 UI (v2)
   Design: 宣纸纹理 + 朱砂/墨黑/石青/赭石/金色
   Reference: AI Prompts for 4 Game Screens
   ============================================================ */

:root {
  /* ----- 国风五色 ----- */
  --zhu-sha: #C41E3A;          /* 朱砂红 - 主色/标题/危险 */
  --zhu-sha-dark: #9A152C;      /* 朱砂暗 */
  --zhu-sha-light: #E85D75;     /* 朱砂亮 */
  --mo-hei: #1A1A1A;            /* 墨黑 - 正文 */
  --mo-hei-soft: #3A3A3A;       /* 墨灰 - 辅助文字 */
  --shi-qing: #1685A9;          /* 石青 - 次要强调 */
  --shi-qing-dark: #0F6A88;     /* 石青暗 */
  --shi-qing-light: #4DB8D8;    /* 石青亮 */
  --zhe-shi: #8B4513;           /* 赭石 - 边框/大地色 */
  --zhe-shi-light: #C17A3E;     /* 赭石亮 */
  --jin-se: #C9A96E;            /* 金色 - 高亮/奖励 */
  --jin-se-light: #E0CA90;      /* 金亮 */
  --jin-se-dark: #A8874A;       /* 金暗 */
  --xuan-zhi: #F5F0E8;          /* 宣纸白 - 背景主色 */
  --xuan-zhi-dark: #E8E0D4;     /* 宣纸暗 */
  --xuan-zhi-light: #FAF6F0;    /* 宣纸亮 */

  /* ----- 功能色 ----- */
  --correct: #2E7D32;
  --correct-light: rgba(46,125,50,0.12);
  --wrong: #C41E3A;
  --wrong-light: rgba(196,30,58,0.08);
  --card-bg: rgba(245,240,232,0.88);
  --card-bg-solid: #F5F0E8;
  --frosted: rgba(245,240,232,0.78);
  --overlay: rgba(26,26,26,0.55);
  --overlay-heavy: rgba(26,26,26,0.78);

  /* ----- 图标尺寸体系 ----- */
  --icon-xs: 18px;
  --icon-sm: 22px;
  --icon-md: 28px;
  --icon-lg: 36px;
  --icon-xl: 48px;

  /* ----- 尺寸 ----- */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --border-width: 1.5px;

  /* ----- 字体 ----- */
  --font-base: 'STKaiti','KaiTi','FangSong','STSong','SimSun','Noto Serif SC',serif;
  --font-title: 'STXingkai','STKaiti','KaiTi','FangSong',serif;
  --font-mono: 'STSong','SimSun','Noto Serif SC',serif;
}

/* ===== RESET ===== */
* { margin:0; padding:0; box-sizing:border-box; }

/* ============================================================
   UNIFIED ICON SYSTEM (v1)
   - All icons use <img> tag for consistent rendering
   - Size controlled by CSS variables: --icon-xs/sm/md/lg/xl
   - Hover: scale(1.08) + subtle shadow
   - Disabled: opacity 0.35 + grayscale
   ============================================================ */
.icon { display: inline-block; object-fit: contain; vertical-align: middle;
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease; }
.icon:hover:not(.icon-disabled) { transform: scale(1.08); }
.icon:active:not(.icon-disabled) { transform: scale(0.95); }
.icon-disabled { opacity: 0.35; filter: grayscale(80%); pointer-events: none; }
/* Size variants */
.icon-xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon-sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon-md { width: var(--icon-md); height: var(--icon-md); }
.icon-lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon-xl { width: var(--icon-xl); height: var(--icon-xl); }

body {
  font-family: var(--font-base);
  background: #2C2416;
  display: flex; justify-content: center; align-items: flex-start;
  min-height: 100vh;
  padding: 10px 0;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(201,169,110,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(196,30,58,0.06) 0%, transparent 50%);
}

/* ===== BGM TOGGLE ===== */
.bgm-toggle {
  position: fixed; top: 12px; right: 16px;
  z-index: 9999;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  background: rgba(26,26,26,0.75);
  border: 1.5px solid rgba(201,169,110,0.4);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  transition: all 0.3s;
  user-select: none; -webkit-user-select: none;
}
.bgm-toggle:hover {
  border-color: var(--jin-se);
  transform: scale(1.1);
  box-shadow: 0 2px 10px rgba(201,169,110,0.25);
}
.bgm-toggle:active { transform: scale(0.92); }
.bgm-toggle.muted { opacity: 0.5; }

/* ===== PHONE FRAME ===== */
.phone-frame {
  width: 390px; max-width: 95vw;
  height: 844px; max-height: 95vh;
  background: var(--xuan-zhi);
  border-radius: 24px; overflow: hidden; position: relative;
  box-shadow:
    0 0 0 3px #3A2A1A,
    0 0 0 6px #1A1A1A,
    0 20px 60px rgba(0,0,0,0.5);
}

/* Xuan paper texture overlay */
.phone-frame::before {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px,
      rgba(139,90,43,0.025) 2px, rgba(139,90,43,0.025) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px,
      rgba(139,90,43,0.015) 3px, rgba(139,90,43,0.015) 6px);
  pointer-events: none; z-index: 99;
}

/* Cloud pattern top ornament */
.phone-frame::after {
  content: ''; position: absolute; top:0; left:0; right:0; height:8px;
  background: linear-gradient(90deg,
    transparent 0%, var(--jin-se) 15%, var(--jin-se) 85%, transparent 100%);
  opacity: 0.3; z-index: 100; pointer-events: none;
}

.screen {
  display: none; flex-direction: column; height: 100%; position: relative; z-index: 1;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  transform: translateY(12px) scale(0.98);
}
.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Home screen no transition on initial load (snaps in) */
#screen-home { transition: none; }
#screen-home.active { transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1); }

/* ===== SCROLLBAR (Brush-stroke style) ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(201,169,110,0.5), rgba(139,69,19,0.3));
  border-radius: 3px;
  transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--jin-se), var(--zhe-shi)); }

/* ===== ANIMATIONS ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(4px) rotate(1deg); }
}
@keyframes hitFlash {
  0% { box-shadow: 0 0 0 0 rgba(196,30,58,0.6); }
  50% { box-shadow: 0 0 30px 10px rgba(196,30,58,0.3); }
  100% { box-shadow: 0 0 0 0 rgba(196,30,58,0); }
}
@keyframes inkSplash {
  0% { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(201,169,110,0.2); }
  50% { box-shadow: 0 0 18px rgba(201,169,110,0.4); }
}
@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes treasureGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
@keyframes inkDrop {
  0% { transform: scaleY(0); opacity: 0.6; }
  50% { transform: scaleY(1.2); opacity: 0.3; }
  100% { transform: scaleY(1); opacity: 0; }
}

.shake { animation: shake 0.5s ease; }
.hit-flash { animation: hitFlash 0.6s ease; }
.glow-pulse { animation: glowPulse 2s ease-in-out infinite; }

/* ===== NOTIFICATION ===== */
.game-notif {
  position: absolute; top: 14px; left: 16px; right: 16px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(26,26,26,0.9); color: #fff;
  font-size: 13px; z-index: 999; text-align: center;
  transform: translateY(-130%); transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none; font-weight: 600;
  border: 1px solid var(--jin-se);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
}
.game-notif.show { transform: translateY(0); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px 10px;
  background: linear-gradient(180deg, rgba(26,26,26,0.85), rgba(26,26,26,0.95));
  border-top: 2px solid var(--jin-se);
  z-index: 100; flex-shrink: 0;
  position: relative;
}
/* Gold thread above nav */
.bottom-nav::before {
  content: ''; position: absolute; top: -4px; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--jin-se), transparent);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  cursor: pointer; padding: 4px 6px; border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1); color: #777; font-size: 10px;
  border: 1px solid transparent; flex: 1; text-align: center;
  position: relative;
}
.nav-item:hover:not(.active) { color: #999; background: rgba(201,169,110,0.04); }
.nav-item:active:not(.active) { transform: scale(0.92); }
.nav-item.active {
  color: var(--jin-se);
  border-color: rgba(201,169,110,0.3);
  background: rgba(201,169,110,0.08);
}
.nav-item .nav-icon { font-size: 20px; line-height: 1; }
.nav-item .nav-label { font-size: 9px; line-height: 1; margin-top: 1px; letter-spacing: 0.5px; }

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex; align-items: center; padding: 16px 16px 8px;
  gap: 10px; flex-shrink: 0;
  position: relative;
}
.screen-header::after {
  content: ''; position: absolute; bottom: 4px; left: 16px; right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--jin-se), transparent);
  opacity: 0.5;
}
.screen-header > :nth-child(2) {
  flex: 1; font-size: 17px; color: var(--zhu-sha); font-weight: 700;
  font-family: var(--font-title); letter-spacing: 3px;
}

/* Back button - icon rendered by JS as <img> tag */
.back-btn {
  cursor: pointer; width: var(--icon-md); height: var(--icon-md);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0;
  transition: background-color 0.2s ease;
}
.back-btn img { width: 20px; height: 20px; object-fit: contain; pointer-events: none; }
.back-btn:hover { background-color: rgba(196,30,58,0.08); }

.scroll-area {
  flex: 1; overflow-y: auto; min-height: 0;
  scroll-behavior: smooth;
}

/* ===== COMMON UI ELEMENTS ===== */

/* Timer urgency pulse */
#exam-timer.urgent {
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Progress bar */
.progress-bar-outer {
  height: 6px; background: rgba(139,69,19,0.12);
  border-radius: 3px; overflow: hidden;
  border: 1px solid rgba(201,169,110,0.25);
  position: relative;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--zhu-sha), var(--jin-se));
  border-radius: 3px; transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

/* Primary button - scroll style */
/* Ripple effect for buttons */
.btn-ripple {
  position: relative; overflow: hidden;
}
.btn-ripple::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.btn-ripple:active::after { opacity: 1; }

.btn-primary {
  display: block; width: 100%; padding: 13px 20px;
  background: linear-gradient(135deg, var(--zhu-sha), var(--zhu-sha-dark));
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-base); font-size: 14px; font-weight: 700;
  cursor: pointer; text-align: center; margin-top: 8px;
  letter-spacing: 2px; position: relative; overflow: hidden;
  transition: all 0.3s;
  box-shadow: 0 2px 12px rgba(196,30,58,0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--zhu-sha-dark), #801020); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(196,30,58,0.35); }
.btn-primary:active { transform: translateY(0); }

/* Small buttons */
.btn-sm {
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-family: var(--font-base); font-size: 11px; font-weight: 600;
  border: 1.5px solid; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  flex: 1; text-align: center; letter-spacing: 0.5px;
}
.btn-sm:hover { transform: translateY(-1px); }
.btn-sm:active { transform: scale(0.94); }
.btn-study { background: rgba(22,133,169,0.08); border-color: var(--shi-qing); color: var(--shi-qing); }
.btn-study:hover { background: rgba(22,133,169,0.16); }
.btn-battle { background: rgba(196,30,58,0.06); border-color: var(--zhu-sha); color: var(--zhu-sha); }
.btn-battle:hover { background: rgba(196,30,58,0.12); }
.btn-boss { background: rgba(201,169,110,0.15); border-color: var(--jin-se); color: var(--zhe-shi); }
.btn-boss:hover { background: rgba(201,169,110,0.25); }
.btn-done { background: rgba(46,125,50,0.08); border-color: var(--correct); color: var(--correct); }
.btn-review { background: rgba(139,69,19,0.06); border-color: var(--zhe-shi); color: var(--zhe-shi); }
.btn-correct { background: var(--correct-light); border-color: var(--correct); color: var(--correct); }
.btn-wrong { background: var(--wrong-light); border-color: var(--wrong); color: var(--wrong); }
.btn-buy { background: rgba(201,169,110,0.12); border-color: var(--jin-se); color: var(--zhe-shi); }
.btn-buy:disabled { opacity: 0.35; cursor: not-allowed; }

/* Difficulty Selector */
.home-difficulty-section {
  padding: 4px 6px; z-index: 2; flex-shrink: 0;
}
.difficulty-label {
  font-size: 5px; color: var(--zhe-shi); text-align: center; margin-bottom: 3px;
  font-weight: 600; letter-spacing: 1px;
}
.difficulty-btns {
  display: flex; gap: 3px; justify-content: center;
}
.difficulty-btn {
  flex: 1; padding: 3px 4px; border-radius: 3px; cursor: pointer;
  font-family: var(--font-base); font-size: 6px; font-weight: 700;
  border: 1px solid transparent; transition: all 0.3s;
  background: rgba(245,240,232,0.7);
  color: var(--zhe-shi);
}
.difficulty-btn.active {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.btn-easy.active {
  background: linear-gradient(135deg, rgba(76,175,80,0.15), rgba(76,175,80,0.05));
  border-color: var(--correct); color: var(--correct);
}
.btn-medium.active {
  background: linear-gradient(135deg, rgba(255,152,0,0.15), rgba(255,152,0,0.05));
  border-color: var(--jin-se); color: var(--zhe-shi);
}
.btn-hard.active {
  background: linear-gradient(135deg, rgba(196,30,58,0.15), rgba(196,30,58,0.05));
  border-color: var(--zhu-sha); color: var(--zhu-sha);
}
.difficulty-desc {
  font-size: 5px; color: var(--zhe-shi); text-align: center; margin-top: 3px;
  line-height: 1.3;
}

/* ========================================
   SCREEN 1: HOME (主页 · 医心试炼大陆)
   ======================================== */
#screen-home {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.3) 0%,
    rgba(240,232,218,0.6) 35%,
    rgba(245,240,232,0.92) 65%,
    var(--xuan-zhi) 100%);
}

/* Ink-wash mountain background */
.home-bg {
  position: absolute; top: 0; left: 0; right: 0; height: 360px;
  background:
    /* Distant mountain layer */
    radial-gradient(ellipse 140% 40% at 20% 82%, rgba(139,69,19,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 120% 35% at 75% 88%, rgba(139,69,19,0.08) 0%, transparent 55%),
    /* Mid mountain layer */
    radial-gradient(ellipse 100% 30% at 50% 75%, rgba(26,26,26,0.04) 0%, transparent 50%),
    /* Cloud/mist layer */
    radial-gradient(ellipse 200% 25% at 50% 55%, rgba(255,255,255,0.6) 0%, transparent 60%),
    /* Warm light */
    radial-gradient(ellipse 80% 50% at 80% 30%, rgba(201,169,110,0.08) 0%, transparent 50%),
    linear-gradient(180deg,
      rgba(232,224,210,0.6) 0%,
      rgba(240,232,218,0.5) 30%,
      rgba(245,240,232,0.7) 60%,
      var(--xuan-zhi) 100%);
  pointer-events: none;
}

/* Decorative herbs */
.home-herb-left {
  position: absolute; top: 55px; left: 4px;
  font-size: 34px; opacity: 0.2; transform: rotate(-12deg);
  filter: grayscale(30%);
}
.home-herb-right {
  position: absolute; top: 45px; right: 4px;
  font-size: 30px; opacity: 0.2; transform: rotate(10deg);
  filter: grayscale(30%);
}

/* ===== Home Header ===== */
.home-header {
  display: flex; align-items: center;
  padding: 22px 16px 10px; gap: 12px;
  z-index: 2; flex-shrink: 0;
  position: relative;
}

/* Decorative seal mark next to title */
.home-header::after {
  content: '印'; position: absolute; top: 20px; right: 16px;
  font-size: 10px; color: var(--zhu-sha); opacity: 0.12;
  font-family: var(--font-title);
  border: 1px solid var(--zhu-sha);
  padding: 2px 3px; border-radius: 2px;
  transform: rotate(8deg);
}

/* NPC avatar with ink-wash border */
.home-avatar {
  width: 35px; height: 35px; border-radius: 50%;
  background-color: #E8DDD0;
  border: 2.5px solid var(--jin-se);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 12px rgba(201,169,110,0.2);
  background-image: url('images/tx/wo.png');
  background-size: cover;
  background-position: center;
}
/* Ink splash ring around avatar */
.home-avatar::after {
  content: ''; position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(201,169,110,0.25);
}

.home-user-info { flex: 1; }
.home-user-name { font-size: 15px; color: var(--mo-hei); font-weight: 700; letter-spacing: 1px; }
.home-user-level { font-size: 11px; color: var(--zhe-shi); margin-top: 2px; }

.home-stats {
  display: flex; gap: 10px; font-size: 10px; color: var(--mo-hei-soft);
  background: rgba(245,240,232,0.6); padding: 5px 10px;
  border-radius: var(--radius-sm); border: 1px solid rgba(201,169,110,0.2);
}
.home-stat { text-align: center; }
.home-stat-val { color: var(--zhu-sha); font-weight: 700; font-size: 14px; }

/* ===== Title Area ===== */
.home-title-area {
  text-align: center; padding: 16px 0 12px;
  z-index: 2; flex-shrink: 0;
  position: relative;
}
/* Cloud ornaments */
.home-title-area::before,
.home-title-area::after {
  content: '☁️'; position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: 0.2;
}
.home-title-area::before { left: 24px; }
.home-title-area::after { right: 24px; }

.home-title {
  font-family: var(--font-title); font-size: 30px;
  color: var(--zhu-sha); letter-spacing: 8px; font-weight: 700;
  text-shadow: 2px 2px 4px rgba(196,30,58,0.2);
}
.home-subtitle {
  font-size: 11px; color: var(--zhe-shi); margin-top: 4px;
  letter-spacing: 3px;
  background: linear-gradient(90deg, transparent, rgba(201,169,110,0.2), transparent);
  padding: 4px 0;
}

/* ===== Progress Section ===== */
.home-progress-section {
  padding: 2px 16px 6px; z-index: 2; flex-shrink: 0;
}
.home-progress-row {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--zhe-shi); margin-bottom: 2px;
}

/* ===== Domains Grid (6 scroll-style buttons) ===== */
.home-domains {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 8px 16px 8px; z-index: 2;
  flex: 1; overflow-y: auto; align-content: start;
  scroll-behavior: smooth;
}

/* Scroll-styled domain card */
.domain-card {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.92), rgba(238,230,216,0.92));
  border: 1.5px solid rgba(201,169,110,0.4);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative; overflow: hidden;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(139,69,19,0.06);
  animation: fadeInUp 0.4s ease backwards;
  height: 100px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: space-between;
}
.home-domains .domain-card:nth-child(1) { animation-delay: 0.02s; }
.home-domains .domain-card:nth-child(2) { animation-delay: 0.06s; }
.home-domains .domain-card:nth-child(3) { animation-delay: 0.10s; }
.home-domains .domain-card:nth-child(4) { animation-delay: 0.14s; }
.home-domains .domain-card:nth-child(5) { animation-delay: 0.18s; }
.home-domains .domain-card:nth-child(6) { animation-delay: 0.22s; }
.home-domains .domain-card:nth-child(7) { animation-delay: 0.26s; }
.home-domains .domain-card:nth-child(8) { animation-delay: 0.30s; }
.home-domains .domain-card:nth-child(9) { animation-delay: 0.34s; }
.home-domains .domain-card:nth-child(10) { animation-delay: 0.38s; }
.domain-card:hover, .domain-card:active {
  border-color: var(--jin-se);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(201,169,110,0.2);
}

/* Bamboo-slip top border */
.domain-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg,
    transparent 5%, var(--jin-se) 20%, var(--jin-se) 80%, transparent 95%);
  opacity: 0.5;
}

/* Scroll roll ends at bottom */
.domain-card::after {
  content: '⊘'; position: absolute; bottom: -4px; left: 50%;
  transform: translateX(-50%);
  font-size: 18px; color: var(--jin-se); opacity: 0.2;
}

/* Domain card icon - uses <img> tag, rendered by JS */
.domain-icon { display: block; flex-shrink: 0; }
.domain-icon img { width: var(--icon-md); height: var(--icon-md); object-fit: contain; }
.domain-name { font-size: 12px; color: var(--mo-hei); font-weight: 700; letter-spacing: 1px; flex-shrink: 0; }
.domain-desc { font-size: 8px; color: var(--zhe-shi); line-height: 1.3; flex-shrink: 0; }
.domain-status { font-size: 9px; color: var(--jin-se); font-weight: 600; flex-shrink: 0; }

.domain-card.locked {
  opacity: 0.4; filter: grayscale(40%);
}
.domain-card.locked::after {
  content: '🔒'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 32px; opacity: 0.6;
}

/* ===== Bottom Function Buttons (Scroll-style) ===== */
.home-func-btns {
  display: flex; gap: 8px;
  padding: 4px 16px 8px; z-index: 2; flex-shrink: 0;
}
.func-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 8px;
  background: linear-gradient(180deg,
    rgba(245,240,232,0.92), rgba(232,224,208,0.92));
  border: 1.5px solid rgba(201,169,110,0.45);
  border-radius: var(--radius);
  cursor: pointer; transition: all 0.3s;
  font-size: 10px; color: var(--mo-hei); font-weight: 600;
  letter-spacing: 0.5px;
  position: relative;
}
/* Scroll roll effect */
.func-btn::before {
  content: ''; position: absolute; top: -3px; left: 6px; right: 6px; height: 5px;
  background: linear-gradient(90deg,
    transparent, var(--jin-se), transparent);
  border-radius: 3px; opacity: 0.3;
}
.func-btn:hover, .func-btn:active {
  border-color: var(--jin-se);
  background: linear-gradient(180deg,
    rgba(255,248,240,0.95), rgba(245,235,220,0.95));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201,169,110,0.15);
}
/* Func button icon - uses <img> tag via inline style */
.func-btn-icon { display: inline-block; width: var(--icon-sm); height: var(--icon-sm);
  vertical-align: middle; object-fit: contain; }
.func-btn-icon img { width: 100%; height: 100%; object-fit: contain; }
.home-func-btns .func-btn {
  animation: fadeInUp 0.4s ease backwards;
}
.home-func-btns .func-btn:nth-child(1) { animation-delay: 0.24s; }
.home-func-btns .func-btn:nth-child(2) { animation-delay: 0.30s; }
.home-func-btns .func-btn:nth-child(3) { animation-delay: 0.36s; }

/* ========================================
   SCREEN 2: DOMAIN DETAIL (域详情)
   ======================================== */
#screen-domain { background: var(--xuan-zhi); }

/* ===== Unit Card ===== */
.unit-card {
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.35);
  border-radius: var(--radius);
  padding: 14px 14px 12px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(139,69,19,0.04);
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  animation: fadeInUp 0.35s ease backwards;
}
#domain-units .unit-card:nth-child(1) { animation-delay: 0.03s; }
#domain-units .unit-card:nth-child(2) { animation-delay: 0.06s; }
#domain-units .unit-card:nth-child(3) { animation-delay: 0.09s; }
#domain-units .unit-card:nth-child(4) { animation-delay: 0.12s; }
#domain-units .unit-card:nth-child(5) { animation-delay: 0.15s; }
#domain-units .unit-card:nth-child(6) { animation-delay: 0.18s; }
#domain-units .unit-card:nth-child(7) { animation-delay: 0.21s; }
#domain-units .unit-card:nth-child(8) { animation-delay: 0.24s; }
#domain-units .unit-card:nth-child(9) { animation-delay: 0.27s; }
#domain-units .unit-card:nth-child(10) { animation-delay: 0.30s; }
.unit-card:hover { border-color: rgba(201,169,110,0.55); transform: translateX(3px); }
.unit-info { margin-bottom: 6px; }
.unit-name { font-size: 14px; color: var(--mo-hei); font-weight: 600; }
.unit-status { font-size: 10px; color: var(--zhe-shi); margin-top: 2px; }
.unit-meta { font-size: 10px; color: var(--jin-se); margin-bottom: 6px; }
.unit-actions { display: flex; gap: 6px; }

.unit-card.boss-card {
  border-color: var(--jin-se);
  background: linear-gradient(135deg,
    rgba(201,169,110,0.08), rgba(196,30,58,0.04));
}

.reward-banner {
  background: linear-gradient(90deg,
    rgba(201,169,110,0.15), rgba(196,30,58,0.08));
  border: 1.5px solid var(--jin-se);
  border-radius: var(--radius);
  padding: 14px; text-align: center;
  font-size: 13px; color: var(--zhu-sha); font-weight: 700;
  margin-top: 8px; letter-spacing: 1px;
}

/* ========================================
   SCREEN 3: STUDY (精读)
   ======================================== */
.study-card {
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.35);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  position: relative;
  animation: fadeInUp 0.4s ease;
}
.study-label {
  font-size: 13px; color: var(--zhu-sha); font-weight: 700;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(201,169,110,0.2);
}
.study-content {
  font-size: 13px; color: var(--mo-hei); line-height: 1.9;
  white-space: pre-wrap;
}
.study-song {
  font-size: 13px; color: var(--zhe-shi); line-height: 2;
  background: rgba(201,169,110,0.07);
  padding: 12px; border-radius: var(--radius-sm);
  border-left: 3px solid var(--jin-se);
  white-space: pre-wrap;
  font-family: var(--font-title);
}

.song-card { background: rgba(245,240,232,0.6); }

/* ========================================
   SCREEN 4: BATTLE (闯关战斗 · 打怪刷题)
   ======================================== */
#screen-battle {
  background: linear-gradient(180deg,
    rgba(240,232,218,0.95) 0%,
    rgba(232,224,210,0.95) 50%,
    rgba(245,240,232,0.95) 100%);
}

.battle-top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 6px; flex-shrink: 0;
}
.battle-stage-name {
  flex: 1; font-size: 15px; color: var(--zhu-sha);
  font-weight: 700; font-family: var(--font-title); letter-spacing: 2px;
}
.battle-score { font-size: 12px; color: var(--jin-se); font-weight: 700; }

.battle-progress { padding: 0 16px 8px; flex-shrink: 0; }
.progress-label { font-size: 10px; color: var(--zhe-shi); margin-top: 3px; text-align: right; }

/* ===== Battle Arena ===== */
.battle-arena {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 24px 6px; flex-shrink: 0;
}

/* Player (left) */
.battle-player { text-align: center; width: 72px; }
.battle-player-icon {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, #E8DDD0, #D4C5B0);
  border: 3px solid var(--shi-qing);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto;
  box-shadow: 0 2px 10px rgba(22,133,169,0.2);
}
.battle-player-name {
  font-size: 11px; color: var(--mo-hei); margin-top: 4px;
  font-weight: 600; letter-spacing: 1px;
}

/* VS divider with calligraphy style */
.battle-vs {
  font-size: 34px; color: var(--zhu-sha);
  font-family: var(--font-title); opacity: 0.35;
  font-weight: 700; letter-spacing: 6px;
  text-shadow: 2px 2px 4px rgba(196,30,58,0.1);
  writing-mode: vertical-lr;
  transform: scaleX(-1);
}

/* Monster (right) */
.battle-monster { text-align: center; width: 72px; }
.battle-monster-icon {
  width: 66px; height: 66px; border-radius: 50%;
  background: linear-gradient(135deg, #3A2A1A, #5A3A2A);
  border: 3px solid var(--zhu-sha);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; margin: 0 auto;
  animation: monsterFloat 3s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(196,30,58,0.2);
}
@keyframes monsterFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes monsterHit {
  0% { transform: translateX(0) scale(1); }
  15% { transform: translateX(-8px) scale(0.92); border-color: #fff; }
  30% { transform: translateX(6px) scale(0.95); }
  45% { transform: translateX(-4px) scale(0.97); }
  60% { transform: translateX(3px) scale(0.99); }
  80% { transform: translateX(-2px) scale(1); }
  100% { transform: translateX(0) scale(1); }
}
.battle-monster-name {
  font-size: 10px; color: var(--zhu-sha); margin-top: 4px;
  font-weight: 700; letter-spacing: 0.5px;
}

/* Monster HP bar */
.monster-hp-bar {
  width: 70px; height: 5px;
  background: rgba(139,69,19,0.15);
  border-radius: 3px; margin: 5px auto 0; overflow: hidden;
  border: 1px solid rgba(196,30,58,0.25);
}
.monster-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--zhu-sha), var(--zhu-sha-light));
  border-radius: 3px; transition: width 0.5s ease;
}

/* ===== Question Panel (Scroll-style popup) ===== */
.question-panel {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.97), rgba(238,230,216,0.97));
  margin: 4px 14px 10px;
  border-radius: var(--radius);
  border: 2px solid rgba(201,169,110,0.45);
  padding: 14px; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(139,69,19,0.06);
  position: relative;
}
/* Four-corner decorative ornaments */
.question-panel::before {
  content: '❋'; position: absolute; top: -2px; right: 8px;
  font-size: 14px; color: var(--jin-se); opacity: 0.25;
}
.question-panel::after {
  content: '❋'; position: absolute; bottom: -2px; left: 8px;
  font-size: 12px; color: var(--jin-se); opacity: 0.2;
  transform: rotate(180deg);
}

.question-title {
  font-size: 10px; color: var(--zhu-sha);
  font-weight: 600; margin-bottom: 6px;
  display: inline-block; padding: 2px 8px;
  background: rgba(196,30,58,0.06);
  border-radius: 4px;
}
.question-text {
  font-size: 14px; color: var(--mo-hei);
  line-height: 1.7; font-weight: 500; margin-bottom: 2px;
}

.question-options {
  margin-top: 10px; display: flex;
  flex-direction: column; gap: 7px;
}

.opt-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(201,169,110,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.25s;
  font-size: 13px; color: var(--mo-hei);
}
.opt-btn:hover { border-color: var(--jin-se); background: rgba(255,248,240,0.85); }
.opt-btn:active { transform: scale(0.98); }
.opt-btn.correct { border-color: var(--correct); background: var(--correct-light); color: var(--correct); }
.opt-btn.wrong { border-color: var(--wrong); background: var(--wrong-light); color: var(--wrong); }

.opt-label {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(201,169,110,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  font-family: var(--font-title);
}
.opt-btn.correct .opt-label { background: var(--correct); color: #fff; }
.opt-btn.wrong .opt-label { background: var(--wrong); color: #fff; }

.next-question-btn {
  margin: 4px 14px 16px; padding: 12px;
  background: linear-gradient(135deg, var(--jin-se), #d4a65a);
  color: #fff; border: none;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  cursor: pointer; width: calc(100% - 28px);
  transition: all 0.25s;
  box-shadow: 0 4px 12px rgba(201,169,110,0.3);
  flex-shrink: 0;
}
.next-question-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(201,169,110,0.4); }
.next-question-btn:active { transform: translateY(0); }

/* ===== Review Popup (overlay) ===== */
.review-popup {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 390px; height: 844px;
  background: rgba(26,26,26,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.review-popup.active { display: flex; opacity: 1; }

.review-card-inner {
  background: var(--xuan-zhi);
  border-radius: var(--radius-lg);
  padding: 20px; width: 100%; max-width: 340px;
  border: 2px solid var(--jin-se);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: fadeInUp 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.review-title {
  font-size: 15px; color: var(--zhu-sha); font-weight: 700;
  margin-bottom: 10px; text-align: center; font-family: var(--font-title);
  letter-spacing: 2px;
}
.review-content {
  font-size: 13px; color: var(--mo-hei); line-height: 1.8;
  margin-bottom: 10px; padding: 10px;
  background: rgba(201,169,110,0.06);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--zhu-sha);
}
.review-source { font-size: 10px; color: var(--zhe-shi); text-align: right; margin-bottom: 16px; }
.review-close-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-md);
  background: var(--zhu-sha); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.review-close-btn:active { background: #b82020; }

/* ===== Home Registration Section ===== */
.home-reg-section {
  margin-bottom: 6px;
  padding: 5px 6px;
  background: rgba(196,30,58,0.05);
  border-radius: var(--radius-md);
  border: 0.5px solid rgba(196,30,58,0.2);
  z-index: 2; flex-shrink: 0;
}
.reg-entry-btn {
  width: 100%;
  padding: 5px 8px;
  background: linear-gradient(135deg, var(--zhu-sha), #a81a30);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 7px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(196,30,58,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.reg-entry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(196,30,58,0.4);
}
.reg-entry-btn:active {
  transform: translateY(0);
  box-shadow: 0 0.5px 2px rgba(196,30,58,0.3);
}
.reg-status {
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
  color: var(--correct);
}

/* ===== Registration Popup ===== */
.registration-popup {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,26,26,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.registration-popup.active { display: flex; opacity: 1; }

.reg-card-inner {
  background: var(--xuan-zhi);
  border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 340px;
  border: 2px solid var(--jin-se);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: fadeInUp 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.reg-title {
  font-size: 16px; color: var(--zhu-sha); font-weight: 700;
  margin-bottom: 8px; text-align: center; font-family: var(--font-title);
  letter-spacing: 2px;
}
.reg-desc {
  font-size: 12px; color: #666; text-align: center;
  margin-bottom: 20px;
}
.reg-input {
  width: 100%; padding: 14px;
  border: 2px solid var(--jin-se);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: rgba(201,169,110,0.05);
  color: var(--mo-hei);
  box-sizing: border-box;
  margin-bottom: 12px;
  font-family: monospace;
}
.reg-input:focus {
  outline: none;
  border-color: var(--zhu-sha);
  box-shadow: 0 0 0 3px rgba(196,30,58,0.1);
}
.reg-message {
  font-size: 12px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 16px;
}
.reg-message.success { color: var(--correct); }
.reg-message.error { color: var(--zhu-sha); }
.reg-btn {
  width: 100%; padding: 12px; border-radius: var(--radius-md);
  background: var(--jin-se); color: #fff; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 8px;
}
.reg-btn:active { background: #b8956e; }
.reg-cancel-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-md);
  background: transparent; color: #666; border: 1px solid #ddd;
  font-size: 13px; cursor: pointer;
  transition: all 0.2s;
}
.reg-cancel-btn:active { background: #f5f5f5; }

/* ===== Battle Result Overlay ===== */
.battle-result {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 390px; height: 844px;
  background: rgba(26,26,26,0.65);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.battle-result.active { display: flex; opacity: 1; }

.result-card {
  text-align: center;
  background: linear-gradient(180deg, var(--xuan-zhi-light), var(--xuan-zhi-dark));
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  border: 3px solid var(--jin-se);
  width: 320px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  position: relative;
  animation: fadeInUp 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.result-card::before {
  content: ''; position: absolute; inset: 6px;
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: var(--radius-sm);
  pointer-events: none;
}
.result-icon { font-size: 56px; margin-bottom: 8px; }
.result-title { font-size: 22px; color: var(--zhu-sha); font-weight: 700; margin-bottom: 8px; font-family: var(--font-title); letter-spacing: 2px; }
.result-desc { font-size: 12px; color: var(--zhe-shi); margin-bottom: 12px; line-height: 1.5; }
.result-score { font-size: 13px; color: var(--mo-hei); margin-bottom: 16px; }
.result-btn {
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--zhu-sha), var(--zhu-sha-dark));
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-base); font-size: 14px; font-weight: 700;
  cursor: pointer; letter-spacing: 2px;
  box-shadow: 0 2px 12px rgba(196,30,58,0.25);
  transition: all 0.3s;
}
.result-btn:hover { background: linear-gradient(135deg, var(--zhu-sha-dark), #801020); transform: translateY(-1px); }

/* ========================================
   SCREEN 5: CARDS (卡牌对战)
   ======================================== */
#screen-cards {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.95) 0%,
    rgba(240,232,218,0.95) 50%,
    rgba(235,225,210,0.95) 100%);
}

.card-header {
  padding: 12px 14px 8px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.card-title { font-size: 15px; color: var(--zhu-sha); font-weight: 700; font-family: var(--font-title); letter-spacing: 2px; }
.card-turn { font-size: 11px; color: var(--jin-se); font-weight: 600; }

/* Player info strips */
.card-players {
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 14px; flex-shrink: 0;
}
.card-player {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: rgba(245,240,232,0.75);
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(201,169,110,0.3);
}
.card-player-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background-color: #E8DDD0;
  border: 2px solid var(--shi-qing);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-player-avatar.self {
  background-image: url('images/tx/wo.png');
  background-size: cover;
  background-position: center;
}
.card-player-info { flex: 1; }
.card-player-name { font-size: 12px; color: var(--mo-hei); font-weight: 600; }
.card-player-points { font-size: 10px; color: var(--zhe-shi); }
.card-player-badge {
  font-size: 9px; padding: 3px 8px;
  background: rgba(201,169,110,0.12);
  border-radius: 10px; color: var(--jin-se-dark); font-weight: 600;
}

/* Card round info */
.card-round-info {
  padding: 4px 14px; display: flex; justify-content: space-between;
  font-size: 10px; color: var(--zhe-shi); flex-shrink: 0;
}

/* Card area */
.card-area {
  flex: 1; padding: 4px 14px; overflow-y: auto; min-height: 0;
}
.card-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

/* Question display area */
.card-question-area { padding: 4px 14px; flex-shrink: 0; }
.card-question {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.96), rgba(238,230,216,0.96));
  border: 2px solid rgba(201,169,110,0.45);
  border-radius: var(--radius);
  padding: 12px; text-align: center;
  font-size: 13px; color: var(--mo-hei);
  transition: all 0.3s ease;
}
.card-question.hint {
  color: var(--zhe-shi); font-size: 12px; border-style: dashed;
}
.card-question.opponent-turn {
  border-color: var(--zhu-sha);
  background: linear-gradient(180deg, rgba(255,248,245,0.96), rgba(255,240,235,0.96));
  box-shadow: 0 0 12px rgba(196,30,58,0.08);
}
.card-question.player-turn {
  border-color: var(--shi-qing);
  background: linear-gradient(180deg, rgba(245,248,255,0.96), rgba(235,245,250,0.96));
  box-shadow: 0 0 12px rgba(22,133,169,0.08);
}
.card-question .cq-whose-turn {
  font-size: 11px; font-weight: 700; margin-bottom: 6px;
  padding: 3px 10px; border-radius: 10px; display: inline-block;
}
.card-question .cq-whose-turn.player { background: rgba(22,133,169,0.1); color: var(--shi-qing); }
.card-question .cq-whose-turn.opponent { background: rgba(196,30,58,0.1); color: var(--zhu-sha); }
.card-question.result .cq-icon { font-size: 32px; margin-bottom: 6px; }
.card-question.result .cq-answer {
  font-size: 12px; color: var(--mo-hei); line-height: 1.7;
  margin-bottom: 8px;
  background: rgba(201,169,110,0.08);
  padding: 10px; border-radius: var(--radius-sm);
}
.cq-type { font-size: 10px; color: var(--zhu-sha); font-weight: 600; margin-bottom: 4px; }
.cq-q { font-size: 13px; margin-bottom: 8px; line-height: 1.5; }
.cq-actions { display: flex; gap: 8px; }

/* Answer buttons bar */
.card-answer-bar {
  display: flex; gap: 8px; padding: 4px 14px 6px; flex-shrink: 0;
}
.card-answer-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-base);
  font-size: 13px; font-weight: 600; border: 1.5px solid;
  transition: all 0.25s; letter-spacing: 1px;
}
.card-answer-btn.correct {
  background: var(--correct-light); border-color: var(--correct); color: var(--correct);
}
.card-answer-btn.wrong {
  background: var(--wrong-light); border-color: var(--wrong); color: var(--wrong);
}
.card-answer-btn:active { transform: scale(0.96); }

/* Action buttons */
.card-actions {
  display: flex; gap: 8px;
  padding: 4px 14px 10px; flex-shrink: 0;
}
.card-action-btn {
  flex: 1; padding: 10px; text-align: center;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-base); font-size: 11px; font-weight: 700;
  border: 1.5px solid; transition: all 0.3s; letter-spacing: 0.5px;
}
.card-action-btn:active { transform: scale(0.96); }
.card-action-btn.draw { background: rgba(22,133,169,0.08); border-color: var(--shi-qing); color: var(--shi-qing); }
.card-action-btn.end { background: rgba(201,169,110,0.1); border-color: var(--jin-se); color: var(--zhe-shi); }

/* Game card styling */
/* Card ink splash on hover */
.game-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg,
    rgba(255,251,245,0.95), rgba(245,237,228,0.95));
  border: 2px solid rgba(201,169,110,0.45);
  border-radius: var(--radius-sm);
  padding: 8px 4px; cursor: pointer;
  transition: all 0.25s; position: relative; overflow: hidden;
  text-align: center; min-height: 88px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  box-shadow: 0 1px 6px rgba(139,69,19,0.04);
}
.game-card::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(201,169,110,0.15) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--jin-se); box-shadow: 0 6px 20px rgba(201,169,110,0.2), 0 0 0 1px rgba(201,169,110,0.1); }
.game-card:hover::after { opacity: 1; }
.game-card:active { transform: translateY(-1px) scale(0.97); }
.game-card.disabled { opacity: 0.5; cursor: default; }
.game-card.disabled:hover { transform: none; box-shadow: none; }
.game-card.disabled:hover::after { opacity: 0; }
.game-card .card-icon { display: block; margin: 0 auto 6px; }
.game-card .card-icon img { width: var(--icon-md); height: var(--icon-md); object-fit: contain; }
.game-card .card-type {
  font-size: 9px; padding: 1px 6px; border-radius: 3px;
  display: inline-block;
  background: rgba(196,30,58,0.06); color: var(--zhu-sha);
}
.game-card .card-title {
  font-size: 10px; color: var(--mo-hei);
  font-weight: 700; line-height: 1.2;
}
.game-card.type-basic { border-color: var(--shi-qing); }
.game-card.type-basic .card-type { color: var(--shi-qing); background: rgba(22,133,169,0.08); }
.game-card.type-trap { border-color: var(--zhu-sha); }
.game-card.type-trap .card-type { color: var(--zhu-sha); background: rgba(196,30,58,0.06); }
.game-card.type-skill { border-color: var(--jin-se); }
.game-card.type-skill .card-type { color: var(--zhe-shi); background: rgba(201,169,110,0.12); }

/* Inner card decoration */
.game-card::before {
  content: ''; position: absolute; inset: 3px;
  border: 1px solid rgba(201,169,110,0.18);
  border-radius: 5px; pointer-events: none;
}

/* Weak/Mistake card lists */
.weak-list, .mistake-list { text-align: left; margin-top: 8px; }
.weak-title, .mistake-title { font-size: 12px; color: var(--zhu-sha); font-weight: 700; margin-bottom: 6px; font-family: var(--font-title); letter-spacing: 1px; }
.weak-item, .mistake-item {
  font-size: 11px; color: var(--mo-hei); margin-bottom: 5px;
  padding: 6px 8px; background: rgba(201,169,110,0.06);
  border-radius: var(--radius-sm); line-height: 1.5;
}
.mistake-q { font-weight: 600; margin-bottom: 2px; }
.mistake-ans { color: var(--zhu-sha); font-size: 10px; }
.mistake-exp { color: var(--zhe-shi); font-size: 10px; margin-top: 2px; }

/* ========================================
   SCREEN 6: TREASURE (寻宝棋盘)
   ======================================== */
#screen-treasure { background: var(--xuan-zhi); }

.treasure-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px; padding: 8px 16px; flex-shrink: 0;
}

.map-cell {
  aspect-ratio: 1; border-radius: 6px;
  background: rgba(201,169,110,0.08);
  border: 2px solid rgba(201,169,110,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}
/* Treasure type indicator (bottom border color) */
.map-cell[data-type="rare"] { border-bottom-color: #2E7D32; }
.map-cell[data-type="epic"] { border-bottom-color: #7B2D8B; }
.map-cell[data-type="legendary"] { border-bottom-color: #C9A96E; }
.map-cell[data-type="fog"] { border-bottom-color: rgba(200,200,200,0.5); }
.map-cell[data-type="study"] { border-bottom-color: var(--shi-qing); }
.map-cell[data-type="common"] { border-bottom-color: rgba(201,169,110,0.3); }

.map-cell::after {
  content: ''; position: absolute; inset: 3px;
  border-radius: 3px;
  border: 1px solid rgba(201,169,110,0.1);
  pointer-events: none;
}
.map-cell:hover { border-color: var(--jin-se); transform: scale(1.12); z-index: 2; box-shadow: 0 4px 14px rgba(201,169,110,0.2); }
.map-cell.here {
  border-color: var(--shi-qing);
  background: rgba(22,133,169,0.12);
  box-shadow: 0 0 10px rgba(22,133,169,0.25);
  animation: pulse 2s ease-in-out infinite;
  z-index: 1;
}
.map-cell.here::before {
  content: ''; position: absolute; inset: -3px;
  border-radius: 9px;
  border: 2px solid rgba(22,133,169,0.2);
  animation: pulse 2s ease-in-out infinite 0.5s;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(22,133,169,0.15); }
  50% { box-shadow: 0 0 16px rgba(22,133,169,0.35); }
}
.map-cell.found { opacity: 0.6; filter: saturate(0.6); }
.map-cell:active { transform: scale(0.92); }

.treasure-info { padding: 4px 16px; flex-shrink: 0; }
.treasure-info-card {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.92), rgba(238,230,216,0.92));
  border: 1.5px solid rgba(201,169,110,0.35);
  border-radius: var(--radius-sm);
  padding: 10px; text-align: center;
}
.treasure-name { font-size: 13px; color: var(--mo-hei); font-weight: 700; }
.treasure-type { font-size: 10px; color: var(--jin-se); }
.treasure-desc { font-size: 11px; color: var(--zhe-shi); margin-top: 4px; }
.treasure-warn { font-size: 10px; color: var(--zhu-sha); margin-top: 4px; }
.treasure-found { font-size: 11px; color: var(--correct); margin-top: 4px; }

/* Fog quiz */
.fog-quiz {
  background: linear-gradient(180deg,
    rgba(245,240,232,0.96), rgba(238,230,216,0.96));
  border: 2px solid var(--jin-se);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 8px;
}
.fog-title { font-size: 14px; color: var(--zhu-sha); font-weight: 700; margin-bottom: 8px; text-align: center; }
.fog-q { font-size: 13px; color: var(--mo-hei); margin-bottom: 10px; line-height: 1.6; }
.fog-correct { color: var(--correct); font-weight: 600; text-align: center; padding: 6px; }
.fog-wrong { color: var(--wrong); font-weight: 600; text-align: center; padding: 6px; }

/* ========================================
   SCREEN 7: EXAM (终极试炼模拟)
   ======================================== */
#screen-exam { background: var(--xuan-zhi); }

.exam-question-card {
  background: var(--card-bg);
  border: 2px solid rgba(201,169,110,0.35);
  border-radius: var(--radius);
  padding: 16px;
}
.exam-question {
  font-size: 14px; color: var(--mo-hei);
  line-height: 1.7; margin-bottom: 14px; font-weight: 500;
}
.exam-options { display: flex; flex-direction: column; gap: 7px; }
.exam-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(201,169,110,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.25s;
  font-size: 13px; color: var(--mo-hei);
}
.exam-opt:hover { border-color: var(--jin-se); }
.exam-opt.selected {
  border-color: var(--zhu-sha);
  background: rgba(196,30,58,0.06);
  color: var(--zhu-sha);
}
.exam-opt.selected .opt-label { background: var(--zhu-sha); color: #fff; }

.exam-nav {
  display: flex; gap: 6px;
  padding: 8px 14px 14px; flex-shrink: 0;
}
.exam-nav-btn {
  flex: 1; padding: 3px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-base);
  font-size: 8px; font-weight: 700;
  border: 1px solid; text-align: center;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.exam-nav-btn.primary { background: rgba(22,133,169,0.08); border-color: var(--shi-qing); color: var(--shi-qing); }
.exam-nav-btn.primary:hover { background: rgba(22,133,169,0.16); }
.exam-nav-btn.danger { background: rgba(196,30,58,0.06); border-color: var(--zhu-sha); color: var(--zhu-sha); }
.exam-nav-btn.danger:hover { background: rgba(196,30,58,0.12); }
.exam-nav-btn:active { transform: scale(0.94); }

/* ========================================
   SCREEN 8: CHECK-IN (每日打卡)
   ======================================== */
.checkin-banner {
  background: linear-gradient(135deg,
    rgba(201,169,110,0.12), rgba(196,30,58,0.06));
  border: 2px solid var(--jin-se);
  border-radius: var(--radius);
  padding: 18px; text-align: center; margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.checkin-banner::after {
  content: '☁️'; position: absolute; top: -6px; right: 8px;
  font-size: 16px; opacity: 0.1;
}
.checkin-status { font-size: 16px; color: var(--mo-hei); font-weight: 700; margin-bottom: 4px; }
.checkin-streak { font-size: 13px; color: var(--zhu-sha); margin-bottom: 10px; }

.checkin-rewards { margin-bottom: 12px; }
.checkin-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 4px;
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.25);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--mo-hei);
}
.checkin-item.unlocked { opacity: 0.55; }
.checkin-item.today {
  border-color: var(--jin-se);
  background: rgba(201,169,110,0.1);
}
.checkin-day { width: 50px; font-weight: 600; }
.checkin-icon { font-size: 18px; }
.checkin-reward { flex: 1; }
.checkin-check { font-size: 14px; }

.checkin-tasks { display: flex; flex-direction: column; gap: 6px; }
.checkin-task {
  padding: 8px 12px; background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.25);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--mo-hei);
}

/* ========================================
   SCREEN 9: INVENTORY (背包)
   ======================================== */
.inv-section-title {
  font-size: 14px; color: var(--zhu-sha); font-weight: 700;
  margin: 14px 0 8px; padding-bottom: 4px;
  border-bottom: 2px solid rgba(201,169,110,0.2);
  font-family: var(--font-title); letter-spacing: 2px;
}
.inv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.25);
  border-radius: var(--radius-sm);
}
.inv-icon { font-size: 24px; }
.inv-info { flex: 1; }
.inv-name { font-size: 12px; color: var(--mo-hei); font-weight: 600; }
.inv-desc { font-size: 10px; color: var(--zhe-shi); }
.inv-count { font-size: 14px; color: var(--jin-se); font-weight: 700; min-width: 24px; text-align: center; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.stat-item {
  padding: 8px; background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.25);
  border-radius: var(--radius-sm); font-size: 11px; color: var(--mo-hei);
}

.weak-section { margin-bottom: 8px; }
.weak-mini {
  font-size: 11px; color: var(--mo-hei);
  padding: 6px 8px; background: rgba(201,169,110,0.06);
  border-radius: var(--radius-sm); margin-bottom: 4px;
  line-height: 1.5;
}
.card-mini-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.card-mini {
  padding: 4px 8px; background: var(--card-bg);
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 4px; font-size: 10px; color: var(--mo-hei);
}

/* ===== Legacy Support for game.js references ===== */
#screen-cards .opt-btn { pointer-events: auto; }
#screen-cards .opt-btn.correct { pointer-events: none; }
#screen-cards .opt-btn.wrong { pointer-events: none; }

/* ========================================
   SCREEN 10: MIND MAP (思维导图)
   ======================================== */
#screen-mindmap { background: var(--xuan-zhi); }

.mindmap-subtitle {
  font-size: 11px;
  color: var(--zhe-shi);
  text-align: center;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}

.mindmap-domains {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.mindmap-domain-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: linear-gradient(180deg,
    rgba(245,240,232,0.92), rgba(238,230,216,0.92));
  border: 1.5px solid rgba(201,169,110,0.35);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  text-align: center;
}
.mindmap-domain-btn:hover {
  border-color: var(--jin-se);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201,169,110,0.15);
}
.mindmap-domain-btn .mindmap-icon { width: var(--icon-sm); height: var(--icon-sm); display: flex; align-items: center; justify-content: center; }
.mindmap-domain-btn .mindmap-icon img { width: 100%; height: 100%; object-fit: contain; }
.mindmap-domain-btn .mindmap-name {
  font-size: 10px;
  color: var(--mo-hei);
  font-weight: 600;
}

.mindmap-content-area {
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.35);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}

.mindmap-node {
  margin-bottom: 10px;
}
.mindmap-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(201,169,110,0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(201,169,110,0.2);
}
.mindmap-node-header:hover {
  background: rgba(201,169,110,0.15);
}
.mindmap-node-header .node-icon { font-size: 16px; }
.mindmap-node-header .node-title {
  font-size: 13px;
  color: var(--mo-hei);
  font-weight: 700;
  flex: 1;
}
.mindmap-node-header .node-toggle {
  font-size: 12px;
  color: var(--zhe-shi);
  transition: transform 0.3s;
}
.mindmap-node-header.expanded .node-toggle {
  transform: rotate(90deg);
}

.mindmap-children {
  display: none;
  padding-left: 16px;
  margin-top: 6px;
}
.mindmap-children.expanded {
  display: block;
}

.mindmap-child-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--shi-qing);
}
.mindmap-child-item .child-title {
  font-size: 12px;
  color: var(--mo-hei);
  font-weight: 600;
}
.mindmap-child-item .child-desc {
  font-size: 11px;
  color: var(--zhe-shi);
  line-height: 1.5;
  margin-top: 2px;
}

.mindmap-back-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(201,169,110,0.1);
  border: 1.5px solid rgba(201,169,110,0.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--zhe-shi);
  cursor: pointer;
  text-align: center;
  margin-bottom: 8px;
}
.mindmap-back-btn:hover {
  background: rgba(201,169,110,0.2);
}

/* ========================================
   SCREEN 11: MISTAKE BOOK (错题本)
   ======================================== */
#screen-mistakes { background: var(--xuan-zhi); }

.mistakes-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.mistakes-stat-item {
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
}
.mistakes-stat-item .stat-num {
  font-size: 20px;
  color: var(--zhu-sha);
  font-weight: 700;
}
.mistakes-stat-item .stat-label {
  font-size: 10px;
  color: var(--zhe-shi);
  margin-top: 2px;
}

.mistakes-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.mistakes-filter-btn {
  padding: 4px 12px;
  background: rgba(245,240,232,0.8);
  border: 1.5px solid rgba(201,169,110,0.3);
  border-radius: 16px;
  font-size: 11px;
  color: var(--mo-hei);
  cursor: pointer;
  transition: all 0.2s;
}
.mistakes-filter-btn:hover,
.mistakes-filter-btn.active {
  background: rgba(201,169,110,0.15);
  border-color: var(--jin-se);
  color: var(--zhe-shi);
}

.mistakes-list-section {
  margin-bottom: 12px;
}
.mistakes-section-title {
  font-size: 12px;
  color: var(--zhu-sha);
  font-weight: 700;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(201,169,110,0.2);
}

.mistake-card {
  background: var(--card-bg);
  border: 1.5px solid rgba(201,169,110,0.3);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}
.mistake-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.mistake-card-domain {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(201,169,110,0.12);
  border-radius: 10px;
  color: var(--zhe-shi);
}
.mistake-card-type {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(196,30,58,0.08);
  border-radius: 10px;
  color: var(--zhu-sha);
}
.mistake-card-q {
  font-size: 13px;
  color: var(--mo-hei);
  line-height: 1.6;
  margin-bottom: 8px;
  font-weight: 500;
}
.mistake-card-answers {
  background: rgba(201,169,110,0.06);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.mistake-your-answer {
  font-size: 11px;
  color: var(--wrong);
  margin-bottom: 4px;
}
.mistake-your-answer::before {
  content: '❌ ';
}
.mistake-correct-answer {
  font-size: 11px;
  color: var(--correct);
  margin-bottom: 6px;
}
.mistake-correct-answer::before {
  content: '✅ ';
}
.mistake-exp {
  font-size: 11px;
  color: var(--zhe-shi);
  line-height: 1.5;
  padding-top: 6px;
  border-top: 1px dashed rgba(201,169,110,0.2);
}
.mistake-exp-title {
  color: var(--shi-qing);
  font-weight: 600;
}

.mistakes-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--zhe-shi);
}
.mistakes-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.mistakes-empty-text {
  font-size: 14px;
  margin-bottom: 8px;
}
.mistakes-empty-hint {
  font-size: 11px;
  opacity: 0.7;
}
