:root {
  --ink: #17211d;
  --muted: #687970;
  --faint: #edf3ef;
  --line: #d8e3dd;
  --field: #f7f8f4;
  --green: #064b3b;
  --green-2: #0a6250;
  --gold: #d6a84b;
  --red: #d94a43;
  --blue: #2d78c8;
  --route: #64748b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: var(--native-viewport-height, 100%);
  min-height: 100%;
  overflow: hidden;
  background: var(--field);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

html,
body,
.app,
.screen,
.canvas-wrap,
canvas {
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

canvas {
  touch-action: none;
}

.desktop-canvas-hint {
  display: none;
}

.desktop-brand,
.desktop-site-head,
.desktop-group-label,
.desktop-tool-rail-head,
.desktop-tool-rail-help,
.desktop-inspector-empty,
.desktop-course-status,
.desktop-route-overview {
  display: none;
}

.desktop-tool-section {
  display: contents;
}

.desktop-tool-section > small {
  display: none;
}

.export-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 2px 0 14px;
}

.export-option-grid button {
  min-height: 112px;
  padding: 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 12px;
  text-align: left;
  border-radius: 14px;
  background: #f7faf8;
}

.export-option-grid button > span {
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 12px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.export-option-grid strong {
  align-self: end;
  font-size: 14px;
}

.export-option-grid small {
  align-self: start;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.export-sheet-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #52665f;
  background: #eef5f1;
  font-size: 11px;
}

.export-sheet-note b {
  flex: 0 0 auto;
  color: #9a6a20;
}

.export-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 2px 0;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.export-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

@media (max-width: 520px) {
  .export-option-grid {
    grid-template-columns: 1fr;
  }

  .export-option-grid button {
    min-height: 82px;
  }
}

.subbar-group {
  display: contents;
}

.topbar-leading {
  min-width: 0;
}

button,
[role="button"],
.topbar,
.subbar,
.bottom-tools,
.edit-panel,
.module-modal {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button,
[role="button"] {
  touch-action: manipulation;
}

button {
  border: 1px solid rgba(6, 63, 49, 0.16);
  background: rgba(255, 255, 255, 0.88);
  color: var(--green);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.app {
  position: relative;
  width: 100%;
  height: var(--native-viewport-height, 100%);
  min-height: 0;
}

.cover {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 24px) 22px calc(env(safe-area-inset-bottom) + 24px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 247, 0.96)),
    radial-gradient(circle at 50% 25%, rgba(6, 63, 49, 0.08), transparent 42%);
  overflow: hidden;
}

.cover-page-arena {
  position: absolute;
  z-index: 0;
  left: 34px;
  right: 34px;
  top: calc(env(safe-area-inset-top) + 30px);
  bottom: calc(env(safe-area-inset-bottom) + 30px);
  border: 4px solid rgba(142, 151, 146, 0.72);
  border-radius: 22px;
  background: rgba(248, 251, 249, 0.46);
  pointer-events: none;
}

.cover > :not(.cover-page-arena) { position: relative; z-index: 1; }
.page-arena-letter {
  position: absolute;
  color: #1d2925;
  font: 900 18px/1 Georgia, serif;
}
.page-arena-letter.end { left: 50%; transform: translateX(-50%); }
.page-arena-letter.end.top { top: -26px; }
.page-arena-letter.end.bottom { bottom: -26px; }
.page-arena-letter.left { left: -27px; transform: translateY(-50%); }
.page-arena-letter.right { right: -27px; transform: translateY(-50%); }
.page-arena-letter.pos-1 { top: 10%; }
.page-arena-letter.pos-2 { top: 30%; }
.page-arena-letter.pos-3 { top: 50%; }
.page-arena-letter.pos-4 { top: 70%; }
.page-arena-letter.pos-5 { top: 90%; }

.app[data-screen="jumping"] .cover,
.app[data-screen="dressage"] .cover {
  display: none;
}

.brand-mark {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(14, 49, 39, 0.12);
}

.brand-mark img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

h1 {
  margin: 4px 0 0;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

.tagline,
.note {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.tagline {
  font-size: 15px;
}

.note {
  max-width: 340px;
  font-size: 12px;
  line-height: 1.55;
}

.cover-love {
  position: relative;
  width: min(330px, 100%);
  height: 190px;
  margin: 12px 0 2px;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px #d6ded9, 0 22px 48px rgba(17, 39, 34, 0.1);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.cover-arena-frame {
  position: absolute;
  inset: 25px 25px;
  border: 4px solid #9ea5a2;
  border-radius: 18px;
  z-index: 0;
}

.arena-letter {
  position: absolute;
  color: #26332e;
  font: 900 12px/1 Georgia, serif;
}

.arena-letter.top { top: -18px; transform: translateX(-50%); }
.arena-letter.bottom { bottom: -18px; transform: translateX(-50%); }
.arena-letter.top-left, .arena-letter.bottom-left { left: 15%; }
.arena-letter.top-center, .arena-letter.bottom-center { left: 50%; }
.arena-letter.top-right, .arena-letter.bottom-right { left: 85%; }
.arena-letter.side { top: 50%; transform: translateY(-50%); }
.arena-letter.side-left { left: -17px; }
.arena-letter.side-right { right: -17px; }

.cover-love-image {
  position: relative;
  z-index: 1;
  width: 84%;
  height: 68%;
  object-fit: contain;
  display: block;
}

.settings-select-row {
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  font-weight: 800;
}

.settings-select-row select {
  min-width: 112px;
  border: 0;
  background: var(--field);
  color: var(--green);
  font: inherit;
  text-align: right;
}

.cover-actions {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cover-actions[hidden] { display: none; }

.cover-auth-btn {
  width: min(360px, 100%);
  min-height: 54px;
  border-radius: 17px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
  border: 1px solid rgba(16, 35, 31, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: #181a1d;
}

.cover-auth-btn strong {
  font-weight: 600;
  color: #687078;
  font-size: 13px;
}

.cover-actions button {
  height: 54px;
  border-radius: 17px;
  font-size: 17px;
}

.cover-actions .primary {
  background: var(--green);
  color: #fff;
}

.workspace {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #eff6f2;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.jumping-workspace {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.dressage-workspace {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.app[data-screen="jumping"] .jumping-workspace,
.app[data-screen="dressage"] .dressage-workspace {
  display: grid;
}

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 10px;
  color: #fff;
  background: linear-gradient(135deg, #063f31, #062d25);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-size: 34px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.title-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-block strong {
  font-size: 22px;
  letter-spacing: 0;
}

.title-block span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions button {
  height: 40px;
  min-width: 48px;
  border-radius: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.top-actions .accent {
  background: var(--gold);
  border-color: var(--gold);
  color: #16130e;
}

.dressage-contextbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 0.8fr 1.15fr 0.65fr 1.25fr;
  gap: 6px;
  min-width: 0;
  margin-top: -2px;
}

.dressage-contextbar button {
  min-width: 0;
  height: 30px;
  padding: 0 6px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dressageGaitBtn {
  background: rgba(255, 255, 255, 0.16);
}

.jumping-workspace .topbar {
  padding-bottom: 6px;
}

.jumping-workspace .subbar {
  padding-top: 5px;
  padding-bottom: 5px;
}

.subbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
}

.subbar::-webkit-scrollbar {
  display: none;
}

.dressage-subbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 5px 6px;
  overflow: visible;
}

.dressage-workspace .dressage-subbar > button {
  width: auto;
  min-width: 0;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  font-size: 28px;
  font-weight: 800;
}

.dressage-subbar .step-arrow span {
  font-size: 30px;
  line-height: 1;
}

.dressage-subbar .step-action {
  min-width: 0;
  padding: 0;
  font-weight: 750;
}

.dressage-subbar .tool-icon-img {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.dressage-subbar .add-step {
  color: #8d5d2f;
  background: rgba(201,147,92,0.16);
  border-color: rgba(201,147,92,0.42);
}

.dressage-subbar .danger {
  color: var(--red);
}

.dressage-subbar button:disabled {
  opacity: 0.38;
}

.subbar button,
.zoom-pill {
  height: 38px;
  border-radius: 13px;
  flex: 0 0 auto;
}

.subbar button {
  white-space: nowrap;
  padding: 0 12px;
}

.subbar .arena-select {
  flex: 1 0 150px;
  min-width: 150px;
}

.subbar .move-pill {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subbar .square {
  width: 46px;
  padding: 0;
  font-size: 24px;
}

.zoom-pill {
  display: grid;
  place-items: center;
  min-width: 66px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
  cursor: pointer;
}

.canvas-wrap {
  min-height: 0;
  position: relative;
  overflow: hidden;
  padding: 7px;
  touch-action: none;
  background:
    linear-gradient(90deg, rgba(219, 231, 225, 0.8) 1px, transparent 1px),
    linear-gradient(180deg, rgba(219, 231, 225, 0.8) 1px, transparent 1px),
    #f5faf7;
  background-size: 26px 26px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#jumpingCanvas,
#dressageCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(21, 43, 37, 0.1);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.edit-panel {
  display: none;
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 56px);
  width: auto;
  max-height: min(190px, 25vh);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 7px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(247, 248, 244, 0.97);
  box-shadow: 0 14px 38px rgba(23, 33, 29, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.edit-panel[aria-hidden="false"] {
  display: block;
}

input,
textarea {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.edit-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
}

.edit-panel-head strong {
  font-size: 13px;
}

.edit-panel-head span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.edit-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.edit-control {
  width: auto;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfb;
}

.edit-control.active {
  background: #0b0b0d;
  border-color: #0b0b0d;
  color: #fff;
}

/* 连线颜色选择键：未选中时显示对应颜色文字，选中时黑底白字（与显隐键一致） */
.edit-control.route-line-color-red { color: #e53935; font-weight: 700; }
.edit-control.route-line-color-blue { color: #2196f3; font-weight: 700; }
.edit-control.route-line-color-green { color: #2e7d32; font-weight: 700; }
.edit-control.route-line-color-red.active,
.edit-control.route-line-color-blue.active,
.edit-control.route-line-color-green.active { color: #fff; }
.edit-control.danger { color: #c62828; font-weight: 700; }

.edit-control label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.number-edit-control input {
  width: 100%;
  min-width: 0;
  height: 27px;
  box-sizing: border-box;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 800 12px -apple-system, BlinkMacSystemFont, sans-serif;
}

.dimension-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.dimension-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.round-list,.validation-list{display:grid;gap:8px;max-height:52vh;overflow:auto}
.pattern-list{display:grid;gap:8px;max-height:56vh;overflow:auto;-webkit-overflow-scrolling:touch}
.pattern-item{display:flex;align-items:center;gap:10px;padding:9px 10px;border:1px solid var(--line);border-radius:12px;background:#f9fbfa;text-align:left;cursor:pointer}
.pattern-item.active{border-color:#0b4f42;background:#eef7f3}
.pattern-item .pattern-no{width:30px;height:24px;border-radius:7px;background:#0B0B0D;color:#fff;font-size:12px;font-weight:700;text-align:center;line-height:24px;flex:0 0 auto}
.pattern-item .pattern-bar{flex:1 1 auto;height:14px;border-radius:4px;border:1px solid #111;min-width:60px}
.pattern-item .pattern-name{font-size:12px;color:var(--muted);flex:0 0 auto;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.round-item,.validation-item{display:flex;align-items:center;gap:9px;padding:10px;border:1px solid var(--line);border-radius:12px;background:#f9fbfa;text-align:left}
.round-item.active{border-color:#0b4f42;background:#eef7f3}
.round-color{width:13px;height:13px;border-radius:50%;flex:0 0 auto}
.round-item strong,.validation-item strong{display:block;flex:1}
.round-item small,.validation-item small{display:block;color:var(--muted)}
.round-item button{padding:5px 8px}
.validation-item.error{border-left:5px solid #dc2626}
.validation-item.warning{border-left:5px solid #d69a28}
.validation-ok{padding:24px;text-align:center;color:#16764b;font-weight:800}
#validationBtn.has-error{color:#b91c1c;border-color:#fecaca;background:#fff1f2}
#validationBtn.has-warning{color:#9a6700;border-color:#fde68a;background:#fffbeb}

.stepper {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 3px;
}

.stepper button {
  height: 27px;
  border-radius: 8px;
  font-size: 17px;
}

.stepper strong {
  min-width: 0;
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-tools {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 5px 6px calc(env(safe-area-inset-bottom) + 5px);
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
}

.bottom-tools button {
  height: 46px;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
}

.bottom-tools span {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.bottom-tools .tool-icon-img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

.bottom-tools .danger {
  color: var(--red);
}

.dressage-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dressage-tools button {
  min-width: 0;
  padding-left: 2px;
  padding-right: 2px;
}

.dressage-editor-tools {
  flex: 0 0 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 8px;
  box-sizing: border-box;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.dressage-editor-tools button {
  height: 32px;
  min-width: 76px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 9px;
  border: 1px solid rgba(6,47,43,0.15);
  background: #f5f8f5;
  color: #064c40;
  font-size: 11px;
  font-weight: 700;
}

.dressage-editor-tools .tool-icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.dressage-editor-tools b {
  font: inherit;
  white-space: nowrap;
}

.dressage-editor-tools button.active {
  background: rgba(0,107,80,0.10);
  border-color: rgba(0,107,80,0.28);
}

.dressage-tools b {
  font: inherit;
  white-space: nowrap;
}

#dressageBottomDirectionBtn .tool-icon-img {
  transition: transform 160ms ease;
}

#dressageBottomDirectionBtn.right .tool-icon-img {
  transform: scaleX(-1);
}

.dressage-workspace .top-actions {
  gap: 5px;
}

.dressage-workspace .top-actions button {
  min-width: 42px;
  padding: 0 7px;
  font-size: 13px;
}

.dressage-preview {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #15110f;
  color: #fff;
}

.dressage-preview[aria-hidden="false"] {
  display: grid;
}

.preview-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 10px;
  background: rgba(21, 17, 15, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-back {
  min-width: 68px;
  height: 42px;
  border-radius: 14px;
  color: #f3d58f;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(243, 213, 143, 0.35);
}

.preview-head strong,
.preview-head span {
  display: block;
}

.preview-head strong {
  font-size: 20px;
}

.preview-head span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.preview-stage {
  min-height: 0;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(219, 231, 225, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(219, 231, 225, 0.12) 1px, transparent 1px),
    #17120f;
  background-size: 28px 28px;
}

#dressagePreviewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
}

#jumpingPreviewCanvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 10px;
  background: #f8fbf8;
}

#jumpingPreview {
  grid-template-rows: minmax(0, 1fr) auto;
  background: #ffffff;
  color: #0B0B0D;
}

#jumpingPreview .preview-stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(2px, env(safe-area-inset-top)) 2px 2px;
  background: #ffffff;
}

#jumpingPreview .preview-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px);
  background: #ffffff;
  border-top: 1px solid #E1E2E4;
}

#jumpingPreview .preview-controls button {
  color: #0B0B0D;
  background: #F7F7F5;
  border-color: #E1E2E4;
}

#jumpingPreview .preview-controls .accent {
  color: #ffffff;
  background: #206CDF;
  border-color: #206CDF;
}

#jumpingPreview .jumping-preview-settings {
  color: #6B6F76;
}

/* 舞步预览与障碍预览、小程序预览统一为浅色效果 */
#dressagePreview {
  background: #ffffff;
  color: #0B0B0D;
}

#dressagePreview .preview-head {
  background: #ffffff;
  border-bottom: 1px solid #E1E2E4;
}

#dressagePreview .preview-head strong {
  color: #0B0B0D;
}

#dressagePreview .preview-head span {
  color: #6B6F76;
}

#dressagePreview .preview-back {
  color: #206CDF;
  background: #EDF3FD;
  border-color: #BDD1F4;
}

#dressagePreview .preview-stage {
  background: #ffffff;
}

#dressagePreview .preview-controls {
  background: #ffffff;
  border-top: 1px solid #E1E2E4;
}

#dressagePreview .preview-controls button {
  color: #0B0B0D;
  background: #F7F7F5;
  border-color: #E1E2E4;
}

#dressagePreview .preview-controls .accent {
  color: #ffffff;
  background: #206CDF;
  border-color: #206CDF;
}

#dressagePreview .preview-info {
  color: #6B6F76;
}

#dressagePreview .preview-info select {
  color: #0B0B0D;
  background: #F7F7F5;
  border-color: #E1E2E4;
}

#jumpingPreviewNextRoundBtn[hidden] {
  display: none;
}

#jumpingPreviewNextRoundBtn:not([hidden]) {
  grid-column: 1 / -1;
}

.jumping-preview-settings {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 800;
}

.jumping-preview-settings output {
  white-space: nowrap;
  font-size: 11px;
}

.jumping-preview-speed {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jumping-preview-speed span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.jumping-preview-speed input {
  min-width: 0;
  flex: 1;
  accent-color: #d5ad5c;
}

.jumping-preview-speed b,
.jumping-preview-speed em {
  font: inherit;
  white-space: nowrap;
}

@media (max-width: 390px) {
  .jumping-preview-settings {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.preview-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 12px 14px calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(21, 17, 15, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#dressagePreview .preview-controls {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

#dressagePreview .preview-controls button {
  min-width: 0;
  padding: 0 4px;
  font-size: 14px;
}

.preview-controls button {
  height: 54px;
  border-radius: 16px;
  color: #e6dccb;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  font-size: 16px;
}

.preview-controls .accent {
  color: #1d1710;
  background: #d5ad5c;
  border-color: #d5ad5c;
}

.preview-info {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.68);
  text-align: center;
  font-weight: 800;
  font-size: 13px;
}

.preview-info select {
  margin-left: 10px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  color: #fff;
  background: rgba(255,255,255,.1);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(12, 25, 22, 0.35);
}

.sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 78vh;
  padding: 18px 14px calc(env(safe-area-inset-bottom) + 16px);
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -18px 42px rgba(14, 49, 39, 0.18);
  overflow: auto;
}

.compact-sheet {
  max-height: min(82vh, 760px);
  overflow: auto;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 0 18px;
}

.choice-card {
  min-height: 78px;
  padding: 10px 6px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.choice-card .choice-icon {
  font-size: 24px;
  line-height: 1;
}

.choice-card .choice-icon.image-icon {
  width: 44px;
  height: 36px;
  display: grid;
  place-items: center;
}

.choice-card .choice-icon.image-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.choice-card.selected .choice-icon.image-icon img {
  filter: brightness(0) invert(1);
}

.choice-card.selected .choice-icon.image-icon.gif-icon img {
  filter: none;
}

.choice-card small {
  color: var(--muted);
  font-size: 11px;
}

.choice-card.selected {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sheet-foot button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 13px;
}

.accent-solid {
  color: #fff;
  background: var(--green);
}

.form-list,
.settings-list {
  display: grid;
  gap: 10px;
  padding: 4px 0 16px;
}

.form-list label:not(.check-row) {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-weight: 800;
}

.form-list select,
.param-field input,
.param-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.check-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-row input {
  width: 22px;
  height: 22px;
}

.settings-list button {
  min-height: 54px;
  padding: 0 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-list strong {
  color: var(--gold);
}

.speed-group {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.speed-card {
  min-height: 72px;
}

.speed-card input {
  width: 76px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: center;
  font: inherit;
}

.param-field {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 10px;
}

@media (max-width: 430px) {
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sheet h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.sheet p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.close-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 22px;
  color: var(--muted);
}

.module-section-title {
  margin: 8px 0 10px;
  color: #687d72;
  font-size: 13px;
  font-weight: 800;
}

.module-section-title.marker-title { margin-top: 16px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.marker-grid { padding-bottom: 4px; }

.module-card {
  min-width: 0;
  min-height: 92px;
  padding: 7px 3px;
  border-radius: 12px;
  background: #f8faf9;
  border: 1px solid var(--line);
  display: grid;
  grid-template-rows: 32px auto auto;
  justify-items: center;
  align-items: center;
  gap: 4px;
}

.module-card.marker {
  background: #fffaf4;
  border-color: #ecd8c1;
}

.module-card.asset-card {
  grid-template-rows: 48px auto;
  background: #f4f9f1;
  border-color: #d8e7d0;
}

.asset-icon {
  width: 64px;
  height: 48px;
  display: block;
}

.module-card strong {
  max-width: 100%;
  font-size: 12px;
  white-space: nowrap;
}

.module-card small {
  max-width: 100%;
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.project-actions button {
  width: 100%;
  height: 46px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-empty {
  padding: 26px 14px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #fbfdfb;
}

.project-section-title {
  margin: 8px 4px 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.project-item {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto);
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdfb;
}

.dressage-subbar button.active {
  color: #fff;
  background: var(--green);
}

/* 障碍编辑页视图开关：选中（显示中）变色 */
.view-settings button.active {
  color: #fff;
  background: #0b0b0d;
  border-color: #0b0b0d;
}

@media (max-width: 520px) {
  .project-item { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .project-item > div { grid-column: 1 / -1; }
  .project-item button { min-width:0; padding:0 6px; }
}

.project-item strong,
.project-item span {
  display: block;
}

.project-item strong {
  font-size: 16px;
}

.project-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.project-item button {
  min-width: 48px;
  height: 36px;
  border-radius: 12px;
}

.project-item .danger {
  color: var(--red);
  border-color: rgba(217, 74, 67, 0.28);
}

.project-item .ghost {
  color: var(--muted);
  border-color: var(--line);
  background: #f6faf7;
}

.module-icon {
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 7px;
  background: #f3f8f5;
  overflow: hidden;
}

.module-graphic .pole,
.module-graphic .cross-pole {
  display: none;
  position: absolute;
  left: 5px;
  right: 5px;
  height: 4px;
  border: 1px solid #111;
  background: repeating-linear-gradient(90deg, #111 0 8px, #fff 8px 16px);
  box-sizing: border-box;
  z-index: 3;
}

.module-graphic .standard {
  display: none;
  position: absolute;
  top: 6px;
  width: 2px;
  height: 18px;
  background: #667085;
  z-index: 2;
}

.module-graphic .standard.left { left: 5px; }
.module-graphic .standard.right { right: 5px; }

.module-graphic .water-fill,
.module-graphic .wall-fill,
.module-graphic .combo-frame {
  display: none;
  position: absolute;
  z-index: 1;
}

.module-graphic .water-fill {
  left: 5px;
  right: 5px;
  top: 6px;
  bottom: 6px;
  border-radius: 4px;
  background: #93c5fd;
  border: 1px solid #60a5fa;
}

.module-graphic .wall-fill {
  left: 5px;
  right: 5px;
  top: 10px;
  height: 9px;
  background: repeating-linear-gradient(90deg, #ef4444 0 11px, #f87171 11px 22px);
  border: 1px solid #7f1d1d;
}

.module-graphic.STRAIGHT_RAILS .pole-1,
.module-graphic.STRAIGHT_RAILS .standard,
.module-graphic.STRAIGHT_RAILS_2 .pole-1,
.module-graphic.STRAIGHT_RAILS_2 .pole-2,
.module-graphic.STRAIGHT_RAILS_2 .standard,
.module-graphic.STRAIGHT_RAILS_3 .pole-1,
.module-graphic.STRAIGHT_RAILS_3 .pole-2,
.module-graphic.STRAIGHT_RAILS_3 .pole-3,
.module-graphic.STRAIGHT_RAILS_3 .standard,
.module-graphic.OXER_STRIPED .pole-1,
.module-graphic.OXER_STRIPED .pole-2,
.module-graphic.OXER_STRIPED .standard,
.module-graphic.LIVERPOOL .pole-1,
.module-graphic.LIVERPOOL .standard,
.module-graphic.LIVERPOOL_STRIPED .pole-1,
.module-graphic.LIVERPOOL_STRIPED .pole-2,
.module-graphic.LIVERPOOL_STRIPED .standard,
.module-graphic.CAVALETTI .pole-1,
.module-graphic.CAVALETTI .pole-2,
.module-graphic.CAVALETTI .pole-3,
.module-graphic.CAVALETTI .pole-4,
.module-graphic.CAVALETTI .pole-5,
.module-graphic.CAVALETTI_COMBO .pole-1,
.module-graphic.CAVALETTI_COMBO .pole-2,
.module-graphic.CAVALETTI_COMBO .pole-3,
.module-graphic.CAVALETTI_COMBO .standard,
.module-graphic.COMBINATION .pole-1,
.module-graphic.COMBINATION .pole-2,
.module-graphic.COMBINATION .standard,
.module-graphic.TRIPLE_COMBINATION .pole-1,
.module-graphic.TRIPLE_COMBINATION .pole-2,
.module-graphic.TRIPLE_COMBINATION .pole-3,
.module-graphic.TRIPLE_COMBINATION .standard { display: block; }

.module-graphic.STRAIGHT_RAILS .pole-1,
.module-graphic.LIVERPOOL .pole-1 { top: 13px; }
.module-graphic.STRAIGHT_RAILS_2 .pole-1,
.module-graphic.OXER_STRIPED .pole-1,
.module-graphic.LIVERPOOL_STRIPED .pole-1 { top: 8px; }
.module-graphic.STRAIGHT_RAILS_2 .pole-2,
.module-graphic.OXER_STRIPED .pole-2,
.module-graphic.LIVERPOOL_STRIPED .pole-2 { top: 18px; }
.module-graphic.STRAIGHT_RAILS_3 .pole-1 { top: 5px; }
.module-graphic.STRAIGHT_RAILS_3 .pole-2 { top: 13px; }
.module-graphic.STRAIGHT_RAILS_3 .pole-3 { top: 21px; }

.module-graphic.OXER_STRIPED .pole,
.module-graphic.LIVERPOOL_STRIPED .pole {
  background: repeating-linear-gradient(90deg, #dc2626 0 8px, #fff 8px 16px);
}

.module-graphic.LIVERPOOL .water-fill,
.module-graphic.LIVERPOOL_STRIPED .water-fill,
.module-graphic.TABLE .water-fill,
.module-graphic.WALL .wall-fill { display: block; }
.module-graphic.TABLE .water-fill { top: 10px; bottom: 10px; }

.module-graphic.CAVALETTI .pole { left: 8px; right: 8px; height: 3px; }
.module-graphic.CAVALETTI .pole-1 { top: 3px; }
.module-graphic.CAVALETTI .pole-2 { top: 8px; }
.module-graphic.CAVALETTI .pole-3 { top: 13px; }
.module-graphic.CAVALETTI .pole-4 { top: 18px; }
.module-graphic.CAVALETTI .pole-5 { top: 23px; }
.module-graphic.CAVALETTI_COMBO .pole { left: 8px; right: 8px; }
.module-graphic.CAVALETTI_COMBO .pole-1 { top: 6px; }
.module-graphic.CAVALETTI_COMBO .pole-2 { top: 13px; }
.module-graphic.CAVALETTI_COMBO .pole-3 { top: 20px; }

.module-graphic.COMBINATION .pole,
.module-graphic.TRIPLE_COMBINATION .pole {
  width: 21px;
  left: auto;
  right: auto;
  transform: rotate(90deg);
}
.module-graphic.COMBINATION .pole-1 { left: 8px; top: 13px; }
.module-graphic.COMBINATION .pole-2 { right: 8px; top: 13px; }
.module-graphic.TRIPLE_COMBINATION .pole-1 { left: 4px; top: 13px; }
.module-graphic.TRIPLE_COMBINATION .pole-2 { left: 16px; top: 13px; }
.module-graphic.TRIPLE_COMBINATION .pole-3 { right: 4px; top: 13px; }

.module-graphic.CORNER .cross-pole {
  display: block;
  top: 13px;
  left: 7px;
  right: 7px;
  transform-origin: center;
}
.module-graphic.CORNER .cross-a { transform: rotate(16deg); }
.module-graphic.CORNER .cross-b { transform: rotate(-16deg); }

.marker-graphic {
  background: #fff7ed;
  border: 1px solid #f1dcc2;
  color: #8a5a20;
  box-sizing: border-box;
}

.marker-graphic i,
.marker-graphic .marker-text { position: absolute; }
.marker-graphic .marker-gate { left: 5px; right: 5px; top: 4px; bottom: 4px; border: 1px dashed #f0a987; border-radius: 7px; }
.marker-graphic .marker-line { left: 9px; right: 9px; top: 13px; height: 3px; background: repeating-linear-gradient(90deg, #ef4444 0 5px, transparent 5px 8px); }
.marker-graphic .marker-dot { top: 8px; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #3f3f46; background: #fff; }
.marker-graphic .marker-top { left: 6px; }
.marker-graphic .marker-bottom { right: 6px; background: #ef4444; border-color: #ef4444; }
.marker-graphic .marker-arrow { left: 50%; top: 7px; width: 2px; height: 13px; background: #ef4444; transform: translateX(-50%); }
.marker-graphic .marker-arrow::after { content: ""; position: absolute; left: -4px; top: -4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #ef4444; }
.marker-graphic .marker-turn-dot { display: none; }
.marker-graphic .marker-text { right: 3px; top: 20px; font-size: 7px; font-weight: 900; color: #8a5a20; z-index: 3; }
.marker-graphic.FORCED_TURN .marker-gate,
.marker-graphic.FORCED_TURN .marker-line,
.marker-graphic.FORCED_TURN .marker-dot,
.marker-graphic.FORCED_TURN .marker-arrow,
.marker-graphic.FORCED_TURN .marker-text { display: none; }
.marker-graphic.FORCED_TURN .marker-turn-dot {
  display: block;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #9f2d2d;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
}

.edit-part-title {
  grid-column: 1 / -1;
  min-width: 66px;
  align-self: center;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

#arenaSizeModal {
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 18px) 14px calc(env(safe-area-inset-bottom) + 18px);
}

.arena-size-sheet {
  width: min(100%, 400px);
  max-height: none;
  padding: 14px;
  border-radius: 20px;
}

.arena-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.arena-presets button {
  height: 42px;
  border-radius: 12px;
}

.arena-shapes {
  margin: 10px 0;
}

.arena-shapes > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.arena-env-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted, #8a94a6);
}

.arena-shape-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.arena-shape-grid button,
.arena-shape-grid span {
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.arena-shape-grid button.on {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.arena-shape-grid span {
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

#arenaCornerRow {
  margin-top: 8px;
}

.arena-size-form {
  display: grid;
  gap: 9px;
}

.arena-size-row {
  display: grid;
  grid-template-columns: 1fr 176px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.arena-stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 6px;
}

.arena-stepper button,
.arena-stepper strong {
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
}

.arena-stepper strong {
  color: var(--ink);
  background: #f8faf9;
  border: 1px solid var(--line);
}

.arena-size-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 88px);
  z-index: 50;
  max-width: 78vw;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(18, 30, 27, 0.88);
  font-weight: 700;
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 430px) {
  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 30px;
  }

  .title-block strong {
    font-size: 20px;
  }

  .title-block span {
    font-size: 12px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions button {
    height: 38px;
    min-width: 44px;
    padding: 0 10px;
    border-radius: 13px;
    font-size: 14px;
  }

  .subbar {
    gap: 6px;
    padding: 7px 8px;
  }

  .subbar button,
  .zoom-pill {
    height: 36px;
    border-radius: 12px;
  }

  .subbar button {
    padding: 0 10px;
  }

  .subbar .arena-select {
    flex: 0 0 132px;
    min-width: 132px;
    max-width: 150px;
  }

  .subbar .move-pill {
    max-width: 112px;
  }

  .subbar .square {
    width: 42px;
    font-size: 22px;
  }
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: center;
  }

  .app {
    width: min(430px, 100vw);
    height: min(932px, 100vh);
    min-height: auto;
    overflow: hidden;
    border-radius: 38px;
    box-shadow: 0 22px 60px rgba(8, 24, 20, 0.25);
  }

  .cover,
  .workspace {
    min-height: auto;
    height: 100%;
  }
}

/* 较窄的桌面浏览器保持单列编辑结构，但不再套用 430px 手机外框。 */
@media (min-width: 600px) and (max-width: 799px) and (hover: hover) and (pointer: fine) {
  body {
    display: block;
  }

  .app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    min-height: 560px;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
  }

  .cover {
    width: min(520px, 100%);
    min-height: 100%;
    margin: 0 auto;
  }

  .workspace {
    width: 100%;
    height: 100%;
    min-height: 560px;
  }
}

/* 桌面网页工作区：只对具有鼠标/触控板的宽屏设备启用，避免改变 iOS WKWebView。 */
@media (min-width: 800px) and (hover: hover) and (pointer: fine) {
  html,
  body {
    height: 100%;
    min-height: 100%;
  }

  body {
    display: block;
    background: #e9efec;
  }

  .app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    min-height: 620px;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
  }

  .cover {
    width: min(720px, calc(100vw - 64px));
    min-height: 100%;
    margin: 0 auto;
  }

  .workspace {
    height: 100%;
    min-height: 620px;
    grid-template-columns: 224px minmax(0, 1fr);
    grid-template-rows: 52px 58px 50px minmax(0, 1fr);
    background: #eef3f0;
  }

  .desktop-site-head {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 28px;
    min-width: 0;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
  }

  .desktop-site-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 148px;
    color: var(--ink);
    text-decoration: none;
  }

  .desktop-site-brand img {
    width: 33px;
    height: 33px;
    object-fit: contain;
  }

  .desktop-site-brand span {
    display: grid;
    line-height: 1.1;
  }

  .desktop-site-brand b {
    font-size: 16px;
  }

  .desktop-site-brand small {
    color: #a47627;
    font-size: 10px;
  }

  .desktop-site-head nav {
    display: flex;
    align-self: stretch;
    gap: 4px;
    min-width: 0;
  }

  .desktop-site-head nav a,
  .desktop-account-link {
    display: flex;
    align-items: center;
    padding: 0 13px;
    border-radius: 9px;
    color: #52665f;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
  }

  .desktop-site-head nav a:hover,
  .desktop-site-head nav a.active {
    color: var(--green);
    background: #edf5f1;
  }

  .desktop-site-head nav a.active {
    box-shadow: inset 0 -3px 0 var(--gold);
  }

  .desktop-account-link {
    min-height: 34px;
    margin-left: auto;
    padding: 0 17px;
    border: 1px solid #c7d6cf;
    border-radius: 999px;
    color: var(--green);
  }

  .workspace .topbar {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 52px minmax(220px, 1fr) auto;
    min-height: 58px;
    padding: 7px 18px 7px 12px;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 3px 14px rgba(6,45,37,.14);
  }

  .topbar-leading {
    display: flex;
    align-items: center;
    gap: 11px;
  }

  .desktop-brand {
    display: none;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .desktop-brand img {
    width: 34px;
    height: 34px;
    padding: 3px;
    border-radius: 10px;
    background: #fff;
    object-fit: contain;
  }

  .desktop-brand span {
    display: grid;
    min-width: 0;
    gap: 1px;
  }

  .desktop-brand b {
    color: #fff;
    font-size: 15px;
    line-height: 1.1;
  }

  .desktop-brand small {
    color: rgba(255,255,255,.64);
    font-size: 10px;
    white-space: nowrap;
  }

  .workspace .icon-btn {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    font-size: 29px;
  }

  .workspace .title-block strong {
    font-size: 19px;
  }

  .workspace .title-block span {
    font-size: 11px;
  }

  .workspace .top-actions button {
    height: 38px;
    border-radius: 10px;
    padding: 0 14px;
  }

  .workspace .subbar {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 50px;
    padding: 4px 16px;
    gap: 0;
    overflow: visible;
    background: #fff;
    box-shadow: 0 1px 0 var(--line), 0 4px 12px rgba(21,49,40,.04);
  }

  .workspace .subbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border-right: 1px solid var(--line);
  }

  .workspace .subbar-group:first-child {
    padding-left: 0;
  }

  .workspace .subbar-group:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .workspace .subbar-group.view-settings {
    margin-left: auto;
  }

  .desktop-group-label {
    display: inline;
    margin-right: 2px;
    color: #8a9892;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
  }

  .workspace .subbar button,
  .workspace .subbar .zoom-pill {
    height: 34px;
    border-radius: 9px;
    font-size: 12px;
  }

  .workspace .subbar .square {
    width: 36px;
  }

  .workspace .subbar .zoom-pill {
    min-width: 58px;
  }

  .workspace .canvas-wrap {
    grid-column: 2;
    grid-row: 4;
    min-width: 0;
    padding: 14px 18px 44px;
    border-left: 1px solid var(--line);
    background-color: #eef3f0;
    background-size: 30px 30px;
  }

  .workspace .bottom-tools {
    grid-column: 1;
    grid-row: 4;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 10px;
    padding: 16px 13px;
    overflow-y: auto;
    border-top: 0;
    background: #fff;
  }

  .workspace .bottom-tools button,
  .workspace .dressage-tools button {
    height: 42px;
    padding: 0 13px;
    flex-direction: row;
    justify-content: flex-start;
    border-radius: 10px;
    gap: 12px;
    font-size: 13px;
    background: #f8faf9;
  }

  .workspace .bottom-tools span,
  .workspace .dressage-tools button > span {
    width: 25px;
    font-size: 22px;
    text-align: center;
  }

  .workspace .dressage-tools .tool-icon-img {
    width: 26px;
    height: 26px;
    margin-left: 0;
    margin-right: 0;
  }

  .desktop-tool-rail-head {
    display: grid;
    gap: 4px;
    padding: 2px 3px 11px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 3px;
  }

  .desktop-tool-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8efeb;
  }

  .desktop-tool-section > small {
    display: block;
    padding: 0 3px;
    color: #8a9892;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .1em;
  }

  .desktop-tool-section.compact-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-tool-section.compact-tools > small {
    grid-column: 1 / -1;
  }

  .desktop-tool-section.compact-tools button {
    height: 54px;
    padding: 6px 4px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
  }

  .desktop-tool-section.compact-tools button span {
    width: auto;
    font-size: 21px;
  }

  .desktop-tool-rail-head strong {
    font-size: 16px;
  }

  .desktop-tool-rail-head span {
    width: auto !important;
    color: var(--muted);
    font-size: 11px !important;
    line-height: 1.45 !important;
    text-align: left !important;
  }

  .desktop-tool-rail-help {
    display: grid;
    gap: 4px;
    margin-top: 10px;
    padding: 12px 10px;
    border-radius: 11px;
    background: #f1f6f3;
    color: var(--muted);
  }

  .desktop-tool-rail-help b {
    color: var(--ink);
    font-size: 11px;
  }

  .desktop-tool-rail-help span {
    width: auto !important;
    font-size: 10px !important;
    line-height: 1.4 !important;
    text-align: left !important;
  }

  .workspace button:hover {
    border-color: rgba(6,63,49,.34);
    background-color: #f0f6f3;
  }

  .workspace button:focus-visible {
    outline: 3px solid rgba(199,143,69,.34);
    outline-offset: 2px;
  }

  .desktop-canvas-hint {
    position: absolute;
    right: 30px;
    bottom: 10px;
    display: block;
    padding: 6px 10px;
    border: 1px solid rgba(6, 63, 49, 0.11);
    border-radius: 9px;
    color: #61746d;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 3px 12px rgba(12, 43, 34, 0.06);
    font-size: 12px;
    pointer-events: none;
  }

  .desktop-course-status {
    position: absolute;
    left: 30px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid rgba(6, 63, 49, 0.11);
    border-radius: 10px;
    color: #50645d;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 3px 12px rgba(12, 43, 34, 0.06);
    font-size: 11px;
    pointer-events: none;
  }

  .desktop-course-status span {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  .desktop-course-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(6,63,49,.1);
  }

  .jumping-workspace .edit-panel {
    left: auto;
    right: 28px;
    bottom: 56px;
    width: min(340px, calc(100vw - 280px));
    max-height: min(520px, calc(100vh - 190px));
    margin: 0;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 16px 44px rgba(13, 44, 35, 0.18);
  }

  .jumping-workspace .edit-panel-head {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
  }

  .jumping-workspace .edit-panel-head strong {
    font-size: 17px;
  }

  .jumping-workspace .edit-panel-head span {
    font-size: 12px;
    white-space: normal;
  }

  .jumping-workspace .edit-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .jumping-workspace .edit-control {
    padding: 8px;
  }

  .modal .sheet {
    left: 50%;
    right: auto;
    bottom: 50%;
    width: min(760px, calc(100vw - 64px));
    max-height: min(82vh, 820px);
    transform: translate(-50%, 50%);
    border-radius: 24px;
  }

  .preview-head,
  .preview-footer {
    padding-left: max(24px, calc((100vw - 1180px) / 2));
    padding-right: max(24px, calc((100vw - 1180px) / 2));
  }

  .preview-stage {
    padding: 24px max(28px, calc((100vw - 1180px) / 2));
  }
}

@media (min-width: 1180px) and (hover: hover) and (pointer: fine) {
  .jumping-workspace {
    grid-template-columns: 224px minmax(0, 1fr) 316px;
  }

  .jumping-workspace .canvas-wrap {
    grid-column: 2;
  }

  .jumping-workspace .edit-panel {
    position: relative;
    z-index: 1;
    grid-column: 3;
    grid-row: 4;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-height: none;
    margin: 0;
    overflow-y: auto;
    padding: 18px 16px;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
  }

  .jumping-workspace .edit-panel[aria-hidden="true"] {
    display: block;
    padding: 18px;
    background: #fff;
  }

  .jumping-workspace .edit-panel[aria-hidden="true"] > * {
    display: none;
  }

  .jumping-workspace .edit-panel[aria-hidden="true"] .desktop-inspector-empty {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 220px;
    padding: 26px 20px;
    text-align: center;
  }

  .desktop-inspector-empty .inspector-empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--green);
    background: #f3f8f5;
    font-size: 27px;
  }

  .desktop-inspector-empty strong {
    font-size: 16px;
  }

  .desktop-inspector-empty p {
    max-width: 250px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
  }

  .desktop-route-overview {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .jumping-workspace .edit-panel[aria-hidden="true"] .desktop-route-overview {
    display: grid;
  }

  .desktop-overview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .desktop-overview-head strong {
    font-size: 15px;
  }

  .desktop-overview-head button,
  .desktop-delivery-card button {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 9px;
    color: var(--green);
    background: #f4f8f6;
    font-size: 11px;
    font-weight: 800;
  }

  .desktop-route-overview > p {
    margin: -4px 0 2px;
    color: var(--muted);
    font-size: 11px;
  }

  .desktop-round-overview {
    display: grid;
    gap: 7px;
  }

  .desktop-round-card {
    display: grid;
    grid-template-columns: 11px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfb;
  }

  .desktop-round-card.active {
    border-color: rgba(6,63,49,.34);
    background: #f0f6f3;
  }

  .desktop-round-card i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
  }

  .desktop-round-card span {
    display: grid;
    line-height: 1.3;
  }

  .desktop-round-card strong {
    font-size: 12px;
  }

  .desktop-round-card small,
  .desktop-round-card > b {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .desktop-delivery-card {
    display: grid;
    gap: 5px;
    margin-top: 3px;
    padding: 13px;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, #063f31, #0b6b55);
  }

  .desktop-delivery-card span {
    color: #d8ba77;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
  }

  .desktop-delivery-card strong {
    font-size: 12px;
  }

  .desktop-delivery-card button {
    margin-top: 4px;
    color: #17221e;
    border-color: #e2b95f;
    background: #e2b95f;
  }

  .dressage-workspace .canvas-wrap {
    grid-column: 2 / -1;
  }
}

@media (min-width: 800px) and (max-width: 1179px) and (hover: hover) and (pointer: fine) {
  .desktop-course-status span:nth-child(n+3) {
    display: none;
  }
}

/* 舞步页底栏只显示放大、加粗后的图标。 */
.dressage-tools button {
  height: 54px;
  padding: 0;
  gap: 0;
  font-size: 32px;
  font-weight: 900;
}

.dressage-tools button > span {
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
}

.dressage-tools .tool-icon-img {
  width: 32px;
  height: 32px;
}

/* 动作模型与图形选择使用一致的矩阵卡片和白/深绿/金色调。 */
.motion-sheet {
  background: #ffffff;
  color: var(--ink);
}

.motion-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 0 14px;
}

.motion-model-card {
  min-height: 104px;
  padding: 8px 5px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f4f8f5;
  border: 1px solid var(--line);
  color: var(--ink);
}

.motion-model-preview {
  width: 58px;
  height: 64px;
  padding: 3px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #ffffff;
}

.motion-model-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.motion-model-card strong {
  font-size: 12px;
}

.motion-model-card.selected {
  background: rgba(199, 143, 69, 0.16);
  border-color: rgba(199, 143, 69, 0.62);
  box-shadow: inset 0 0 0 1px rgba(199, 143, 69, 0.18);
  color: var(--green);
}

.horse-mode-icon {
  width: 34px !important;
  height: 38px !important;
}

/* 默认直线图标在底栏和选择矩阵中加粗，避免细线在手机屏幕上消失。 */
img[src$="01-line.png"] {
  transform: scale(1.1);
  filter: contrast(1.8) drop-shadow(1px 0 0 #063f31) drop-shadow(-1px 0 0 #063f31);
}

.choice-card.selected img[src$="01-line.png"] {
  filter: brightness(0) invert(1) drop-shadow(1px 0 0 #ffffff) drop-shadow(-1px 0 0 #ffffff);
}
/* Unified account entry shared by the iOS WebApp and a future website build. */
.cover-account-button { display:flex; align-items:center; justify-content:center; gap:10px; margin:0 auto; padding:8px 14px; border:1px solid rgba(16,35,31,.14); border-radius:999px; background:rgba(255,255,255,.78); color:#0b4f42; font-weight:800; }
.cover-account-button small { color:#7b8982; font-size:11px; font-weight:700; }
.auth-sheet { max-width:430px; }
.auth-sheet [hidden] { display:none !important; }
.auth-form { display:grid; gap:12px; padding-top:8px; }
.auth-form label { display:grid; gap:6px; color:#29433d; font-size:13px; font-weight:800; }
.auth-form input { width:100%; box-sizing:border-box; min-height:46px; padding:0 13px; border:1px solid #d8e1dc; border-radius:12px; background:#f9fbfa; color:#10231f; font:inherit; }
.auth-form input:focus { outline:3px solid rgba(11,79,66,.13); border-color:#0b4f42; }
.auth-form button { min-height:46px; }
.auth-message { min-height:20px; margin:0; color:#9a5d1b; font-size:12px; line-height:1.5; }
.auth-switch { border:0; background:transparent; color:#0b4f42; font-weight:800; }
.auth-modal .sheet { max-height:min(860px,92vh); overflow:auto; }
.auth-brand { display:flex; align-items:center; justify-content:center; gap:10px; padding:8px 0 16px; color:#07503f; }
.auth-brand img { width:52px; height:52px; object-fit:contain; border-radius:15px; background:#fff; }
.auth-brand strong { font-size:25px; }
.auth-tabs { display:grid; grid-template-columns:1fr 1fr; gap:6px; padding:4px; border-radius:14px; background:#edf5f1; }
.auth-tabs button { min-height:42px; border:0; background:transparent; }
.auth-tabs button.active { color:#fff; background:#07503f; }
.auth-text-button,.auth-skip { border:0!important; background:transparent!important; color:#07503f; font-weight:800; }
.auth-skip.auth-danger { color:#b91c1c; font-size:12px; opacity:.85; }
.auth-text-button { min-height:24px!important; margin-left:auto; padding:0; }
.auth-terms { grid-template-columns:auto 1fr!important; align-items:start; line-height:1.55; }
.auth-terms input { width:20px!important; min-height:20px!important; margin-top:1px; }
.auth-terms button { display:inline; min-height:0; padding:0 3px; border:0; color:#07503f; background:transparent; font:inherit; text-decoration:underline; }
.auth-account { text-align:center; }
.auth-avatar { display:grid; place-items:center; width:76px; height:76px; margin:10px auto; border:3px solid #0b8068; border-radius:50%; color:#07503f; background:#eef7f2; font-size:30px; font-weight:900; }
.auth-account h3 { margin:8px 0 2px; font-size:23px; }.auth-account>p { margin:0 0 18px; color:var(--muted); }
.auth-plan { display:flex; justify-content:space-between; padding:14px; border-radius:14px; background:#edf5f1; }.auth-plan strong { color:#a77626; }
.auth-benefits { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin:10px 0 18px; color:#466158; font-size:12px; }.auth-benefits span { padding:10px 4px; border:1px solid #dce7e1; border-radius:12px; }

/* 购买面板（选择版本 + 我的订单） */
.auth-shop { text-align:left; }
.auth-shop h3 { margin:0 0 4px; font-size:18px; }
.auth-shop-sub { margin:0 0 14px; color:#6b7a75; font-size:12px; }
.shop-products { display:grid; gap:10px; margin-bottom:14px; }
.shop-card { border:1px solid #dce7e1; border-radius:14px; padding:12px 14px; display:grid; gap:6px; }
.shop-card-head { display:flex; justify-content:space-between; align-items:baseline; gap:10px; }
.shop-card-head b { font-size:14px; }
.shop-card small { color:#6b7a75; }
.shop-price { color:#b8860b; font-weight:900; font-size:18px; white-space:nowrap; }
.shop-buy { min-height:38px; }
.shop-orders { display:grid; gap:6px; margin-bottom:12px; max-height:160px; overflow:auto; }
.shop-order { display:flex; justify-content:space-between; gap:10px; padding:8px 10px; border:1px dashed #dce7e1; border-radius:10px; font-size:12px; }
.shop-order small { color:#6b7a75; white-space:nowrap; }
.auth-shop-message { min-height:18px; color:#07503f; font-size:12px; margin:0 0 8px; }
.auth-shop-orders-title { margin:0 0 8px; font-size:13px; color:#466158; }
.auth-shop .muted, .muted { color:#8a9994; font-size:12px; }

