/* 小伴 H5 - 公共样式 */
:root {
  --primary: #6BC5A0; --primary-dark: #4AAF85; --primary-deeper: #3A9A6F;
  --primary-light: #E8F5EF; --primary-lighter: #F0FAF5; --primary-glow: rgba(107,197,160,0.3);
  --accent: #FFB347; --accent-light: #FFF5E6;
  --bg-page: #F5F9F5; --bg-card: #FFFFFF; --bg-sidebar: #FAFCFA;
  --border: #E0EDE0; --border-light: #EDF5ED;
  --text-title: #2D3D2D; --text-body: #4A5A4A; --text-secondary: #7A9A7A; --text-placeholder: #B0C8B0;
  --success: #2E7D32; --success-light: #E8F5E9;
  --warning: #FF7043; --warning-light: #FFF3E0;
  --gold: #8B7A2E; --gold-light: rgba(139,122,46,0.1);
  --purple: #7E57C2; --purple-light: #EDE7F6;
  --pink: #EC407A; --pink-light: #FCE4EC;
  --blue: #42A5F5; --blue-light: #E3F2FD;
  --orange: #FF7043; --orange-light: #FBE9E7;
  --cyan: #26C6DA; --cyan-light: #E0F7FA;
  --red: #EF5350; --red-light: #FFE5E5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  background: var(--bg-page);
  color: var(--text-title);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Liner Icon System */
.icon-wrap { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-wrap svg { width: 22px; height: 22px; }
.icon-wrap-sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-wrap-sm svg { width: 16px; height: 16px; }
.icon-green { background: var(--primary-light); }
.icon-green svg { fill: var(--primary-dark); }
.icon-blue { background: var(--blue-light); }
.icon-blue svg { fill: var(--blue); }
.icon-red { background: var(--red-light); }
.icon-red svg { fill: var(--red); }
.icon-purple { background: var(--purple-light); }
.icon-purple svg { fill: var(--purple); }
.icon-orange { background: var(--orange-light); }
.icon-orange svg { fill: var(--orange); }
.icon-gold { background: var(--gold-light); }
.icon-gold svg { fill: var(--gold); }
.icon-cyan { background: var(--cyan-light); }
.icon-cyan svg { fill: var(--cyan); }
.icon-pink { background: var(--pink-light); }
.icon-pink svg { fill: var(--pink); }
.icon-gray { background: #F0F0F0; }
.icon-gray svg { fill: #999; }
.icon-locked { background: #F0F0F0; }
.icon-locked svg { fill: #CCC; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  overscroll-behavior: contain; /* r37: 防止滚动穿透 */
  touch-action: none; /* r37: 阻止触摸事件传到底层 */
}
.modal-overlay.active { opacity: 1; pointer-events: auto; overflow: hidden; /* r37: 防止底层页面滚动 */ }
.modal-box {
  background: var(--bg-card); border-radius: 32px; padding: 24px;
  width: 420px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  transform: scale(0.95); transition: transform 0.2s;
  overscroll-behavior: contain; /* r37: 弹窗内滚动不穿透 */
  -webkit-overflow-scrolling: touch; /* r37: iOS平滑滚动 */
}
.modal-overlay.active .modal-box { transform: scale(1); }

/* r37: 弹窗打开时锁定body滚动 */
body.modal-open { overflow: hidden; position: fixed; width: 100%; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.btn { padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--bg-card); color: var(--text-body); border: 1.5px solid var(--border); }
.btn-danger { background: var(--red); color: white; }

/* Form */
.xb-form-card { background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden; }
.xb-form-row { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 12px; }
.xb-form-label { font-size: 14px; font-weight: 600; color: var(--text-title); flex-shrink: 0; width: 72px; text-align: left; }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text-body); margin-bottom: 6px; display: block; }
.form-input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 14px; outline: none; transition: border-color 0.2s; font-family: inherit; }
.form-input:focus { border-color: var(--primary); }
.form-select { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 14px; outline: none; background: #ffffff !important; color: var(--text-title); font-family: inherit; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* Toast */
.toast {
  position: fixed; top: 40px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--text-title); color: white; padding: 10px 24px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 2000; opacity: 0; transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Subject Colors */
.subject-chinese { color: var(--red); }
.subject-math { color: var(--blue); }
.subject-english { color: var(--green); }
.subject-sport { color: var(--orange); }
.subject-travel { color: var(--purple); }
