/**
 * How-to-use tutorial — TWA glass design, no backdrop darkening
 */

.htu-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10020;
  background:
    linear-gradient(180deg, rgba(28, 111, 212, 0.78), rgba(16, 73, 154, 0.76)),
    rgba(25, 88, 170, 0.72);
  backdrop-filter: blur(24px) saturate(1.7);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--panel-radius, 16px);
  box-shadow: 0 18px 48px rgba(5, 28, 66, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  box-sizing: border-box;
  min-width: 320px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition:
    left 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    right 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.16s ease-out;
  will-change: left, top, right, transform;
}

.htu-modal[aria-hidden="true"] {
  display: none;
}

.htu-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.htu-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.htu-step-counter {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(219, 241, 255, 0.94);
  text-shadow: 0 1px 0 rgba(8, 35, 77, 0.34);
}

.htu-title {
  font-size: 18px;
  font-weight: 700;
  color: #f6fbff;
  margin: 0;
  text-shadow: 0 1px 0 rgba(8, 35, 77, 0.22);
}

.htu-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(231, 243, 255, 0.74);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.htu-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.htu-body {
  padding: 20px;
  overflow: auto;
  flex: 1 1 auto;
}

.htu-step-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #f3f9ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 8px 24px rgba(6, 30, 72, 0.22);
}

.htu-step-action::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #00c2ff;
  box-shadow: 0 0 0 6px rgba(0, 194, 255, 0.16), 0 0 18px rgba(0, 194, 255, 0.72);
  animation: htu-pulse-dot 1.35s ease-in-out infinite;
}

.htu-section-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 10px;
}

.htu-section-card:last-child {
  margin-bottom: 0;
}

.htu-section-card:hover:not(.htu-section-card--disabled) {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.htu-section-card--disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.htu-section-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #f5fbff;
}

.htu-section-card-desc {
  font-size: 13px;
  color: rgba(226, 239, 255, 0.72);
  line-height: 1.4;
}

.htu-step-message {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(245, 250, 255, 0.94);
  min-height: 60px;
  margin: 0;
}

.htu-step-hint {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(222, 236, 255, 0.72);
}

.htu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  flex: 0 0 auto;
}

.htu-modal--steps {
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border-radius: 18px;
}

.htu-modal--sections {
  width: min(420px, calc(100vw - 32px));
}

.htu-back-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.htu-back-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 22px rgba(7, 30, 70, 0.18);
}

.htu-back-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.htu-next-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 12px 24px rgba(7, 30, 70, 0.18);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.htu-next-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 14px 28px rgba(7, 30, 70, 0.24);
}

.htu-next-btn--pulse {
  box-shadow: 0 0 0 4px rgba(26, 111, 212, 0.14), 0 0 20px rgba(0, 214, 255, 0.34), 0 10px 24px rgba(26, 111, 212, 0.22);
  animation: htu-next-pulse 1.35s ease-in-out infinite;
}

.htu-highlight {
  position: fixed;
  pointer-events: none;
  z-index: 10021;
  box-sizing: border-box;
  border: 2px solid rgba(40, 164, 255, 0.82);
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 18px rgba(0, 194, 255, 0.34),
    0 0 34px rgba(0, 194, 255, 0.18);
  opacity: 1;
  transition:
    top 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.14s ease-out;
  will-change: top, left, width, height;
}

.htu-highlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at center, rgba(180, 238, 255, 0.08) 0%, rgba(150, 225, 255, 0.04) 42%, rgba(120, 205, 255, 0.02) 64%, rgba(120, 205, 255, 0) 82%);
  opacity: 1;
}

.htu-highlight--action {
  border-color: rgba(0, 214, 255, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 20px rgba(0, 214, 255, 0.48),
    0 0 42px rgba(0, 214, 255, 0.24);
  animation: htu-neon-pulse 1.4s ease-in-out infinite;
}

.htu-highlight--action::before {
  background:
    radial-gradient(circle at center, rgba(190, 244, 255, 0.24) 0%, rgba(154, 230, 255, 0.13) 42%, rgba(120, 205, 255, 0.05) 66%, rgba(120, 205, 255, 0) 84%);
  backdrop-filter: brightness(1.16) saturate(1.1);
  -webkit-backdrop-filter: brightness(1.16) saturate(1.1);
}

.htu-highlight--waiting {
  border-style: dashed;
  border-color: rgba(26, 111, 212, 0.45);
  box-shadow: none;
}

.htu-highlight--blocked {
  border-color: rgba(255, 143, 76, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.24),
    0 0 18px rgba(255, 143, 76, 0.28);
}

.htu-highlight::after {
  content: none;
}

.htu-cta-bubble {
  position: fixed;
  z-index: 10022;
  max-width: 240px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(12, 27, 48, 0.92), rgba(0, 112, 201, 0.94));
  border: 1px solid rgba(77, 221, 255, 0.58);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24), 0 0 18px rgba(0, 214, 255, 0.28);
  color: #f7fbff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.16s ease-out;
  animation: htu-indicator-fade 0.16s ease-out;
}

.htu-cta-bubble[aria-hidden="true"] {
  display: none;
}

.htu-cta-bubble--measuring {
  visibility: hidden;
}

.htu-highlight[aria-hidden="true"] {
  display: none;
}

.htu-highlight--action::after,
.htu-cta-bubble::after {
  position: absolute;
  content: none;
}

#twa-sidebar.collapsed #twa-how-to-use-btn {
  display: none;
}

/* Dim overlay — light darkening only (no blur) except the highlighted element */
.htu-dim-overlay,
.htu-blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10018;
  background: rgba(7, 16, 28, 0.3);
  transition: opacity 0.25s ease;
}

.htu-dim-overlay[aria-hidden="true"],
.htu-blur-overlay[aria-hidden="true"] {
  display: none;
}

.htu-mask-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.htu-modal--action-live .htu-header {
  border-bottom-color: rgba(0, 194, 255, 0.18);
}

.htu-modal--blocked .htu-step-action,
.htu-modal--waiting .htu-step-action {
  display: none;
}

@keyframes htu-neon-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(26, 111, 212, 0.2), 0 0 16px rgba(0, 214, 255, 0.72), 0 0 40px rgba(0, 214, 255, 0.26), 0 16px 42px rgba(26, 111, 212, 0.18);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(26, 111, 212, 0.24), 0 0 26px rgba(0, 214, 255, 1), 0 0 66px rgba(0, 214, 255, 0.48), 0 16px 44px rgba(26, 111, 212, 0.24);
  }
}

@keyframes htu-pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@keyframes htu-next-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(26, 111, 212, 0.12), 0 0 16px rgba(0, 214, 255, 0.26), 0 10px 22px rgba(26, 111, 212, 0.18);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(26, 111, 212, 0.18), 0 0 26px rgba(0, 214, 255, 0.4), 0 12px 28px rgba(26, 111, 212, 0.24);
    transform: translateY(-1px);
  }
}

@keyframes htu-indicator-fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .htu-modal {
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
  }

  .htu-modal--steps {
    width: auto;
    min-width: 0;
    max-height: min(58vh, 520px);
  }

  .htu-cta-bubble {
    max-width: 180px;
    white-space: normal;
  }
}
