/* DRR DAMSON / Świat ze Sklejki — Fox Assistant Stage 1
   Lekki frontendowy widget czatu. Bez API key. Bez backendu.
*/

:root {
  --drr-fox-bg: #071313;
  --drr-fox-bg-2: #0d2020;
  --drr-fox-panel: rgba(8, 19, 19, 0.96);
  --drr-fox-line: rgba(115, 231, 213, 0.24);
  --drr-fox-turquoise: #36e0ca;
  --drr-fox-green: #0f6f5e;
  --drr-fox-gold: #d6ad63;
  --drr-fox-wood: #c88d4e;
  --drr-fox-text: #effaf7;
  --drr-fox-muted: rgba(239, 250, 247, 0.72);
  --drr-fox-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
  --drr-fox-radius: 22px;
  --drr-fox-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#drrFoxAssistant,
#drrFoxAssistant * {
  box-sizing: border-box;
}

#drrFoxAssistant {
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 2147482900;
  font-family: var(--drr-fox-font);
  color: var(--drr-fox-text);
  isolation: isolate;
}

#drrFoxAssistant[hidden] {
  display: none !important;
}

.drr-fox-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.drr-fox-launcher {
  width: 136px;
  height: 150px;
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.35));
  transform: translateZ(0);
  transition: transform 180ms ease, filter 180ms ease;
}

.drr-fox-launcher:hover,
.drr-fox-launcher:focus-visible {
  transform: translateY(-5px) rotate(-1.5deg);
  filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.45));
  outline: none;
}

.drr-fox-launcher:focus-visible::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid var(--drr-fox-turquoise);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(54, 224, 202, 0.12);
  pointer-events: none;
}

.drr-fox-avatar {
  width: 144px;
  height: 144px;
  overflow: visible;
  transform-origin: 50% 74%;
  animation: drrFoxBreath 4.8s ease-in-out infinite;
}

.drr-fox-launcher:hover .drr-fox-avatar,
#drrFoxAssistant.is-open .drr-fox-avatar {
  animation: drrFoxActive 1.8s ease-in-out infinite;
}

.drr-fox-tail {
  transform-box: fill-box;
  transform-origin: 30% 75%;
  animation: drrFoxTailIdle 3.4s ease-in-out infinite;
}

.drr-fox-launcher:hover .drr-fox-tail,
#drrFoxAssistant.is-open .drr-fox-tail {
  animation: drrFoxTailWag 780ms ease-in-out infinite;
}

.drr-fox-eye-left,
.drr-fox-eye-right {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: drrFoxBlink 5.7s infinite;
}

.drr-fox-brow-left,
.drr-fox-brow-right {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 180ms ease;
}

.drr-fox-launcher:hover .drr-fox-brow-left,
#drrFoxAssistant.is-open .drr-fox-brow-left {
  transform: translateY(-2px) rotate(-7deg);
}

.drr-fox-launcher:hover .drr-fox-brow-right,
#drrFoxAssistant.is-open .drr-fox-brow-right {
  transform: translateY(-2px) rotate(7deg);
}

.drr-fox-ear-left,
.drr-fox-ear-right {
  transform-box: fill-box;
  transform-origin: 50% 86%;
  animation: drrFoxEarTwitch 6.4s ease-in-out infinite;
}

.drr-fox-ear-right {
  animation-delay: 1.15s;
}

.drr-fox-laser-glow {
  opacity: 0.72;
  animation: drrFoxGlow 2.6s ease-in-out infinite;
}

.drr-fox-mini-badge {
  position: absolute;
  right: 6px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #fff7d7, var(--drr-fox-gold) 46%, #7d4a19 100%);
  color: #10211d;
  font-weight: 900;
  font-size: 13px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 8px 16px rgba(0,0,0,0.38), 0 0 18px rgba(54, 224, 202, 0.18);
}

.drr-fox-notice {
  position: absolute;
  right: 104px;
  bottom: 100px;
  min-width: 190px;
  max-width: 250px;
  padding: 11px 13px;
  border: 1px solid rgba(54, 224, 202, 0.28);
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(145deg, rgba(10, 29, 29, 0.96), rgba(14, 45, 41, 0.94));
  color: var(--drr-fox-text);
  box-shadow: var(--drr-fox-shadow);
  font-size: 13px;
  line-height: 1.35;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

#drrFoxAssistant.is-open .drr-fox-notice,
#drrFoxAssistant.has-dismissed-notice .drr-fox-notice {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
}

