  [x-cloak] { display: none !important; }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes slideInRight {
    from { opacity: 0; transform: translateX(14px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes typingDots {
    0%, 80%, 100% { opacity: 0.2; }
    40%            { opacity: 1; }
  }
  @keyframes alertFlash {
    0%, 100% { background-color: rgba(239,68,68,0.08); }
    30%       { background-color: rgba(239,68,68,0.22); }
  }
  @keyframes successPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  }
  @keyframes termBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
  }

  .fade-in-up  { animation: fadeInUp  0.4s ease-out both; }
  .slide-left  { animation: slideInLeft  0.35s ease-out both; }
  .slide-right { animation: slideInRight 0.35s ease-out both; }

  /* Chat bubbles */
  .bubble-user {
    background: rgba(245,158,11,0.15);
    border: 1px solid rgba(245,158,11,0.35);
    border-radius: 1rem 0 1rem 1rem;
    padding: 0.75rem 0.95rem;
    font-size: 0.83rem;
    line-height: 1.55;
    color: #fde68a;
    max-width: 80%;
  }
  .bubble-aria {
    background: #1a2234;
    border: 1px solid #1e3a5f;
    border-radius: 0 1rem 1rem 1rem;
    padding: 0.75rem 0.95rem;
    font-size: 0.83rem;
    line-height: 1.6;
    color: #bfdbfe;
    max-width: 82%;
  }
  .bubble-aria.breach {
    border-color: rgba(239,68,68,0.5);
    background: rgba(239,68,68,0.06);
    animation: alertFlash 0.6s ease-out;
  }
  .bubble-aria.partial {
    border-color: rgba(245,158,11,0.4);
    background: rgba(245,158,11,0.05);
  }

  /* Typing dots */
  .typing-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #4b83c0;
    border-radius: 50%;
    animation: typingDots 1.2s infinite;
  }
  .typing-dot:nth-child(2) { animation-delay: 0.2s; }
  .typing-dot:nth-child(3) { animation-delay: 0.4s; }

  /* System prompt block */
  .system-prompt-block {
    background: #060d1a;
    border: 1px solid #1e3a5f;
    border-radius: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    color: #7dd3fc;
    padding: 1rem 1.2rem;
    overflow-x: auto;
  }
  .system-prompt-block .prompt-label {
    color: #f87171;
    font-weight: bold;
  }
  .system-prompt-block .prompt-rule {
    color: #fde68a;
  }
  .system-prompt-block .prompt-tool {
    color: #86efac;
  }

  /* Technique library */
  .technique-row {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    padding: 0.65rem 0;
  }
  .technique-row:last-child { border-bottom: none; }

  .level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem; height: 1.4rem;
    border-radius: 0.3rem;
    font-size: 0.6rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    flex-shrink: 0;
  }
  .badge-success { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.4); }
  .badge-fail    { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
  .badge-partial { background: rgba(245,158,11,0.1); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }

  /* Alert banners */
  .alert-breach {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.5);
    border-radius: 0.6rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: #f87171;
    margin-top: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .alert-partial {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.4);
    border-radius: 0.6rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: #fbbf24;
    margin-top: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Level selector */
  .level-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1.5px solid #374151;
    background: #111827;
    color: #9ca3af;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
  }
  .level-btn:hover { border-color: #9ca3af; color: #9ca3af; }
  .level-btn.active {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.12);
    color: #60a5fa;
  }
  .level-btn.active.lvl2 { border-color: #f59e0b; background: rgba(245,158,11,0.1); color: #fbbf24; }
  .level-btn.active.lvl3 { border-color: #f97316; background: rgba(249,115,22,0.1); color: #fb923c; }
  .level-btn.active.lvl4 { border-color: #22c55e; background: rgba(34,197,94,0.1); color: #4ade80; }

  /* Technique detector bar */
  .detector-bar {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    font-family: 'Courier New', monospace;
    color: #60a5fa;
    min-height: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
  }
  .detector-bar.detected-inject  { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); color: #f87171; }
  .detector-bar.detected-roleplay{ border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); color: #f87171; }
  .detector-bar.detected-soceng  { border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.07); color: #fbbf24; }
  .detector-bar.detected-indirect{ border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); color: #f87171; }
  .detector-bar.detected-lang    { border-color: rgba(168,85,247,0.5); background: rgba(168,85,247,0.07); color: #c084fc; }
  .detector-bar.detected-transfer{ border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.07); color: #fbbf24; }
  .detector-bar.detected-data    { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); color: #f87171; }

  /* Chat area */
  .chat-messages {
    min-height: 300px;
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    scroll-behavior: smooth;
  }
  .chat-messages::-webkit-scrollbar { width: 3px; }
  .chat-messages::-webkit-scrollbar-track { background: transparent; }
  .chat-messages::-webkit-scrollbar-thumb { background: #1e3a5f; border-radius: 2px; }

  /* Defender checklist */
  .def-item {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .def-item:last-child { border-bottom: none; }

  /* Technique panel toggle */
  .technique-panel {
    transition: max-height 0.3s ease-out, opacity 0.3s;
    overflow: hidden;
  }

  /* ARIA avatar */
  .aria-avatar {
    width: 2rem; height: 2rem;
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #93c5fd;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
    border: 1px solid #1e3a5f;
  }

  /* Input */
  .chat-input {
    width: 100%;
    background: #0d1625;
    border: 1px solid #1e3a5f;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: #fde68a;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    outline: none;
    resize: none;
    transition: border-color 0.2s;
    line-height: 1.5;
  }
  .chat-input:focus { border-color: #3b82f6; }
  .chat-input::placeholder { color: #6b7280; }

  /* Terminal cursor blink */
  .term-cursor {
    display: inline-block;
    width: 2px; height: 0.85em;
    background: #60a5fa;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: termBlink 1s step-end infinite;
  }

  /* Streaming cursor (faster, inline with text) */
  .stream-cursor {
    display: inline-block;
    width: 2px; height: 0.8em;
    background: #93c5fd;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: termBlink 0.6s step-end infinite;
  }

  /* Tool call execution bubble */
  .tool-call-bubble {
    background: rgba(34,197,94,0.05);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 0.6rem;
    padding: 0.55rem 0.85rem;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    max-width: 82%;
  }
  .tool-call-bubble .tc-header { color: #4ade80; font-weight: bold; margin-bottom: 0.2rem; display: flex; align-items: center; gap: 0.4rem; }
  .tool-call-bubble .tc-call  { color: #86efac; }
  .tool-call-bubble .tc-arrow { color: #6b7280; margin: 0.15rem 0; }
  .tool-call-bubble .tc-resp  { color: #6b7280; word-break: break-all; }

  /* Token count tag */
  .token-tag {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* Raw context panel */
  .context-panel {
    background: #04080f;
    border: 1px solid #1e3a5f;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    line-height: 1.55;
    color: #475569;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }
  .context-panel .ctx-key    { color: #60a5fa; }
  .context-panel .ctx-str    { color: #86efac; }
  .context-panel .ctx-system { color: #7dd3fc; }
  .context-panel .ctx-user   { color: #fde68a; }
  .context-panel .ctx-inject { color: #f87171; background: rgba(239,68,68,0.1); border-radius: 2px; }
  .context-panel::-webkit-scrollbar { width: 3px; }
  .context-panel::-webkit-scrollbar-thumb { background: #1e3a5f; border-radius: 2px; }
