:root {
  --aw-panel-bg: rgba(255, 255, 255, 0.96);
  --aw-panel-border: rgba(18, 36, 60, 0.12);
  --aw-panel-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  --aw-accent: #1f5eff;
  --aw-accent-soft: rgba(31, 94, 255, 0.1);
  --aw-text: #0f172a;
  --aw-muted: #5b6474;
  --aw-filter-grayscale: grayscale(0);
  --aw-filter-invert: invert(0);
  --aw-filter-contrast: contrast(1);
  --aw-filter-brightness: brightness(1);
}

html.aw-enabled #root .sky > *:not(.ai-w) {
  filter: var(--aw-filter-grayscale) var(--aw-filter-invert) var(--aw-filter-contrast)
    var(--aw-filter-brightness);
  transition: filter 0.2s ease;
}

html.aw-grayscale {
  --aw-filter-grayscale: grayscale(1);
}

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

html.aw-high-contrast {
  --aw-filter-contrast: contrast(1.22) saturate(1.08);
}

html.aw-light-background {
  --aw-filter-brightness: brightness(1.12);
}

html.aw-underline-links #root a {
  text-decoration: underline !important;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.1em;
}

html.aw-readable-font #root,
html.aw-readable-font #root * {
  font-family: Arial, "Noto Sans Hebrew", sans-serif !important;
}

#root .ai-w {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 11000 !important;
}

.aw-root {
  position: fixed;
  left: 16px;
  bottom: 186px;
  z-index: 10001;
  direction: rtl;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  color: var(--aw-text);
}

.aw-toggle {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #255fe7, #173fa8);
  color: #fff;
  box-shadow: var(--aw-panel-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aw-toggle:focus-visible,
.aw-action:focus-visible,
.aw-footer-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.aw-toggle svg {
  width: 28px;
  height: 28px;
}

.aw-toggle img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.aw-panel {
  position: absolute;
  left: 0;
  bottom: 64px;
  width: 248px;
  max-width: min(248px, calc(100vw - 32px));
  background: var(--aw-panel-bg);
  border: 1px solid var(--aw-panel-border);
  border-radius: 16px;
  box-shadow: var(--aw-panel-shadow);
  backdrop-filter: blur(12px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.aw-root[data-open="true"] .aw-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.aw-header {
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--aw-panel-border);
}

.aw-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.aw-subtitle {
  margin: 6px 0 0;
  color: var(--aw-muted);
  font-size: 0.82rem;
}

.aw-body {
  padding: 8px;
}

.aw-action {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  text-align: right;
}

.aw-action:hover {
  background: rgba(15, 23, 42, 0.045);
}

.aw-action[data-active="true"] {
  background: var(--aw-accent-soft);
  color: var(--aw-accent);
}

.aw-action-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.aw-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex-shrink: 0;
}

.aw-icon svg {
  width: 18px;
  height: 18px;
}

.aw-note {
  font-size: 0.75rem;
  color: var(--aw-muted);
}

.aw-divider {
  height: 1px;
  margin: 6px 10px;
  background: var(--aw-panel-border);
}

.aw-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--aw-panel-border);
  background: rgba(248, 250, 252, 0.86);
}

.aw-footer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--aw-text);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 8px 6px;
  border-radius: 10px;
}

.aw-footer-link:hover {
  background: rgba(15, 23, 42, 0.045);
}

@media (max-width: 640px) {
  #root .ai-w {
    left: 12px !important;
    bottom: 8px !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
  }

  .aw-root {
    left: auto;
    right: 0;
    top: auto;
    bottom: 8px;
    transform: none;
  }

  .aw-panel {
    left: auto;
    right: 0;
    bottom: 56px;
    top: auto;
    transform: translateY(10px);
    width: min(248px, calc(100vw - 24px));
  }

  .aw-toggle {
    width: 48px;
    height: 48px;
    border-radius: 14px 0 0 14px;
  }

  .aw-root[data-open="true"] .aw-panel {
    transform: translateY(0);
  }
}
