/* ============ 新手教程样式 ============ */

.tut-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 收起按钮：仅移动端显示 */
.tut-collapse-btn {
  display: none;
  font-size: 12px;
  line-height: 1;
  padding: 5px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 10px;
  background: #fff;
  color: #4B5563;
  cursor: pointer;
}

.tutorial-card.tut-collapsed {
  display: none !important;
}

/* 收起后的“教学”悬浮图标（JS 动态定位到模块转盘左侧） */
.tutorial-collapsed-tab {
  position: absolute;
  right: 175px;
  bottom: 105px;
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 7px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1D4ED8 0%, #1E40AF 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  pointer-events: auto;
  z-index: 9999;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tutorial-collapsed-tab img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  display: block;
}

.tutorial-collapsed-tab .tutorial-tab-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

.tutorial-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9990;
  pointer-events: none;
}

.tutorial-mask {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transition: clip-path 0.35s ease;
  clip-path: inset(0 0 0 0);
}

.tutorial-highlight {
  position: absolute;
  border: 2px solid #60A5FA;
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25), 0 0 24px rgba(96, 165, 250, 0.4);
  pointer-events: none;
  transition: all 0.35s ease;
  opacity: 0;
}

.tutorial-highlight.show {
  opacity: 1;
}

.tutorial-card {
  position: absolute;
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  width: 340px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid #E5E7EB;
  pointer-events: auto;
  z-index: 9999;
  animation: tutorialCardIn 0.3s ease;
}

@keyframes tutorialCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tutorial-card .tut-step {
  display: inline-block;
  font-size: 12px;
  color: #9CA3AF;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.tut-drag-handle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -20px -22px 10px -22px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #F3F4F6 0%, #fff 100%);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #E5E7EB;
  cursor: grab;
  user-select: none;
}

.tut-drag-handle:active {
  cursor: grabbing;
}

.tut-drag-handle .tut-step {
  font-size: 12px;
  color: #6B7280;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tut-drag-hint {
  font-size: 11px;
  color: #9CA3AF;
  padding: 2px 8px;
  background: #F3F4F6;
  border-radius: 10px;
}

.tutorial-card h3 {
  margin: 0 0 10px 0;
  font-size: 17px;
  color: #111827;
  line-height: 1.4;
}

.tutorial-card p {
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  text-wrap: pretty;
}

.tutorial-card .tut-task {
  font-size: 13px;
  color: #B45309;
  background: #FEF3C7;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 14px;
  border-left: 3px solid #F59E0B;
}

.tutorial-card .tut-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-card .tut-btn {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #D1D5DB;
  background: #fff;
  color: #374151;
}

.tutorial-card .tut-btn:hover {
  background: #F9FAFB;
}

.tutorial-card .tut-btn.primary {
  background: #2563EB;
  border-color: #2563EB;
  color: #fff;
}

.tutorial-card .tut-btn.primary:hover {
  background: #1D4ED8;
}

.tutorial-card .tut-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 起始页 */
.tutorial-welcome {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  text-align: center;
  animation: tutorialCardIn 0.4s ease;
}

.tutorial-welcome h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
  color: #111827;
}

.tutorial-welcome .tut-sub {
  color: #6B7280;
  font-size: 14px;
  margin-bottom: 18px;
}

.tutorial-welcome p {
  color: #374151;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
  margin: 0 0 24px 0;
}

.tutorial-welcome .tut-welcome-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.tutorial-welcome .tut-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #D1D5DB;
  background: #fff;
  color: #374151;
}

.tutorial-welcome .tut-btn.primary {
  background: #2563EB;
  border-color: #2563EB;
  color: #fff;
}