.drr-fox-panel {
  position: absolute;
  right: 0;
  bottom: 136px;
  width: min(340px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 156px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(54, 224, 202, 0.24);
  border-radius: var(--drr-fox-radius);
  background:
    radial-gradient(circle at 18% 0%, rgba(54, 224, 202, 0.16), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(214, 173, 99, 0.12), transparent 34%),
    linear-gradient(160deg, rgba(7, 19, 19, 0.98), rgba(13, 31, 31, 0.96));
  box-shadow: var(--drr-fox-shadow), 0 0 0 1px rgba(255,255,255,0.03) inset;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(14px);
}

#drrFoxAssistant.is-open .drr-fox-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.drr-fox-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 85%);
}

.drr-fox-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 15px 13px;
  border-bottom: 1px solid rgba(54, 224, 202, 0.18);
  background: linear-gradient(90deg, rgba(54, 224, 202, 0.10), rgba(214, 173, 99, 0.06));
}

.drr-fox-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.drr-fox-avatar-mini {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(54,224,202,0.16), rgba(214,173,99,0.12));
  border: 1px solid rgba(54, 224, 202, 0.22);
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}

.drr-fox-avatar-mini svg {
  width: 31px;
  height: 31px;
}

.drr-fox-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 860;
  letter-spacing: 0.01em;
}

.drr-fox-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.2;
  color: var(--drr-fox-muted);
}

.drr-fox-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(255,255,255,0.04);
  color: var(--drr-fox-text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.drr-fox-close:hover,
.drr-fox-close:focus-visible {
  background: rgba(54,224,202,0.12);
  border-color: rgba(54,224,202,0.34);
  transform: rotate(4deg);
  outline: none;
}

.drr-fox-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 112px;
  max-height: 285px;
  padding: 12px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(54, 224, 202, 0.42) rgba(255,255,255,0.06);
}

.drr-fox-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 122px;
}

.drr-fox-msg {
  max-width: 96%;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.38;
  white-space: pre-line;
  word-break: break-word;
}

.drr-fox-msg-bot {
  align-self: flex-start;
  border: 1px solid rgba(54, 224, 202, 0.20);
  background: rgba(11, 35, 34, 0.84);
  color: var(--drr-fox-text);
  border-bottom-left-radius: 5px;
}

.drr-fox-msg-user {
  align-self: flex-end;
  border: 1px solid rgba(214, 173, 99, 0.26);
  background: linear-gradient(145deg, rgba(214, 173, 99, 0.20), rgba(54, 224, 202, 0.10));
  color: #fff9e8;
  border-bottom-right-radius: 5px;
}

.drr-fox-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.drr-fox-chip {
  border: 1px solid rgba(54, 224, 202, 0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  color: var(--drr-fox-text);
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}


#drrFoxAssistant.has-chat-started .drr-fox-quick {
  display: none !important;
}

.drr-fox-chip:hover,
.drr-fox-chip:focus-visible {
  transform: translateY(-1px);
  background: rgba(54, 224, 202, 0.13);
  border-color: rgba(54, 224, 202, 0.44);
  outline: none;
}

.drr-fox-form {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 10px 12px 9px;
  border-top: 1px solid rgba(54, 224, 202, 0.16);
  background: rgba(5, 13, 13, 0.45);
}

.drr-fox-input {
  min-width: 0;
  flex: 1;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.055);
  color: var(--drr-fox-text);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.drr-fox-input::placeholder {
  color: rgba(239,250,247,0.48);
}

.drr-fox-input:focus {
  border-color: rgba(54, 224, 202, 0.55);
  box-shadow: 0 0 0 4px rgba(54, 224, 202, 0.10);
  background: rgba(255,255,255,0.075);
}

.drr-fox-send {
  flex: 0 0 auto;
  height: 42px;
  min-width: 48px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--drr-fox-turquoise), #127a69);
  color: #05201b;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(54, 224, 202, 0.16);
  transition: transform 150ms ease, filter 150ms ease;
}

.drr-fox-send:hover,
.drr-fox-send:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.08);
  outline: none;
}

