/* 刀客学院导航栏（与 portal 一致） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; background: #f5f5f5; color: #333; }

.navbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: linear-gradient(135deg, #1e293b, #334155); color: #fff; }
.navbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 18px; font-weight: 700; }
.navbar-brand .logo { font-size: 22px; }
.navbar-links { display: flex; gap: 4px; flex-wrap: wrap; }
.navbar-links a { color: rgba(255,255,255,.75); text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 14px; transition: .2s; }
.navbar-links a:hover { background: rgba(255,255,255,.12); color: #fff; }
.navbar-links a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }

/* 访问码门禁（与 portal gate.js 一致） */
.gate-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.92); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity .4s; }
.gate-overlay.hidden { opacity: 0; pointer-events: none; }
.gate-box { background: #fff; padding: 32px 36px; border-radius: 16px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.gate-box.shake { animation: shake .5s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.gate-icon { font-size: 48px; margin-bottom: 8px; }
.gate-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.gate-subtitle { font-size: 14px; color: #666; margin-bottom: 16px; }
.gate-input { width: 200px; padding: 10px 14px; font-size: 18px; text-align: center; letter-spacing: 4px; border: 2px solid #ddd; border-radius: 8px; outline: none; }
.gate-input:focus { border-color: #6b21a8; }
.gate-btn { display: block; width: 200px; margin: 14px auto 0; padding: 10px; font-size: 16px; background: #6b21a8; color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.gate-btn:hover { background: #7c3aed; }

/* 页面主体 */
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { text-align: center; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin-bottom: 6px; }
.page-head .sub { font-size: 14px; color: #666; }

/* pattern 选择条 */
.pattern-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; justify-content: center; }
.pattern-chip { padding: 8px 14px; border: 2px solid #d1d5db; border-radius: 20px; background: #fff; font-size: 14px; cursor: pointer; transition: .2s; }
.pattern-chip:hover { border-color: #6b21a8; }
.pattern-chip.active { background: #6b21a8; color: #fff; border-color: #6b21a8; }
.pattern-chip .cnt { font-size: 12px; opacity: .7; margin-left: 4px; }

/* 会话头 */
.session-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding: 10px 16px; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.session-title { font-size: 18px; font-weight: 700; color: #6b21a8; }
.session-score { font-size: 16px; }
.session-score b { color: #6b21a8; font-size: 20px; }

/* 词卡网格 */
.card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 768px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.word-card { background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); border: 2px solid transparent; transition: .2s; display: flex; gap: 8px; align-items: stretch; }
.word-card.marked-correct { border-color: #22c55e; background: #f0fdf4; }
.word-card.marked-wrong { border-color: #ef4444; background: #fef2f2; }

.card-body { flex: 1; display: flex; flex-direction: column; align-items: center; }
.card-emoji { font-size: 40px; margin-bottom: 6px; line-height: 1; }
.card-write-line { width: 100%; height: 28px; border-bottom: 2px solid #333; margin-bottom: 4px; }
.card-answer { font-size: 16px; font-weight: 700; color: #1e293b; letter-spacing: 1px; min-height: 22px; }
.card-answer.hidden { visibility: hidden; }

.card-side { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: flex-start; }
.card-btn { padding: 6px 8px; font-size: 16px; border: 1px solid #ddd; border-radius: 6px; background: #fafafa; cursor: pointer; }
.card-btn:hover { background: #e9d5ff; }
.card-btn.hidden, .hidden { display: none !important; }
.card-judge { display: flex; flex-direction: column; gap: 2px; }
.judge { padding: 4px 6px; font-size: 16px; border: none; border-radius: 4px; cursor: pointer; background: none; }
.judge:disabled { opacity: .4; cursor: default; }
.card-mark { font-size: 16px; min-height: 20px; }

/* 底部提交 */
.session-foot { margin-top: 24px; text-align: center; }
.btn-primary { padding: 12px 32px; font-size: 16px; background: #6b21a8; color: #fff; border: none; border-radius: 10px; cursor: pointer; }
.btn-primary:disabled { background: #d1d5db; cursor: not-allowed; }
.btn-primary:hover:not(:disabled) { background: #7c3aed; }
.hint { display: block; margin-top: 8px; font-size: 13px; color: #888; }

/* 打印友好 */
@media print {
  .navbar, .pattern-bar, .session-foot, .card-btn, .page-head .sub { display: none !important; }
  .card-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .word-card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
  .card-answer { display: block !important; }
}

/* 看词读音模式 */
.read-card { border-color: #e8b84b; }
.read-card .card-body { min-height: 92px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; }
.card-word { font-size: 20px; font-weight: 600; letter-spacing: .5px; text-align:center; color:#2b2118; word-break: break-word; line-height:1.3; }
.card-pic { font-size: 46px; line-height: 1.1; text-align:center; }

/* 中文释义 */
.card-gloss { font-size: 12px; color: #8a6f52; text-align: center; margin-top: 2px; line-height: 1.2; }
.read-card .card-gloss { font-size: 13px; }
