/* 朝代时光机 儿童化样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #3a2f28;
  --muted: #7a6a5a;
  --card: #ffffff;
  --red: #ff6b6b;
  --green: #58c98b;
  --gold: #ffb800;
}
html, body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #d9f0ff 0%, #fff8ec 55%, #ffe9d6 100%);
  min-height: 100vh;
}
.view { max-width: 900px; margin: 0 auto; padding: 16px 16px 48px; }
.hidden { display: none !important; }

.hero {
  background: linear-gradient(135deg, #ff9a6b, #ffcc70);
  border-radius: 26px; padding: 26px 22px; color: #fff; text-align: center;
  box-shadow: 0 10px 24px rgba(220,140,80,.28);
}
.hero-title { font-size: 30px; letter-spacing: 2px; }
.hero-sub { margin-top: 6px; font-size: 15px; opacity: .95; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.leg { background: rgba(255,255,255,.9); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; }

.card { background: var(--card); border-radius: 24px; padding: 22px; box-shadow: 0 8px 20px rgba(120,100,80,.12); margin-top: 18px; }
.card-title { font-size: 19px; font-weight: 800; }
.card-tip { font-size: 14px; color: var(--muted); margin: 4px 0 12px; }

.audio-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn { border: none; border-radius: 999px; font-size: 16px; font-weight: 700; padding: 12px 20px; cursor: pointer; color: #fff; transition: transform .12s, filter .12s; }
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, #58a6ff, #7ec8ff); }
.btn-ghost { background: #eef2f6; color: var(--ink); }

/* 朝代歌 */
.ge-lines { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ge-line { background: #faf6ee; border-radius: 12px; padding: 8px 14px; font-size: 17px; font-weight: 700; }
.ge-line.active { background: #fff3cf; color: #b07b00; }

/* Tabs */
.tabs { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 130px; background: #eef2f6; color: var(--ink); border: none; border-radius: 999px; padding: 12px 10px; font-size: 16px; font-weight: 800; cursor: pointer; }
.tab.active { background: linear-gradient(135deg, #58a6ff, #7ec8ff); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 朝代蛇形路径（一屏铺开 + 连接线） */
.snake { position: relative; }
.snake > svg { position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; overflow: visible; }
.dyn-node { position: absolute; z-index: 1; background: #fff; border: 3px solid; border-radius: 18px; padding: 10px 8px; text-align: center; cursor: pointer; transition: transform .15s; box-sizing: border-box; }
.dyn-node:hover { transform: translateY(-4px); }
.dyn-node .e { font-size: 34px; display: block; line-height: 1; }
.dyn-node .n { font-size: 17px; font-weight: 800; margin-top: 6px; line-height: 1.2; }
.dyn-node .y { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.25; overflow-wrap: break-word; }
.dyn-node .mark { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 2px 7px; z-index: 2; }

/* 时长对比 */
.length-list { display: flex; flex-direction: column; gap: 8px; }
.length-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.length-row .name { width: 108px; font-weight: 800; font-size: 16px; line-height: 1.2; text-align: right; flex-shrink: 0; overflow-wrap: break-word; }
.length-row .bar-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.length-row .bar { height: 26px; border-radius: 999px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 700; min-width: 8px; white-space: nowrap; }
.length-row .years { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* 排序游戏 */
.game-slots { display: flex; gap: 8px; flex-wrap: wrap; min-height: 70px; background: #faf6ee; border-radius: 16px; padding: 12px; margin-bottom: 16px; }
.game-slot { min-width: 110px; background: #fff; border: 2px dashed #d9c7aa; border-radius: 14px; padding: 12px; text-align: center; font-weight: 800; font-size: 16px; }
.game-slot .e { font-size: 30px; display: block; }
.game-slot.filled { border-style: solid; opacity: .9; }
.game-options { display: flex; flex-wrap: wrap; gap: 10px; }
.game-opt { background: #fff; border: 3px solid #e6d8bf; border-radius: 16px; padding: 14px 16px; font-size: 17px; font-weight: 800; cursor: pointer; transition: transform .1s; display: flex; align-items: center; gap: 8px; }
.game-opt:hover { transform: translateY(-2px); }
.game-opt .e { font-size: 28px; }
.game-opt.used { opacity: .3; pointer-events: none; }
.game-opt.wrong { animation: shake .3s; border-color: var(--red); }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.game-msg { margin-top: 12px; font-size: 17px; font-weight: 800; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-body { background: #fff; border-radius: 24px; max-width: 520px; width: 100%; padding: 26px; position: relative; box-shadow: 0 20px 40px rgba(0,0,0,.25); max-height: 90vh; overflow: auto; }
.modal-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border-radius: 999px; border: none; background: #eef2f6; font-size: 20px; cursor: pointer; }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.modal-emoji { font-size: 48px; }
.modal-name { font-size: 30px; font-weight: 800; }
.modal-era { font-size: 14px; color: var(--muted); }
.modal-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { background: #f0f4f8; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.chip-capital { background: #e9f6ef; }
.modal-section { margin-top: 12px; }
.modal-section.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.modal-label { font-size: 13px; color: var(--muted); }
.modal-text { font-size: 16px; line-height: 1.6; }
.sichuan-box { background: #fff6e0; border-left: 4px solid #ffb800; border-radius: 8px 14px 14px 8px; padding: 10px 12px; margin-top: 12px; }
.sichuan-box b { color: #b07b00; }

/* 五霸 / 七雄 成员清单 */
.modal-section.mb { margin-top: 12px; }
.members { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.member-chip {
  background: #f0f4f8; border-radius: 14px; padding: 8px 14px;
  display: inline-flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 17px;
}
.member-chip .mn { color: var(--ink); }
.member-chip .mp { font-size: 12px; color: var(--muted); font-weight: 600; }
.members-note { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* 国旗 */
.flag { display: inline-block; vertical-align: middle; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
