/* 成语接龙：对局板／侧栏／龙迹三区布局，设计语言对齐 legacy chain.css。 */
:root { --chain: #157d73; --chain-soft: #eaf7f2; }
/* ── hero：青绿渐变卡，接龙主题色 ────────────────────────────────────── */
.chain-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  padding: 24px 28px;
  margin: 18px 0 20px;
  background:
    radial-gradient(ellipse at 92% 8%, #fff3d6, transparent 60%),
    linear-gradient(120deg, #ecf7f1, #e1f1e8);
  border: 1px solid #cfe8db;
  border-radius: 22px;
}
.chain-heading-copy { flex: 1 1 320px; min-width: 0; }
.chain-heading .chain-button { flex: 0 0 auto; }
.chain-eyebrow { color: var(--chain); font-size: 13px; font-weight: 800; letter-spacing: 2px; margin-bottom: 6px; }
.chain-heading h1 { font-size: clamp(26px, 2.2vw, 36px); font-weight: 900; }
.chain-heading p:last-child { color: var(--muted); font-size: 14px; margin-top: 6px; }
.chain-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chain-hero-stats span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid #cfe8db; font-size: 14px; color: #4a5550; }
.chain-hero-stats b { color: var(--chain); font-weight: 800; }
.chain-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 46px; padding: 11px 18px; border: 1px solid transparent; border-radius: 13px; font-size: 16px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: background .14s ease, border-color .14s ease, transform .14s ease; }
.chain-button.primary { color: #fff; background: var(--chain); box-shadow: 0 3px 0 #0d5e57; }
.chain-button.primary:hover { background: #106d64; }
.chain-button.secondary { background: #fff; border-color: var(--line); }
.chain-button.secondary:hover { background: #f1f5fb; }
.chain-button:active { transform: translateY(2px); }
button:disabled { cursor: default; opacity: .5; }
.chain-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: 'game side' 'trail side'; align-items: start; gap: 24px; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 22px; }
.game-panel { grid-area: game; padding: clamp(20px, 2.3vw, 36px); border-top: 4px solid #3daf92; }
.round-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.turn-label { background: var(--chain-soft); color: var(--chain); border-radius: 7px; padding: 4px 10px; font-size: 13px; font-weight: 800; }
.current-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.current-info { min-width: 0; }
.small-label { color: var(--muted); font-size: 13px; }
.current-word { display: flex; align-items: center; gap: 14px; max-width: 100%; border: none; background: transparent; margin: 6px 0; text-align: left; padding: 0; cursor: pointer; }
.current-word span:first-child { font-size: clamp(32px, 3.1vw, 52px); font-weight: 900; letter-spacing: 5px; white-space: nowrap; }
.current-word .tail { color: var(--chain); }
.current-word:hover .tail { text-decoration: underline; }
.read-icon { font-size: 20px; background: #f0f4fa; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; }
.current-pinyin { color: #77739a; font-size: 16px; overflow-wrap: anywhere; }
.next-target { flex: 0 0 100px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--chain-soft); border: 1px solid #cfebdf; border-radius: 18px; padding: 10px 14px; color: var(--chain); }
.next-target span { font-size: 11px; font-weight: 700; }
.next-target strong { font-size: 42px; line-height: 1.3; }
.current-meaning { color: #60697f; font-size: 15px; line-height: 1.8; max-width: 70ch; margin: 18px 0 24px; padding: 14px 16px; background: #f7f9fc; border-radius: 12px; overflow-wrap: anywhere; }
.answer-label { display: block; font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.answer-row { display: flex; gap: 10px; max-width: 900px; }
#chain-word { width: 100%; min-width: 0; flex: 1; border: 2px solid #dce5ea; border-radius: 14px; background: #fff; padding: 12px 16px; font-size: 22px; font-weight: 700; letter-spacing: 2px; }
#chain-word:focus { border-color: var(--chain); box-shadow: 0 0 0 3px #157d7318; }
#chain-word:disabled { background: #f6f8fb; }
.feedback { min-height: 29px; margin: 12px 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.feedback.success { color: #187451; }
.feedback.error { color: #b04d30; }
.answer-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hint-button { min-height: 42px; background: #fff7e4; color: #92641f; border: 1px solid #f1dfb9; padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
#chain-rule { color: var(--muted); font-size: 12px; }
.hint-panel { margin-top: 24px; padding: 18px; background: #fffaf0; border: 1px solid #f0e4c7; border-radius: 16px; }
.hint-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hint-heading h2 { font-size: 16px; }
.hint-heading button { border: none; background: none; padding: 6px; color: #8b7956; font-size: 13px; cursor: pointer; }
.hint-panel > p { color: #8b7956; font-size: 14px; margin: 6px 0 14px; }
.hint-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.hint-choice { display: flex; flex-direction: column; gap: 7px; min-width: 0; border: 1px solid #e9dfca; border-radius: 12px; background: #fff; padding: 14px; text-align: left; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.hint-choice:hover, .hint-choice:focus-within { border-color: #ba9c58; transform: translateY(-2px); box-shadow: 0 4px 10px #233e3712; }
/* 提示词本身可点读（呼应面板说明「点成语听读音」）。 */
.hint-word { display: inline-flex; align-self: flex-start; max-width: 100%; margin: -2px -4px; padding: 2px 4px; border: 0; border-radius: 9px; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; transition: background .14s ease; }
.hint-word strong { font-size: 18px; }
.hint-word:hover { background: #f6efdd; }
.hint-choice .hint-pinyin { color: #77739a; font-size: 12px; }
.hint-choice .hint-meaning { color: #717589; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.hint-fill { color: var(--chain); font-size: 12px; font-weight: 700; margin-top: auto; border: none; background: none; padding: 0; text-align: left; cursor: pointer; }
.round-end { margin-top: 24px; padding: 22px; background: #eaf7f1; border: 1px solid #bfdfcd; border-radius: 16px; }
.round-end h2 { font-size: 20px; }
.round-end p { font-size: 14px; line-height: 1.8; color: #567866; margin: 10px 0 16px; }
.chain-aside { grid-area: side; display: grid; gap: 18px; position: sticky; top: 104px; }
.record-panel, .rules-panel, .history-panel { padding: 22px; }
.chain-aside h2 { font-size: 17px; font-weight: 800; }
.round-score { display: flex; align-items: baseline; gap: 12px; margin: 18px 0; }
.round-score strong { font-size: 54px; line-height: 1.2; color: var(--chain); font-variant-numeric: tabular-nums; }
.round-score > span { font-size: 13px; color: var(--muted); }
.record-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.record-grid dt { color: var(--muted); font-size: 12px; }
.record-grid dd { font-size: 24px; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.record-caption { color: var(--muted); font-size: 14px; margin-top: 14px; line-height: 1.8; }
.rules-panel ol { padding-left: 20px; margin: 16px 0; color: #687287; font-size: 14px; }
.rules-panel li + li { margin-top: 10px; }
.rule-example { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; background: #f5f8fc; border-radius: 12px; font-size: 18px; font-weight: 800; letter-spacing: 2px; }
.rule-example b { color: var(--chain); }
.rule-example span:nth-child(2) { font-size: 13px; color: #98a8b7; }
.dictionary-note { font-size: 14px; color: var(--muted); margin-top: 16px; line-height: 1.8; }
.chain-history { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.chain-history li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); color: var(--muted); }
.trail-panel { grid-area: trail; padding: 24px; }
.trail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.trail-heading h2 { font-size: 19px; }
.trail-heading p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.trail-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.trail-entry { min-width: 0; padding: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.trail-entry:hover { transform: translateY(-2px); border-color: #cfe0d8; box-shadow: 0 4px 10px #233e3710; }
.trail-entry.latest { border-color: #abd7c8; background: #f2faf6; }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #8b94a5; font-size: 11px; }
.entry-player { color: var(--chain); }
.entry-partner { color: #7569aa; }
.trail-word { display: block; border: none; background: none; max-width: 100%; font-size: 23px; font-weight: 800; letter-spacing: 2px; padding-block: 3px; text-align: left; cursor: pointer; padding: 0; }
.trail-word .tail { color: var(--chain); }
.trail-pinyin { font-size: 12px; color: #827c9f; margin-top: 3px; overflow-wrap: anywhere; }
.trail-meaning { font-size: 14px; color: #70798c; margin-top: 7px; line-height: 1.8; overflow-wrap: anywhere; }

@media (max-width: 1079px) {
  .chain-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'game' 'side' 'trail'; }
  .chain-aside { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 600px) {
  .chain-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 18px; }
  .chain-heading h1 { font-size: 22px; }
  .game-panel { padding: 16px; }
  .current-word span:first-child { font-size: 30px; letter-spacing: 2px; }
  .next-target { flex-basis: 64px; padding: 8px 6px; border-radius: 14px; }
  .next-target strong { font-size: 34px; }
  #chain-word { font-size: 19px; padding: 12px; letter-spacing: 1px; }
  .answer-row > .chain-button { padding-inline: 12px; font-size: 14px; }
  .chain-aside { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .rules-panel { display: none; }
  .trail-list { grid-template-columns: minmax(0, 1fr); }
}
.hint-dict { float: right; font-size: 11px; color: var(--chain); text-decoration: none; }
.hint-dict:hover { text-decoration: underline; }
a.trail-word { text-decoration: none; }
a.trail-word:hover .tail { text-decoration: underline; }

/* 模式切换：侧栏顶部分段选择器（记录面板上方）。 */
.chain-modes { display: flex; gap: 4px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.chain-modes a { flex: 1; display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: 6px 10px; border-radius: 999px; background: none; color: var(--muted); font-size: 15px; font-weight: 750; text-align: center; transition: background .14s ease, color .14s ease; }
.chain-modes a.on { background: var(--chain-soft); color: var(--chain); font-weight: 800; }
.chain-modes a:hover { color: var(--chain); }

/* 先手选择：说明在左，大按钮在右一眼可见。 */
.start-choice { display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; padding: 26px 30px; background: linear-gradient(120deg, #f4fbf7, #e9f5ef); border: 1px solid #cfe8db; border-radius: 18px; }
.start-copy { flex: 1 1 320px; min-width: 0; }
.start-choice h2 { margin: 0; }
.start-choice p { margin: 8px 0 0; color: var(--muted); line-height: 1.8; }
.start-buttons { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; }
.start-buttons .chain-button { min-height: 62px; min-width: 200px; padding: 14px 32px; font-size: 20px; box-shadow: 0 4px 0 #0d5e57; }
.start-buttons .chain-button:active { transform: translateY(2px); }
@media (max-width: 720px) {
  .start-choice { flex-direction: column; align-items: stretch; text-align: center; padding: 20px 18px; }
  .start-buttons { flex-direction: row; }
  .start-buttons .chain-button { flex: 1; min-width: 0; }
}

.round-score.duel-score { display: flex; gap: 34px; }
.round-score.duel-score div { display: flex; align-items: baseline; gap: 10px; }
.round-score.duel-score strong { font-size: 44px; }

/* flex 容器会覆盖 [hidden] 的默认 display:none，显式压住 */
.round-score[hidden], .start-choice[hidden] { display: none !important; }
