:root {
  color-scheme: light;
  --paper: #f3eee4;
  --card: #fffdf8;
  --ink: #1d2430;
  --muted: #5d6674;
  --line: #e3d7c6;
  --sky: #2c6b93;
  --sky-soft: #e5f1f8;
  --accent: #c65d24;
  --danger: #8d2d2d;
  --demo: #8a4b08;
  --demo-bg: #fff1d2;
  --warn-bg: #fde8e4;
  --shadow: 0 8px 24px rgba(60, 42, 20, 0.06);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.lede, .hint, .foot, .notice { color: var(--muted); }
.top { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.mark { border-radius: 12px; background: white; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.banner, .notice {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-weight: 700;
}
.banner.demo { background: var(--demo-bg); color: var(--demo); }
.banner.warn { background: var(--warn-bg); color: var(--danger); font-weight: 650; }
.context { background: var(--sky-soft); }
label { display: block; font-weight: 700; margin: 10px 0 4px; }
input, textarea, button { font: inherit; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; }
button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--sky);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--sky); border: 1px solid var(--sky); }
button.danger { background: var(--danger); }
button[aria-pressed="true"] { background: var(--accent); }
button:disabled { opacity: 0.6; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.goals, .row, .actions, .tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { margin: 8px 0; }
.tab { background: white; color: var(--ink); border: 1px solid var(--line); }
.tab[aria-selected="true"] { background: var(--sky); color: white; }
.row { justify-content: space-between; }
.actions button, .goals button { flex: 1 1 140px; }
.error { color: var(--danger); min-height: 1.2em; font-weight: 700; }
.messages { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.bubble { border-radius: 14px; padding: 10px 12px; max-width: 100%; }
.bubble.mine { background: var(--sky-soft); margin-left: 12%; }
.bubble.coach { background: #fff7ef; margin-right: 8%; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.badge {
  display: inline-block;
  background: var(--demo-bg);
  color: var(--demo);
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
  margin: 0 0 6px;
}
time, .meta { color: var(--muted); font-size: 0.85rem; }
.flight, .round {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { width: auto; margin-top: 4px; }
.foot { margin-top: 8px; font-size: 0.92rem; }
.photo-box { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.drawing[aria-busy="true"] figcaption { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .drawing[aria-busy="true"] figcaption { animation: none; } }
.photo-previews { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.photo-previews li { display: grid; gap: 4px; }
.photo-previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: white; border: 1px solid var(--line); }
.file-btn:has(+ input:disabled) { opacity: 0.45; pointer-events: none; }
.photo-notice { background: #fff1d2; color: #6a3d08; border-radius: 12px; padding: 10px 12px; }
.diagram img { width: 100%; max-width: 360px; height: auto; border-radius: 12px; background: white; border: 1px solid var(--line); }
.diagram { margin: 8px 0 0; }
.diagram figcaption { color: var(--muted); font-size: 0.92rem; }
.file-btn {
  display: inline-flex;
  align-items: center;
  width: auto;
  margin-top: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--sky);
  color: white;
  cursor: pointer;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
ul { margin: 0; padding-left: 1.2rem; }

@media (max-width: 800px) {
  .panel { display: none; }
  .panel.is-on { display: block; }
  .bubble.mine, .bubble.coach { margin-left: 0; margin-right: 0; }
}
@media (min-width: 801px) {
  .tabs { display: none; }
  .panels { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; align-items: start; }
  .panel { display: block; }
  #panel-rounds, #panel-backup { grid-column: 1 / -1; }
}

/* 教练设计的折法图：一步一格 */
.fold-plan { margin: 10px 0 4px; padding: 10px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 14px; }
.fold-title { font-weight: 700; margin-bottom: 4px; }
.fold-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.fold-grid li { display: grid; gap: 4px; align-content: start; }
.fold-grid svg { width: 100%; height: auto; max-height: 220px; background: #f3efe6; border-radius: 10px; }
.fold-grid p { margin: 0; font-size: 0.86rem; line-height: 1.35; }
.fold-pending { animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .fold-pending { animation: none; } }
