/* 新手引导与互动练习册：像翻开一本手作纸艺样本。 */
.guide-layout { display: grid; grid-template-columns: minmax(124px, 162px) minmax(0, 1fr); gap: var(--space-5); }
.guide-nav { display: flex; flex-direction: column; gap: 4px; }
.guide-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 11px;
  text-align: start;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
@media (hover: hover) {
  .guide-nav button:hover { background: var(--surface-3); color: var(--ink-1); }
}
.guide-nav button[aria-selected="true"], .guide-controls button[aria-pressed="true"], .guide-sheet[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.guide-nav .icon { flex: none; }
.guide-pane { min-width: 0; padding: 2px; }
.guide-pane p, .privacy-copy p { color: var(--ink-2); line-height: 1.65; margin: 12px 0; }

.guide-practice, .guide-sample {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  box-shadow: inset 0 1px 4px rgb(40 32 20 / .05);
}
:root[data-theme='dark'][data-night-paper='on'] .guide-practice { background: var(--paper-night); }
.guide-practice canvas { display: block; width: 100%; height: clamp(164px, 26dvh, 240px); touch-action: none; cursor: crosshair; }
.guide-hint {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  color: var(--ink-3);
  font-size: var(--text-l);
}
.guide-hint[hidden] { display: none; }

.guide-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.guide-tool-pair, .guide-history-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.guide-tool-pair {
  padding: 3px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-m);
  background: var(--surface-3);
}
.guide-tool-pair .btn {
  min-height: 36px;
  padding: 0 13px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.guide-tool-pair .btn[aria-pressed='true'] {
  background: var(--surface-2);
  border-color: var(--accent-line);
  color: var(--accent-ink);
  box-shadow: var(--shadow-1);
}
.guide-history-pair .btn {
  min-height: 36px;
  padding: 0 11px;
  color: var(--ink-2);
}

.guide-pane .btn { min-height: 40px; height: auto; white-space: normal; line-height: 1.3; }
.guide-status { min-height: 1.6em; }
.guide-papers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.guide-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  color: var(--ink-1);
  background: var(--surface-1);
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
}
@media (hover: hover) {
  .guide-sheet:hover { transform: translateY(-2px); border-color: var(--line-strong); }
}
.guide-sheet canvas { width: 100%; max-width: 90px; height: auto; display: block; box-shadow: var(--shadow-1); border-radius: 3px; }
.guide-sheet span { overflow-wrap: anywhere; font-size: var(--text-s); }

.guide-hands, .guide-path { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.guide-hands li, .guide-path span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  padding: 12px 6px;
  border-radius: var(--radius-m);
  text-align: center;
  overflow-wrap: anywhere;
}
.guide-hands svg { width: clamp(32px, 5vw, 55px); height: auto; stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.guide-path { grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 3px; }
.guide-path > .icon { width: 13px; }
.guide-path span .icon { color: var(--accent); }
.guide-sample canvas { display: block; width: 100%; height: auto; }
.guide-formats { margin: 0; display: grid; gap: 5px; }
.guide-formats div { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.guide-formats dt { color: var(--accent-ink); font-weight: 700; }
.guide-formats dd { color: var(--ink-2); margin: 0; }
.lib-section [data-deleted-book] { min-height: 52px; }
.privacy-copy h3 { margin-top: 1em; color: var(--ink-1); }
@media (max-width: 640px) {
  .guide-layout { display: block; }
  .guide-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin-bottom: 14px; }
  .guide-nav button { justify-content: center; text-align: center; padding: 5px 2px; min-height: 48px; flex-direction: column; gap: 2px; line-height: 1.2; font-size: var(--text-s); overflow-wrap: anywhere; }
  .guide-nav .icon { width: 17px; height: 17px; }
  .guide-papers { gap: 6px; }
}

.privacy-document { margin: 0; font: 17px/1.7 var(--font-ui); background: var(--surface-0); color: var(--ink-1); }
.privacy-document main { max-width: 40em; margin: 0 auto; padding: clamp(20px, 6vw, 64px) 22px 45px; }
.privacy-document h1, .privacy-document h2 { font-family: var(--font-serif); line-height: 1.25; }
.privacy-document h1 { font-size: clamp(32px, 5vw, 46px); margin: 0 0 24px; }
.privacy-document h2 { font-size: 22px; margin: 0 0 8px; }
.privacy-document section { border-top: 1px solid var(--line); padding: 18px 0; }
.privacy-document p { margin: 0; color: var(--ink-2); }

/* ── 新手引导开场卡片 ─────────────────────────────── */
dialog.first-dialog { width: min(670px, calc(100vw - 24px)); max-height: min(92dvh, 840px); }
.first-dialog .dialog-head { padding: 18px 20px 8px 26px; }
.first-dialog .dialog-head h2 { font: 600 var(--text-s)/1.4 var(--font-ui); letter-spacing: .06em; color: var(--ink-3); }
.first-dialog .dialog-head [data-dismiss] { min-width: 44px; min-height: 44px; }
.first-dialog .dialog-body { padding: 4px 26px 14px; overscroll-behavior: contain; }
.first-steps { display: flex; align-items: center; gap: 8px; }
.first-steps button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  border: none;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  color: var(--ink-3);
  font: 500 var(--text-s)/1.25 var(--font-ui);
  transition: background var(--fast), color var(--fast);
}
@media (hover: hover) {
  .first-steps button:hover { background: var(--surface-3); color: var(--ink-1); }
}
.first-steps b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.first-steps [aria-current] { color: var(--accent-ink); font-weight: 600; }
.first-steps [aria-current] b { background: var(--accent); color: var(--on-accent); }
.first-steps > span { width: 28px; height: 1.5px; border-radius: 2px; background: var(--line-strong); }

