:root {
  --isl-accent: #7e2168;
  --isl-accent-2: #0077bd;
  --isl-bg: #040714;
  --isl-card: rgba(15, 23, 42, .98);
  --isl-card-2: rgba(15, 23, 42, .95);
  --isl-border: rgba(148, 163, 184, .35);
  --isl-muted: #9ca3af;
  --isl-text: #f3f4f6;
  --isl-radius: 16px;
  --isl-radius-sm: 10px;
  --isl-shadow: 0 20px 55px rgba(0, 0, 0, .75);
}

.isl-sign-modal,
.isl-sign-modal * {
  box-sizing: border-box;
}

body.isl-body-locked {
  overflow: hidden;
}

/* Trigger button */
.isl-sign-open-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--isl-accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  box-shadow: 0 10px 25px rgba(126, 33, 104, .35);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.isl-sign-open-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(126, 33, 104, .4);
  opacity: .95;
}

.isl-sign-open-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(126, 33, 104, .35);
}

.isl-open-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.isl-open-label-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Modal overlay */
.isl-sign-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  padding: 10px;
  background: rgba(5, 7, 13, .66);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}

.isl-sign-modal.isl-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* Tools drawer placement */
.isl-modal-tools {
  justify-content: flex-end;
  align-items: flex-end;
  padding: 18px;
}

/* ISL center placement */
.isl-modal-isl {
  justify-content: center;
  align-items: center;
}

/* Modal content */
.isl-sign-modal-content {
  position: relative;
  padding: 12px 14px 10px;
  border-radius: var(--isl-radius);
  color: var(--isl-text);
  background:
    radial-gradient(circle at top left, rgba(126, 33, 104, .12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, .25), var(--isl-bg));
  box-shadow: var(--isl-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Drawer (small) */
.isl-modal-tools .isl-sign-modal-content {
  width: min(390px, 100%);
  max-height: min(70vh, 560px);
}

/* ISL (big) */
.isl-modal-isl .isl-sign-modal-content {
  width: min(980px, 100%);
  height: min(90vh, 820px);
}

/* Close button */
.isl-sign-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, .92);
  color: #e5e7eb;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
  z-index: 2;
}

.isl-sign-close:hover {
  background: rgba(31, 41, 55, 1);
  transform: scale(1.03);
}

/* Step header */
.isl-step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding-right: 32px;
}

.isl-step-header h2 {
  margin: 0 0 2px;
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
}

.isl-step-header p {
  margin: 0;
  font-size: 11px;
  color: var(--isl-muted);
}

/* ISL header */
.isl-step-header-isl {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.isl-step-header-text h2 {
  margin: 0 0 2px;
  font-size: 16px;
}

.isl-step-header-text p {
  margin: 0;
  font-size: 12px;
  color: var(--isl-muted);
}

.isl-back-to-tools {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, .95);
  color: #e5e7eb;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, .4);
  transition: background .12s ease, transform .1s ease;
}

.isl-back-to-tools:hover {
  background: rgba(30, 41, 59, 1);
  transform: translateY(-1px);
}

/* Tools grid */
.isl-step-tools {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.isl-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding-right: 3px;
  margin-top: 4px;
}

/* big ISL card full width = cleaner separation */
.isl-tool-main {
  grid-column: 1 / -1;
}

.isl-tools-grid::-webkit-scrollbar {
  width: 6px;
}

.isl-tools-grid::-webkit-scrollbar-track {
  background: transparent;
}

.isl-tools-grid::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .7);
  border-radius: 999px;
}

.isl-tools-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 1);
}

.isl-tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--isl-radius-sm);
  border: 1px solid var(--isl-border);
  background: var(--isl-card);
  color: #e5e7eb;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.isl-tool-card:hover {
  background: rgba(30, 41, 59, 1);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .45);
}

.isl-tool-main {
  border-color: rgba(126, 33, 104, .8);
  background: radial-gradient(circle at top left, rgba(126, 33, 104, .26), rgba(15, 23, 42, .98));
}

.isl-tool-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.isl-tool-title {
  font-weight: 800;
  font-size: 11px;
}

.isl-tool-subtitle {
  font-size: 10px;
  color: var(--isl-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.isl-tool-card.isl-tool-active {
  border-color: var(--isl-accent);
  box-shadow: 0 10px 22px rgba(126, 33, 104, .35);
}

.isl-tool-card.isl-tool-active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 7px;
  font-size: 10px;
  background: #22c55e;
  color: #022c22;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ISL layout */
.isl-step-isl {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.isl-sign-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
  align-items: flex-start;
  overflow-y: auto;
  padding-right: 2px;
}

.isl-sign-video-wrapper {
  background: var(--isl-card-2);
  border-radius: var(--isl-radius);
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, .15);
}

.isl-sign-video-frame {
  position: relative;
  border-radius: var(--isl-radius);
  overflow: hidden;
  background: #000;
}

#isl-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--isl-radius);
  background: #000;
  object-fit: cover;
}

#isl-debug-canvas,
.isl-debug-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.isl-sign-helper {
  margin-top: 8px;
  font-size: 12px;
  color: var(--isl-muted);
}

.isl-sign-side-panel {
  background: var(--isl-card-2);
  border-radius: var(--isl-radius);
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.isl-sign-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.isl-sign-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(15, 23, 42, .9);
  border: 1px solid rgba(148, 163, 184, .25);
  color: #e5e7eb;
}