.drr-fox-cta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 12px 10px;
  background: rgba(5, 13, 13, 0.45);
}

.drr-fox-cta a,
.drr-fox-cta button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 14px;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
  border: 1px solid rgba(54, 224, 202, 0.20);
  background: rgba(255,255,255,0.05);
  color: var(--drr-fox-text);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.drr-fox-cta a:first-child {
  border-color: rgba(214, 173, 99, 0.32);
  background: linear-gradient(135deg, rgba(214, 173, 99, 0.20), rgba(54, 224, 202, 0.08));
}

.drr-fox-cta a:hover,
.drr-fox-cta a:focus-visible,
.drr-fox-cta button:hover,
.drr-fox-cta button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(54, 224, 202, 0.44);
  background: rgba(54, 224, 202, 0.11);
  outline: none;
}

.drr-fox-footnote {
  padding: 0 12px 11px;
  color: rgba(239, 250, 247, 0.54);
  font-size: 11.5px;
  line-height: 1.34;
  background: rgba(5, 13, 13, 0.45);
}

@keyframes drrFoxBreath {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(0.4deg); }
}

@keyframes drrFoxActive {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-0.8deg); }
}

@keyframes drrFoxTailIdle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(6deg); }
}

@keyframes drrFoxTailWag {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(14deg); }
}

@keyframes drrFoxBlink {
  0%, 88%, 92%, 100% { transform: scaleY(1); }
  90% { transform: scaleY(0.12); }
}

@keyframes drrFoxEarTwitch {
  0%, 80%, 100% { transform: rotate(0deg); }
  84% { transform: rotate(-5deg); }
  88% { transform: rotate(3deg); }
}

@keyframes drrFoxGlow {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.88; }
}

@media (min-width: 520px) {
  .drr-fox-cta {
    grid-template-columns: 1fr 1fr;
  }

  .drr-fox-cta a:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  #drrFoxAssistant {
    right: 12px;
    bottom: 12px;
  }

  .drr-fox-launcher {
    width: 102px;
    height: 114px;
  }

  .drr-fox-avatar {
    width: 110px;
    height: 110px;
  }

  .drr-fox-mini-badge {
    width: 30px;
    height: 30px;
    right: 2px;
    bottom: 7px;
    font-size: 11px;
  }

  .drr-fox-notice {
    display: none;
  }

  .drr-fox-panel {
    right: 0;
    bottom: 106px;
    width: calc(100vw - 24px);
    max-height: min(62vh, calc(100vh - 132px));
    border-radius: 20px;
  }

  .drr-fox-body {
    max-height: 220px;
  }

  .drr-fox-msg {
    max-width: 96%;
  }

  .drr-fox-chip {
    font-size: 12px;
    padding: 8px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drr-fox-avatar,
  .drr-fox-tail,
  .drr-fox-eye-left,
  .drr-fox-eye-right,
  .drr-fox-ear-left,
  .drr-fox-ear-right,
  .drr-fox-laser-glow {
    animation: none !important;
  }

  .drr-fox-launcher,
  .drr-fox-panel,
  .drr-fox-chip,
  .drr-fox-send,
  .drr-fox-cta a,
  .drr-fox-close {
    transition: none !important;
  }
}

/* Stage 2 brain states */
.drr-fox-msg-thinking {
  position: relative;
  font-style: italic;
  color: rgba(239, 250, 247, 0.82);
  overflow: hidden;
  animation: drrFoxThinkingPulse 1s ease-in-out infinite;
}

.drr-fox-msg-thinking::after {
  content: "…";
  display: inline-block;
  margin-left: 2px;
}

.drr-fox-msg-error {
  border-color: rgba(214, 173, 99, 0.36);
  background: linear-gradient(145deg, rgba(58, 34, 14, 0.72), rgba(13, 31, 31, 0.84));
}

#drrFoxAssistant.is-busy .drr-fox-send,
#drrFoxAssistant.is-busy .drr-fox-input {
  opacity: 0.72;
}

.drr-fox-send:disabled,
.drr-fox-input:disabled {
  cursor: not-allowed;
}

@keyframes drrFoxThinkingPulse {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 1; }
}


/* Hide legacy Pomagier helper when FOX is active */
body .ai-helper,
body .ai-helper-root,
body .drr-ai-helper,
body [data-ai-helper] {
  display: none !important;
}