.first-content h3 { font: 500 clamp(26px, 4vw, 34px)/1.25 var(--font-serif); margin: 8px 0 16px; overflow-wrap: anywhere; }
.first-content h3:focus { outline: none; }
.first-pad .guide-practice { box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); }
.first-pad canvas[data-trial] { height: clamp(165px, 28dvh, 240px); }
.first-pad .guide-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 16px;
}
.first-pad .guide-hint[hidden] { display: none; }
.first-trace { width: 146px; height: 44px; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trace-guide { stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 2 5; }
.trace-ink { stroke: var(--accent); stroke-width: 2.8; stroke-dasharray: 1; animation: first-stroke 1.5s var(--ease) 1 both; }
.trace-caption { font: 400 13.5px/1.4 var(--font-serif); color: var(--ink-3); letter-spacing: .04em; }
@keyframes first-stroke { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.first-dialog .first-actions .btn, .guide-first, .lasso-lesson .btn { min-height: 40px; height: auto; }
.first-pad .guide-status, .first-paper-hint, .lasso-lesson p { color: var(--ink-2); line-height: 1.55; margin: 10px 0 2px; font-size: var(--text-s); }

.first-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 12px;
  padding: 14px 26px max(15px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.first-actions .btn { white-space: normal; text-align: center; line-height: 1.25; padding: 8px 16px; }
.first-actions [data-first-skip] {
  border-color: var(--line);
  background: var(--surface-1);
  color: var(--ink-2);
  box-shadow: none;
}
@media (hover: hover) {
  .first-actions [data-first-skip]:hover {
    background: var(--surface-3);
    border-color: var(--line-strong);
    color: var(--ink-1);
  }
}

.first-papers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.first-papers button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 7px 7px 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-1);
  border-radius: var(--radius-m);
  transition: transform var(--fast), border-color var(--fast), box-shadow var(--fast);
}
@media (hover: hover) {
  .first-papers button:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
}
.first-paper-art { position: relative; width: 100%; display: grid; place-items: center; padding: 10px 6px; overflow: hidden; background: #e2e8eb; border-radius: 8px; }
[data-first-paper="4"] .first-paper-art { background: #dce5d7; }
[data-first-paper="5"] .first-paper-art { background: #f2e0ce; }
.first-leaf { display: block; height: clamp(86px, 15dvh, 128px); aspect-ratio: 794/1123; transform: rotate(-3deg); background: var(--paper); border-radius: 3px; box-shadow: 1px 4px 10px #57482b33, 3px 3px 0 #fffaf0; }
[data-first-paper="4"] .first-leaf { transform: rotate(2deg); }
[data-first-paper="5"] .first-leaf { transform: rotate(-2deg); }
.first-leaf canvas { display: block; width: 100%; height: 100%; border-radius: 3px; }
.first-paper-art i { position: absolute; top: 6px; right: 6px; display: none; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-1); }
.first-paper-art i .icon { width: 14px; height: 14px; }
.first-papers button[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow-1); border-color: var(--accent); }
.first-papers [aria-pressed="true"] i { display: grid; }
.first-papers strong { align-self: center; overflow-wrap: anywhere; line-height: 1.25; font-weight: 600; }
.first-name { display: grid; gap: 6px; margin: 16px 0 4px; color: var(--ink-2); font-size: var(--text-s); font-weight: 500; }
.first-name input { min-width: 0; min-height: 42px; width: 100%; color: var(--ink-1); font-size: 15px; }
.guide-first { margin-top: 15px; }

.lasso-paper { position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-m); }
.lasso-lesson canvas { display: block; width: 100%; height: clamp(158px, 24dvh, 225px); background: var(--paper); touch-action: none; border-radius: var(--radius-m); }
.lasso-cue { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: #557361; stroke-linecap: round; stroke-linejoin: round; }
.lasso-cue[hidden] { display: none; }
.lasso-cue-line { stroke-width: 1.8; stroke-dasharray: 1 5; }
.lasso-cue marker path { stroke-width: 2; }
.lasso-cue circle { fill: #557361; stroke: var(--paper); stroke-width: 1.5; }
.lasso-lesson .btn { margin-top: 8px; }
.lasso-actions { display: flex; flex-wrap: wrap; column-gap: 8px; }

@media (max-width: 560px) {
  .first-dialog .dialog-head { padding: 10px 12px 0 16px; }
  .first-dialog .dialog-body { padding: 0 15px 10px; }
  .first-actions { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); }
  .first-papers { gap: 6px; }
  .first-paper-art { padding: 8px 3px; }
  .first-content h3 { margin: 6px 0 12px; }
}
@media (max-height: 520px) {
  dialog.first-dialog { max-height: 96dvh; }
  .first-dialog .dialog-head { padding-top: 4px; }
  .first-actions { padding-block: 6px; }
}

.first-dialog .dialog-head { flex-wrap: wrap; justify-content: space-between; }
.first-dialog .dialog-head h2 { flex: 0 1 auto; }
.first-dialog .first-steps { flex-wrap: wrap; }
.guide-dialog .dialog-head .guide-first { margin: 0; white-space: normal; }

@media (max-width: 340px), (max-width: 920px) and (max-height: 450px) {
  dialog.guide-dialog { width: min(760px, calc(100vw - 12px)); max-height: calc(100dvh - 12px); }
  .guide-dialog .dialog-head { gap: 4px; padding: 2px 5px 0 12px; }
  .guide-dialog .dialog-head h2 { font-size: var(--text-l); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .guide-dialog .dialog-head button { flex: 0 0 44px; height: 44px; min-width: 44px; padding: 0; }
  .guide-dialog .guide-first span { display: none; }
  .guide-dialog .dialog-body { padding: 0 8px 12px; overflow-x: hidden; overscroll-behavior: contain; }
  .guide-layout { display: block; }
  .guide-nav { position: sticky; top: 0; z-index: 1; display: flex; flex-flow: row nowrap; gap: 2px; margin: 0 0 5px; padding: 1px 0 3px; background: var(--surface-2); overflow-x: auto; scrollbar-width: thin; }
  .guide-nav button { flex: none; flex-direction: column; justify-content: center; gap: 1px; min-width: 44px; min-height: 44px; padding: 2px 5px; white-space: nowrap; font: 500 var(--text-s)/1.2 var(--font-ui); }
  .guide-nav .icon { width: 16px; height: 16px; }
  .guide-pane { padding: 1px; }
  .guide-dialog .guide-practice canvas, .guide-dialog .lasso-lesson canvas { height: clamp(104px, 43dvh, 155px); }
}
