/* 顶部 nav 在主页样式基础上，横屏时左右分布 */
.top-nav {
  justify-content: space-between;
  gap: 8px;
}
.top-nav .btn-link + .btn-link { margin-left: 0; }

.sentence-main {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}

/* 级别选择条复用主页 picker 样式，宽度铺满 */
.sentence-main .picker {
  width: 100%;
  max-width: 720px;
}

/* 句子选择条：每个按钮显示一个完整句子 */
.sentence-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.sentence-tabs button {
  height: 38px;
  padding: 0 14px;
  font-size: 16px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  letter-spacing: 2px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.sentence-tabs button:hover {
  background: #faf7f1;
  border-color: var(--grid);
}
.sentence-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sentence-tabs .empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 4px;
}

.sentence-layout {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.right-pane {
  width: 100%;
  max-width: 540px;
  background: var(--paper);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 6px 20px rgba(40, 30, 20, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 句子练习的 svg 填满 stage */
#practice-svg {
  position: absolute;
  inset: 22px;
  width: calc(100% - 44px);
  height: calc(100% - 44px);
  z-index: 2;
  touch-action: none;     /* 让 pointer 事件不被浏览器拦截为滚动 */
  cursor: crosshair;
}

/* 字完成时整格闪一下 */
.char-done-flash {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  background: rgba(46, 139, 87, 0);
  transition: background .3s;
  z-index: 5;
}
.char-done-flash.flash { background: rgba(46, 139, 87, 0.18); }

/* 句子练习的参考字稍微大一点 */
.sentence-main .reference-char {
  width: 96px;
  height: 96px;
}

.sentence-controls { flex-wrap: wrap; }

/* 进度行 */
.progress-line {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* 句子预览：横排所有字 */
.sentence-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  padding: 6px 4px;
}
.sentence-preview .pv-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  font-size: 36px;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  color: var(--ink);
  border-radius: 10px;
  border: 2px solid transparent;
  background: #faf6ee;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.sentence-preview .pv-char.pending {
  color: #b8b1a6;
  background: #f3efe6;
}
.sentence-preview .pv-char.current {
  color: var(--accent);
  border-color: var(--accent);
  background: #fff;
  transform: translateY(-3px);
}
.sentence-preview .pv-char.done {
  color: #2e8b57;
  background: #eaf5ee;
}
.sentence-preview .pv-sep {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}

/* 欢庆覆盖层 */
.final-celebrate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.final-celebrate[hidden] { display: none; }
.final-inner {
  background: var(--paper);
  padding: 36px 48px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.final-emoji {
  font-size: 64px;
  animation: pop .4s ease;
}
.final-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 12px 0 22px;
  color: var(--ink);
}
.final-inner button {
  height: 46px;
  padding: 0 22px;
  font-size: 16px;
}
@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* confetti 碎片 */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
  opacity: 0.95;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===== 平板横屏适配：左右分栏 ===== */
@media (min-aspect-ratio: 13/10) and (min-width: 820px) {
  .sentence-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
  }
  .left-pane {
    flex: 0 0 auto;
  }
  .right-pane {
    flex: 1 1 360px;
    max-width: 460px;
    align-self: stretch;
  }
  .stage-wrap {
    width: min(60vmin, 520px);
    height: min(60vmin, 520px);
  }
  .sentence-preview .pv-char {
    width: 64px;
    height: 64px;
    font-size: 40px;
  }
  h1 { font-size: clamp(28px, 3vw, 38px); }
}

/* ===== 大屏 / 横屏平板：放宽主区域 ===== */
@media (min-width: 1100px) {
  .sentence-main { max-width: 1180px; }
}

/* ===== 窄屏手机：稍微紧凑 ===== */
@media (max-width: 480px) {
  .sentence-preview .pv-char {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }
}