/* Independent business guides leave the task controls fully interactive. */
.module-guide-card {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000006;
  width: min(350px, calc(100vw - 32px));
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-top: 3px solid var(--module-primary, #2563eb);
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 8px 28px #0f172a30;
  pointer-events: auto;
  font-size: 13px;
  line-height: 1.55;
}
.module-guide-card.module-guide-at-top { top: 16px; bottom: auto; }
.module-guide-heading, .module-guide-controls, .module-guide-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-guide-heading { justify-content: space-between; color: #64748b; font-size: 12px; }
.module-guide-heading .btn { padding: 3px 8px; }
.module-guide-card h3 { font-size: 17px; margin: 9px 0 6px; }
.module-guide-card p { margin: 8px 0; }
.module-guide-note { padding: 8px; border-radius: 6px; background: #eff6ff; color: #334155; }
.module-guide-controls { margin-top: 12px; }
.module-guide-controls .btn, .module-guide-links .btn { min-height: 36px; font-size: 12px; white-space: normal; }
.module-guide-controls [data-module-guide-action="skip"] { border: none; background: transparent; color: #64748b; }
.module-guide-highlight { position: fixed; z-index: 1000005; pointer-events: none; border: 2px solid #3b82f6; border-radius: 8px; box-shadow: 0 0 0 3px #3b82f629; }
.module-guide-invitation { max-height: 210px; }
.module-guide-chapters, .module-guide-optional > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 10px 0; }
.module-guide-chapter { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 9px; }
.module-guide-chapter h4 { margin: 0; font-size: 13px; }
.module-guide-optional { margin-top: 10px; }
.module-guide-chapters .btn, .module-guide-optional .btn { min-height: 40px; white-space: normal; text-align: left; }
.module-guide-progress { color: #64748b; font-size: 12px; }
.module-guide-status { border-left: 3px solid #3b82f6; background: #eff6ff; padding: 8px 10px; border-radius: 5px; }
.module-guide-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.module-guide-actions .btn { min-height: 38px; white-space: normal; }
.module-guide-reason { margin-top: 8px; color: #475569; }
.module-guide-reason summary { cursor: pointer; padding: 5px 0; }
.module-guide-card [hidden] { display: none !important; }
.module-guide-card :focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.module-guide-card:has(.module-guide-directory) { max-height: min(80dvh, 720px); }
.module-guide-completion { position: fixed; right: 16px; bottom: 16px; z-index: 1000006; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #93c5fd; border-radius: 10px; background: #eff6ff; color: #1e3a8a; box-shadow: 0 6px 22px #0f172a20; }
.module-guide-completion .btn { min-height: 36px; }
body:has(#mobile-rotate-hint.show) .module-guide-card,
body:has(#mobile-rotate-hint.show) .module-guide-highlight,
body:has(#mobile-rotate-hint.show) .tutorial-overlay { visibility: hidden; }
@media (max-width: 600px) {
  .module-guide-card { right: 8px; bottom: 8px; width: calc(100vw - 16px); max-height: 36dvh; padding: 12px; font-size: 12px; box-sizing: border-box; }
  .module-guide-card.module-guide-at-top { top: 8px; }
  .module-guide-card h3 { font-size: 15px; }
  .module-guide-card .btn { min-height: 36px; }
}

/* ============ 移动端（手机横屏/竖屏）教程适配 ============ */
body.mobile-mode .tut-collapse-btn {
  display: inline-block;
}

body.mobile-mode .tutorial-card {
  width: min(320px, 46vw);
  padding: 12px 14px;
  max-height: calc(100dvh - 24px);
}

body.mobile-mode .tut-drag-handle {
  margin: -12px -14px 8px -14px;
  padding: 7px 10px;
}

body.mobile-mode .tutorial-card h3 {
  font-size: 15px;
  margin-bottom: 7px;
}

body.mobile-mode .tutorial-card p {
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 9px;
}

body.mobile-mode .tutorial-card .tut-task {
  font-size: 12px;
  padding: 6px 8px;
  margin-bottom: 9px;
}

body.mobile-mode .tutorial-card .tut-btn {
  padding: 6px 12px;
  font-size: 12px;
}

body.mobile-mode .tut-drag-hint {
  display: none;
}

body.mobile-mode .tutorial-collapsed-tab {
  right: 130px;
  bottom: 85px;
  padding: 6px 6px;
}

body.mobile-mode .tutorial-collapsed-tab img {
  width: 30px;
  height: 30px;
}

body.mobile-mode .tutorial-collapsed-tab .tutorial-tab-label {
  font-size: 10px;
}

@media (max-width: 600px) {
  body.mobile-mode .tutorial-card {
    width: min(300px, 86vw);
  }
}