.isl-sign-chip-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 6px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .18);
}

.isl-sign-status-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--isl-muted);
}

.isl-sign-status-value {
  font-weight: 900;
  font-size: 18px;
  color: #f9fafb;
}

.isl-sign-confidence {
  font-size: 12px;
  color: #e5e7eb;
}

.isl-sign-word-pill {
  margin-top: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .85);
  border: 1px dashed rgba(148, 163, 184, .35);
  font-size: 13px;
  display: flex;
  align-items: center;
  color: #e5e7eb;
}

.isl-sign-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.isl-sign-btn {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.isl-sign-btn-primary {
  background: var(--isl-accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(126, 33, 104, .38);
}

.isl-sign-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(126, 33, 104, .5);
}

.isl-sign-btn-secondary {
  background: rgba(15, 23, 42, 1);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, .35);
}

.isl-sign-btn-secondary:hover {
  background: rgba(30, 41, 59, 1);
}

.isl-sign-suggestion {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, .96);
  border: 1px solid rgba(59, 130, 246, .35);
  font-size: 13px;
  color: #e5e7eb;
}

.isl-sign-suggestion strong {
  color: #bfdbfe;
}

.isl-page-suggestions {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
}

.isl-page-suggestion-item {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .9);
  border: 1px solid rgba(148, 163, 184, .35);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s ease, transform .1s ease;
}

.isl-page-suggestion-item:hover {
  background: rgba(126, 33, 104, .85);
  transform: translateY(-1px);
}

.isl-page-suggestion-empty {
  cursor: default;
  opacity: .7;
}

/* Accessibility classes */
html.isl-acc-high-contrast,
html.isl-acc-high-contrast body {
  background-color: #000 !important;
  color: #fff !important;
}

html.isl-acc-high-contrast body {
  filter: contrast(1.3) brightness(1.05);
}

html.isl-acc-invert body {
  filter: invert(1) hue-rotate(180deg);
}

html.isl-acc-desaturate body {
  filter: grayscale(1);
}

html.isl-acc-highlight-links a {
  outline: 2px solid #f97316;
  background: rgba(249, 115, 22, .1);
  text-decoration: underline !important;
}

html.isl-acc-text-bigger {
  font-size: 112% !important;
}

html.isl-acc-text-smaller {
  font-size: 90% !important;
}

html.isl-acc-text-spacing body {
  letter-spacing: .06em !important;
  word-spacing: .12em !important;
}

html.isl-acc-lineheight body {
  line-height: 1.6 !important;
}

html.isl-acc-hide-images img {
  filter: grayscale(1) opacity(.15);
}

html.isl-acc-big-cursor,
html.isl-acc-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 64 64'%3E%3Cpath fill='%23ffffff' stroke='%23000000' stroke-width='3' d='M10 6 L10 50 L22 38 L30 58 L40 53 L32 35 L50 35 Z'/%3E%3C/svg%3E") 6 2, auto !important;
}

/* TTS highlight */
.isl-tts-highlight {
  background: rgba(0, 119, 189, .08) !important;
  outline: 2px solid var(--isl-accent-2) !important;
}

/* Voice assistant topic focus highlight */
.isl-focus-highlight {
  background: rgba(126, 33, 104, .14) !important;
  outline: 3px solid rgba(126, 33, 104, .55) !important;
  border-radius: 10px !important;
  padding: 2px 6px !important;
  scroll-margin-top: 120px;
}

/* Voice overlay */
.isl-voice-overlay {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%) translateY(-10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .92);
  border: 1px solid rgba(148, 163, 184, .35);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(8px);
}

.isl-voice-overlay.isl-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.isl-voice-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, .18);
}

.isl-voice-title {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.isl-voice-sub {
  font-size: 11px;
  color: #cbd5e1;
  max-width: 52vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.isl-voice-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.isl-voice-eq span {
  width: 3px;
  height: 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, .9);
  animation: islEq 900ms infinite ease-in-out;
}

.isl-voice-eq span:nth-child(2) {
  animation-delay: 120ms;
  height: 12px;
}

.isl-voice-eq span:nth-child(3) {
  animation-delay: 240ms;
  height: 7px;
}

.isl-voice-eq span:nth-child(4) {
  animation-delay: 360ms;
  height: 14px;
}

@keyframes islEq {

  0%,
  100% {
    transform: scaleY(.6);
    opacity: .7;
  }

  50% {
    transform: scaleY(1.25);
    opacity: 1;
  }
}

.isl-voice-overlay.isl-state-speaking .isl-voice-dot {
  background: var(--isl-accent);
  box-shadow: 0 0 0 6px rgba(126, 33, 104, .2);
}

.isl-voice-overlay.isl-state-thinking .isl-voice-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 6px rgba(96, 165, 250, .18);
}

.isl-voice-overlay.isl-state-error .isl-voice-dot {
  background: #ef4444;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, .18);
}

/* Responsive */
@media (max-width: 900px) {
  .isl-sign-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .isl-sign-side-panel {
    order: -1;
  }
}

@media (max-width: 480px) {
  .isl-tools-grid {
    grid-template-columns: 1fr;
  }

  .isl-tool-subtitle {
    -webkit-line-clamp: 2;
  }

  .isl-voice-sub {
    max-width: 78vw;
  }
}


#isl-video {
  position: relative;
  z-index: 1;
}

#isl-debug-canvas {
  z-index: 2;
}