/* ========================================================================
   DNS Assistant — Marvin Chat Styles
   Base theme inherited from dns-records.css (nav, flyout, footer, mode toggle)
   ======================================================================== */

/* ========================================================================
   Variables
   ======================================================================== */
:root {
  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Brand Identity
     ═══════════════════════════════════════════════════════════════════════ */
  --brand-cyan:            #26c4ff;
  --brand-blue:            #0054ff;
  --brand-gradient:        linear-gradient(90deg, #26c4ff 0%, #0054ff 100%);
  --brand-gradient-hover:  linear-gradient(90deg, #0048d4 0%, #007aff 100%);

  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Dark Mode Backgrounds
     ═══════════════════════════════════════════════════════════════════════ */
  --bg-body:               #000000;
  --bg-section:            #111111;
  --bg-surface:            #1a1a1a;
  --bg-card:               #222222;
  --bg-input:              #1a1a1a;

  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Text Colors
     ═══════════════════════════════════════════════════════════════════════ */
  --text-primary:          #ffffff;
  --text-secondary:        #cccccc;
  --text-muted:            #999999;
  --text-dimmed:           #888888;
  --text-placeholder:      #666666;

  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Borders
     ═══════════════════════════════════════════════════════════════════════ */
  --border-default:        #333333;
  --border-emphasis:       #555555;
  --border-focus:          #26c4ff;

  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Status Colors
     ═══════════════════════════════════════════════════════════════════════ */
  --color-success:         #00c853;
  --color-warning:         #ffab00;
  --color-error:           #ff1744;
  --color-info:            #40a8ff;

  /* ═══════════════════════════════════════════════════════════════════════
     Legacy Variables (mapped to core palette for backward compatibility)
     ═══════════════════════════════════════════════════════════════════════ */
  --clr-bg-gradient-start: var(--bg-body);
  --clr-bg-gradient-end:   var(--bg-section);
  --clr-bg-medium:         var(--bg-surface);
  --clr-bg-overlay:        rgba(8, 34, 67, 0.5);
  --clr-bg-modal-start:    #191919;
  --clr-bg-modal-end:      var(--border-default);
  --clr-text:              var(--text-primary);
  --clr-text-muted:        var(--text-secondary);
  --clr-primary:           var(--brand-blue);
  --clr-primary-dark:      #0447D3;
  --clr-border:            var(--border-default);
  --clr-border-hover:      var(--border-emphasis);
  --chat-accent:           var(--brand-cyan);
  --chat-accent-dark:      var(--brand-blue);
  --chat-max-width:        800px;

  /* ═══════════════════════════════════════════════════════════════════════
     Core Palette — Focus & Interactive
     ═══════════════════════════════════════════════════════════════════════ */
  --focus-ring:            rgba(38, 196, 255, 0.3);
  --accent:                var(--brand-cyan);
  --link-color:            var(--brand-cyan);
}

/* ========================================================================
   1) RESET & SCROLLBARS
   ======================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) var(--clr-bg-medium);
}

::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--clr-bg-medium);
}
::-webkit-scrollbar-thumb {
  background-color: var(--clr-border);
  border-radius: 6px;
  border: 3px solid var(--clr-bg-medium);
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--clr-border-hover);
}

/* ========================================================================
   2) BASE LAYOUT & TYPOGRAPHY
   ======================================================================== */
html {
  font-size: 16px;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial, sans-serif;
  color: var(--clr-text);
  background: linear-gradient(
    120deg,
    var(--clr-bg-gradient-start),
    var(--clr-bg-gradient-end)
  );
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
  margin: 0;
  padding: 0;
}

/* Light Mode Variable Overrides */
[data-theme="light"],
body.light-mode {
  /* Core Palette — Light Mode Backgrounds */
  --bg-body:               #ffffff;
  --bg-section:            #f1f1f1;
  --bg-surface:            #f9f9f9;
  --bg-card:               #f9f9f9;
  --bg-input:              #ffffff;

  /* Core Palette — Light Mode Text Colors */
  --text-primary:          #000000;
  --text-secondary:        #282828;
  --text-muted:            #555555;
  --text-dimmed:           #666666;
  --text-placeholder:      #999999;

  /* Core Palette — Light Mode Borders */
  --border-default:        #cccccc;
  --border-emphasis:       #e5e5e5;
  --border-focus:          #0054ff;

  /* Core Palette — Light Mode Accents */
  --accent:                var(--brand-blue);
  --link-color:            var(--brand-blue);
  --focus-ring:            rgba(0, 84, 255, 0.2);

  /* Legacy Variables — Light Mode Overrides */
  --clr-bg-gradient-start: var(--bg-body);
  --clr-bg-gradient-end:   var(--bg-section);
  --clr-bg-medium:         var(--bg-surface);
  --clr-text:              var(--text-primary);
  --clr-text-muted:        var(--text-secondary);
  --clr-border:            var(--border-default);
  --clr-border-hover:      var(--border-emphasis);
  --chat-accent:           var(--brand-blue);
}

.dark-mode {
  background: var(--clr-bg-gradient-start);
  color: var(--clr-text);
}
.light-mode {
  background: var(--bg-body);
  color: var(--text-primary);
}

/* ========================================================================
   3) CONTAINER
   ======================================================================== */
.container {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode .container {
  background: transparent !important;
  color: #fff !important;
}

body.light-mode .container {
  background: transparent !important;
  color: #000 !important;
}

.content {
  margin-top: 80px;
  margin-bottom: 32px;
  width: 100%;
  transition: color 0.3s ease;
}

body.dark-mode .content {
  color: #fff !important;
}

body.light-mode .content {
  color: #000 !important;
}

/* ========================================================================
   4) NAVIGATION BAR & LOGO (identical to dns-records.css)
   ======================================================================== */
.nav-menu {
  position: fixed;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 14px 20px;
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
  z-index: 1300;
  line-height: 1;
}

.nav-menu.scrolled {
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.light-mode .nav-menu {
  background-color: rgba(255, 255, 255, 1) !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

body.dark-mode .nav-menu {
  background-color: rgba(0, 0, 0, 0.95) !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
}

.nav-menu .mode-switch {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  align-self: center;
}

.nav-menu .menu-icon {
  margin-left: auto;
  flex-shrink: 0;
}

.nav-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.nav-brand-link:hover {
  opacity: 0.85;
}

.nav-logo {
  max-width: 30px;
  height: auto;
  display: block;
  flex-shrink: 0;
  align-self: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

body.light-mode .nav-logo {
  filter: none;
}

body.dark-mode .nav-logo {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: 24px;
  margin-right: 50px;
  flex-grow: 0;
  flex-shrink: 0;
}

.nav-menu .nav-links a,
.menu-icon {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  transition: all 0.3s ease;
  padding: 8px 12px;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-menu .nav-links a:hover,
.menu-icon:hover {
  color: #26c4ff;
  transform: translateY(-1px);
}

body.light-mode .nav-menu .nav-links a,
body.light-mode .menu-icon {
  color: #000 !important;
  text-shadow: none !important;
}

body.light-mode .nav-menu .nav-links a:hover,
body.light-mode .menu-icon:hover {
  color: #0054ff !important;
}

body.dark-mode .nav-menu .nav-links a,
body.dark-mode .menu-icon {
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .nav-menu .nav-links a:hover,
body.dark-mode .menu-icon:hover {
  color: #26c4ff !important;
}

.nav-menu .nav-links a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 12px;
  width: 0;
  height: 2px;
  background: #26c4ff;
  transition: width 0.3s ease;
}

body.light-mode .nav-menu .nav-links a::after {
  background: #0054ff;
}

body.dark-mode .nav-menu .nav-links a::after {
  background: #26c4ff;
}

.nav-menu .nav-links a:hover::after {
  width: calc(100% - 24px);
}

.menu-icon {
  cursor: pointer;
  font-size: 28px;
  color: #fff;
  padding: 4px 8px;
  border: none;
  background: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  z-index: 1300;
  position: relative;
}

.menu-icon:hover {
  transform: scale(1.1);
}

/* ========================================================================
   5) FLYOUT MENU & BACKDROP (identical to dns-records.css)
   ======================================================================== */
.flyout-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1100;
  cursor: pointer;
}

.flyout-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.flyout-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #1a1a1a;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.8);
  padding: 70px 24px 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flyout-menu.open {
  transform: translateX(0);
}

body.light-mode .flyout-menu {
  background: #ffffff !important;
  border-left: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15) !important;
}

body.dark-mode .flyout-menu {
  background: #1a1a1a !important;
  border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.8) !important;
}

.flyout-menu a {
  display: block;
  color: #ffffff;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  margin-bottom: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}

.flyout-menu a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: #26c4ff;
  transform: scaleY(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

.flyout-menu a:hover::before {
  transform: scaleY(1);
}

body.light-mode .flyout-menu a {
  color: #1a1a1a !important;
}

body.light-mode .flyout-menu a::before {
  background: #0054ff;
}

body.light-mode .flyout-menu a:hover {
  background: rgba(0, 84, 255, 0.08) !important;
  color: #0054ff !important;
  transform: translateX(4px);
}

body.dark-mode .flyout-menu a {
  color: #ffffff !important;
}

body.dark-mode .flyout-menu a:hover {
  background: rgba(38, 196, 255, 0.12) !important;
  color: #26c4ff !important;
  transform: translateX(4px);
}

.flyout-menu .flyout-close {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px !important;
  color: #999 !important;
  opacity: 0.8;
  text-align: center;
  font-weight: 600;
}

.flyout-menu .flyout-close::before {
  display: none;
}

body.light-mode .flyout-menu .flyout-close {
  border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
  color: #666 !important;
}

body.light-mode .flyout-menu .flyout-close:hover {
  opacity: 1;
  color: #1a1a1a !important;
  background: rgba(0, 0, 0, 0.05) !important;
  transform: none;
}

body.dark-mode .flyout-menu .flyout-close:hover {
  opacity: 1;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
  transform: none;
}

/* ========================================================================
   6) MODE SWITCH (Dark / Light Toggle)
   ======================================================================== */
.mode-switch {
  display: flex;
  align-items: center;
  margin: 0;
}

.mode-switch input {
  display: none;
}

.mode-switch label {
  width: 35px;
  height: 15px;
  background: #ccc;
  border-radius: 25px;
  position: relative;
  cursor: pointer;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.3s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  display: block;
}

body.light-mode .mode-switch label {
  background: #999 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .mode-switch label {
  background: #666 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

.mode-switch label::after {
  content: '';
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s, background 0.3s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mode-switch input:checked + label::after {
  transform: translateX(20px);
}

/* ========================================================================
   7) CHAT CONTAINER
   ======================================================================== */
.chat-container {
  max-width: var(--chat-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
  border-radius: 24px;
  border: 1px solid transparent;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.chat-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #26c4ff 0%, #0054ff 50%, #26c4ff 100%);
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
  z-index: 1;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 0%; }
}

body.dark-mode .chat-container {
  background: linear-gradient(135deg, rgba(17, 17, 17, 0.98) 0%, rgba(26, 26, 26, 0.98) 100%) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

body.light-mode .chat-container {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(250, 250, 250, 1) 100%) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}

body.light-mode .chat-container::before {
  background: linear-gradient(90deg, #0054ff 0%, #0040cc 50%, #0054ff 100%);
  background-size: 200% 100%;
}

/* ========================================================================
   8) CHAT HEADER
   ======================================================================== */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

body.light-mode .chat-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--chat-accent);
  box-shadow: 0 0 12px rgba(38, 196, 255, 0.3);
}

.chat-header-info h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

body.light-mode .chat-header-info h2 {
  color: #000;
}

.chat-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

body.light-mode .chat-header-info p {
  color: rgba(0, 0, 0, 0.45);
}

/* ========================================================================
   9) MESSAGES AREA
   ======================================================================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

body.light-mode .chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
}

/* ========================================================================
   10) MESSAGE BUBBLES
   ======================================================================== */
.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Marvin messages — left aligned */
.message.marvin {
  align-self: flex-start;
}

.message.marvin .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 4px;
}

.message.marvin .message-bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px 18px 18px 18px;
  padding: 14px 18px;
  color: #fff;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-x: hidden;
  min-width: 0;
}

body.light-mode .message.marvin .message-bubble {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #000;
}

/* User messages — right aligned */
.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #0054ff 0%, #26c4ff 100%);
  border: none;
  border-radius: 18px 4px 18px 18px;
  padding: 14px 18px;
  color: #fff;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-x: hidden;
  min-width: 0;
}

body.light-mode .message.user .message-bubble {
  background: linear-gradient(135deg, #0054ff 0%, #0048d4 100%);
}

/* Error messages — red left border to distinguish from normal responses */
.message.error-message .message-bubble {
  border-left: 3px solid #ef4444;
}

body.light-mode .message.error-message .message-bubble {
  border-left: 3px solid #dc2626;
}

/* ========================================================================
   11) MARKDOWN IN MESSAGES
   ======================================================================== */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
  margin: 12px 0 8px;
  font-weight: 700;
  line-height: 1.3;
}

.message-bubble h1 { font-size: 18px; }
.message-bubble h2 { font-size: 16px; }
.message-bubble h3 { font-size: 15px; }
.message-bubble h4 { font-size: 14px; }

.message-bubble p {
  margin: 0 0 8px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble ul,
.message-bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble a {
  color: var(--chat-accent);
  text-decoration: none;
}

.message-bubble a:hover {
  text-decoration: underline;
}

body.light-mode .message.marvin .message-bubble a {
  color: var(--chat-accent-dark);
}

.message-bubble strong {
  font-weight: 700;
}

/* Code blocks in chat */
.message-bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

body.light-mode .message.marvin .message-bubble code {
  background: rgba(0, 0, 0, 0.08);
}

.message-bubble pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-bubble pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

body.light-mode .message.marvin .message-bubble pre {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Tables in chat */
.message-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 13px;
  table-layout: fixed;
}

.message-bubble th,
.message-bubble td {
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 10px;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-bubble th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

body.light-mode .message.marvin .message-bubble th,
body.light-mode .message.marvin .message-bubble td {
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .message.marvin .message-bubble th {
  background: rgba(0, 0, 0, 0.04);
}

/* ========================================================================
   12) TYPING INDICATOR
   ======================================================================== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  max-width: 85%;
}

.typing-indicator .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.typing-dots {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px 18px 18px 18px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
}

body.light-mode .typing-dots {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-accent);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Typing indicator fade-in */
.typing-indicator {
  animation: fadeSlideIn 0.3s ease-out;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================================
   12b) SCROLL-TO-BOTTOM BUTTON
   ======================================================================== */
.scroll-bottom-btn {
  position: absolute;
  bottom: 180px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.scroll-bottom-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-bottom-btn:hover {
  background: rgba(38, 196, 255, 0.25);
  border-color: var(--chat-accent);
}

.scroll-bottom-btn svg {
  width: 18px;
  height: 18px;
}

body.light-mode .scroll-bottom-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.light-mode .scroll-bottom-btn:hover {
  background: rgba(0, 84, 255, 0.1);
  border-color: var(--chat-accent-dark);
}

/* ========================================================================
   12c) CHARACTER COUNTER
   ======================================================================== */
.char-counter {
  position: absolute;
  bottom: -18px;
  right: 48px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.char-counter.visible {
  opacity: 1;
  visibility: visible;
}

.char-counter.danger {
  color: #ef4444;
}

body.light-mode .char-counter {
  color: rgba(0, 0, 0, 0.4);
}

body.light-mode .char-counter.danger {
  color: #dc2626;
}

/* ========================================================================
   13) QUICK ACTION BUTTONS
   ======================================================================== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px 4px;
  flex-shrink: 0;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  max-height: 200px;
  overflow: hidden;
}

.quick-actions.hidden {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.quick-action-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(38, 196, 255, 0.3);
  background: rgba(38, 196, 255, 0.08);
  color: var(--chat-accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  line-height: 1.3;
}

.quick-action-btn:hover {
  background: rgba(38, 196, 255, 0.18);
  border-color: var(--chat-accent);
  box-shadow: 0 0 12px rgba(38, 196, 255, 0.2);
  transform: translateY(-1px);
}

.quick-action-btn:active {
  transform: translateY(0);
}

body.light-mode .quick-action-btn {
  border-color: rgba(0, 84, 255, 0.3);
  background: rgba(0, 84, 255, 0.06);
  color: var(--chat-accent-dark);
}

body.light-mode .quick-action-btn:hover {
  background: rgba(0, 84, 255, 0.15);
  border-color: var(--chat-accent-dark);
  box-shadow: 0 0 12px rgba(0, 84, 255, 0.15);
}

/* Keyboard focus indicators */
.quick-action-btn:focus-visible,
.chat-header-btn:focus-visible,
.chat-send-btn:focus-visible,
.msg-copy-btn:focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 2px;
}

body.light-mode .quick-action-btn:focus-visible,
body.light-mode .chat-header-btn:focus-visible,
body.light-mode .chat-send-btn:focus-visible,
body.light-mode .msg-copy-btn:focus-visible {
  outline-color: var(--chat-accent-dark);
}

/* ========================================================================
   14) CHAT INPUT AREA
   ======================================================================== */
.chat-input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

body.light-mode .chat-input-area {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 10px 14px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chat-input-wrapper:focus-within {
  border-color: var(--chat-accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 4px rgba(38, 196, 255, 0.15),
    0 6px 24px rgba(38, 196, 255, 0.15);
}

body.light-mode .chat-input-wrapper {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .chat-input-wrapper:focus-within {
  border-color: var(--chat-accent-dark);
  background: rgba(255, 255, 255, 1);
  box-shadow:
    0 0 0 4px rgba(0, 84, 255, 0.12),
    0 6px 24px rgba(0, 84, 255, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
  padding: 2px 0;
  overflow-y: auto;
  align-self: center;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

body.light-mode .chat-input {
  color: #000;
}

body.light-mode .chat-input::placeholder {
  color: rgba(0, 0, 0, 0.55);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #26c4ff 0%, #0054ff 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  padding: 0;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #0054ff 0%, #0048d4 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(38, 196, 255, 0.3);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-send-btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.chat-send-btn.loading svg {
  visibility: hidden;
}

.chat-send-btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

/* Marvin gif next to input area */
.chat-input-marvin {
  width: 70px;
  height: 70px;
  min-width: 70px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ========================================================================
   15) DISCLAIMER
   ======================================================================== */
.chat-disclaimer {
  text-align: center;
  padding: 8px 24px 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

body.light-mode .chat-disclaimer {
  color: rgba(0, 0, 0, 0.35);
}

.chat-legal-links {
  margin-top: 4px;
  font-size: 11px;
}

.chat-legal-links a {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}

.chat-legal-links a:hover {
  color: var(--chat-accent);
  text-decoration: underline;
}

.chat-legal-sep {
  margin: 0 6px;
  opacity: 0.4;
}

body.light-mode .chat-legal-links a {
  color: rgba(0, 0, 0, 0.4);
}

body.light-mode .chat-legal-links a:hover {
  color: var(--chat-accent-dark);
}

/* ========================================================================
   16) CREATOR CREDIT
   ======================================================================== */
.creator {
  font-size: 10pt;
  margin-bottom: 0;
  margin-top: 0.5rem;
  padding-top: 10px;
  color: rgba(128, 128, 128, 0.8);
  transition: color 0.3s ease;
  text-align: center;
}

.creator-link {
  color: rgba(128, 128, 128, 0.8) !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: color 0.3s ease;
}

.creator-link:hover {
  color: rgba(128, 128, 128, 0.8) !important;
  text-decoration: none !important;
}

/* ========================================================================
   17) FOOTER (identical to dns-records.css)
   ======================================================================== */
.site-footer {
  background-color: #000;
  color: #fff;
  border-top: 1px solid #191919;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 60px;
  width: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px 40px;
  box-sizing: border-box;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.footer-brand-link {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.footer-brand-link:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.footer-logo {
  max-width: 140px;
  height: auto;
  margin-bottom: 0;
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.2;
  color: #fff;
  transition: color 0.3s ease;
}

.title-section .logo-title .bold {
  font-weight: 700;
}

.title-section .logo-title .thin {
  font-weight: 300;
}

.footer-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 40px;
}

.footer-column {
  flex: 1 1 140px;
  min-width: 120px;
}

.footer-column h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #fff;
}

.footer-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-column li {
  margin-bottom: 8px;
}

.footer-column a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.2s ease;
  display: inline-block;
}

.footer-column a:hover {
  color: #26c4ff;
  text-decoration: underline;
  transform: translateX(2px);
}

.footer-address {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.footer-address h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #fff;
}

.footer-address p {
  margin: 0 0 12px;
  color: #fff;
  line-height: 1.6;
}

.footer-address a {
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-block;
}

.footer-address a:hover {
  color: #26c4ff;
  text-decoration: underline;
}

.footer-address .social-icons {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  align-items: center;
  justify-content: center;
}

.footer-address .social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.3s ease;
  text-decoration: none;
  border-radius: 4px;
}

.footer-address .social-icons a:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}

.footer-address .social-icons img {
  width: 24px;
  height: 24px;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.footer-bottom {
  background-color: #191919;
  text-align: center;
  padding: 20px 10px;
  border-top: 1px solid #333;
  font-size: 13px;
  color: #fff;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-bottom p {
  margin: 4px 0;
  line-height: 1.6;
}

.footer-bottom a {
  color: #fff;
  text-decoration: none;
  margin: 0 8px;
  transition: color 0.3s ease;
  display: inline-block;
}

.footer-bottom a:hover {
  color: #26c4ff;
  text-decoration: underline;
}

/* Light mode footer */
body.light-mode .site-footer {
  background-color: #fff !important;
  color: #000 !important;
  border-top: 1px solid #E6E6E6;
}

body.light-mode .footer-brand,
body.light-mode .footer-logo,
body.light-mode .title-section,
body.light-mode .logo-title,
body.light-mode .footer-column h4,
body.light-mode .footer-address h4,
body.light-mode .footer-column a,
body.light-mode .footer-address a,
body.light-mode .footer-address p,
body.light-mode .footer-bottom p,
body.light-mode .footer-bottom a {
  color: #000 !important;
}

body.light-mode .footer-column a:hover,
body.light-mode .footer-address a:hover,
body.light-mode .footer-bottom a:hover {
  color: #0054ff !important;
}

body.light-mode .footer-bottom {
  background-color: #E6E6E6 !important;
  color: #000 !important;
  border-top: 1px solid #E6E6E6;
}

/* Dark mode footer */
body.dark-mode .site-footer {
  background-color: #000 !important;
  color: #fff !important;
  border-top: 1px solid #191919;
}

body.dark-mode .footer-column h4,
body.dark-mode .footer-address h4,
body.dark-mode .footer-column a,
body.dark-mode .footer-address a,
body.dark-mode .footer-address p,
body.dark-mode .footer-bottom p,
body.dark-mode .footer-bottom a,
body.dark-mode .logo-title {
  color: #fff !important;
}

body.dark-mode .footer-column a:hover,
body.dark-mode .footer-address a:hover,
body.dark-mode .footer-bottom a:hover {
  color: #26c4ff !important;
}

body.dark-mode .footer-bottom {
  background-color: #191919 !important;
  border-top: 1px solid #333;
}

/* ========================================================================
   18) CHAT HEADER BUTTONS (Export, Fullscreen)
   ======================================================================== */
.chat-header-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  padding: 0;
  flex-shrink: 0;
}

.chat-header-btn:first-of-type {
  margin-left: auto;
}

.chat-header-btn:hover {
  background: rgba(38, 196, 255, 0.15);
  border-color: var(--chat-accent);
  color: var(--chat-accent);
}

.chat-header-btn svg {
  width: 16px;
  height: 16px;
}

body.light-mode .chat-header-btn {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.5);
}

body.light-mode .chat-header-btn:hover {
  background: rgba(0, 84, 255, 0.1);
  border-color: var(--chat-accent-dark);
  color: var(--chat-accent-dark);
}

/* ========================================================================
   18b) MESSAGE COPY BUTTON
   ======================================================================== */
.msg-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: all 0.2s ease;
}

.message.marvin {
  position: relative;
}

.message.marvin:hover .msg-copy-btn {
  opacity: 1;
}

.msg-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--chat-accent);
}

.msg-copy-btn.copied {
  color: #22c55e;
  opacity: 1;
}

.msg-copy-btn svg {
  width: 14px;
  height: 14px;
}

body.light-mode .msg-copy-btn {
  color: rgba(0, 0, 0, 0.2);
}

body.light-mode .msg-copy-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--chat-accent-dark);
}

body.light-mode .msg-copy-btn.copied {
  color: #16a34a;
}

/* ========================================================================
   19) FULLSCREEN CHAT MODE
   ======================================================================== */
.chat-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  border-radius: 0;
  z-index: 2000;
  border: none;
}

.chat-container.fullscreen .chat-messages {
  padding: 24px 48px;
}

.chat-container.fullscreen .message {
  max-width: 70%;
}

.chat-container.fullscreen .chat-header {
  padding: 20px 48px 16px;
}

.chat-container.fullscreen .quick-actions {
  padding: 12px 48px 4px;
}

.chat-container.fullscreen .chat-input-area {
  padding: 16px 48px 20px;
}

.chat-container.fullscreen .chat-disclaimer {
  padding: 8px 48px 4px;
}

body.dark-mode .chat-container.fullscreen {
  background: linear-gradient(135deg, rgba(10, 10, 10, 1) 0%, rgba(20, 20, 20, 1) 100%) !important;
  box-shadow: none !important;
}

body.light-mode .chat-container.fullscreen {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(248, 248, 248, 1) 100%) !important;
  box-shadow: none !important;
}

@media (max-width: 768px) {
  .chat-container.fullscreen .chat-messages,
  .chat-container.fullscreen .chat-header,
  .chat-container.fullscreen .quick-actions,
  .chat-container.fullscreen .chat-input-area,
  .chat-container.fullscreen .chat-disclaimer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .chat-container.fullscreen .message {
    max-width: 90%;
  }
}

/* ========================================================================
   20) DNS COLOR CODING — Tags, Pass/Fail Badges, Record Cards
   ======================================================================== */

/* --- DNS Protocol Tags (SPF, DKIM, DMARC, etc.) --- */
.dns-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9em;
  letter-spacing: 0.02em;
  vertical-align: baseline;
}

.dns-tag-spf {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dns-tag-dkim {
  background: rgba(139, 92, 246, 0.18);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.dns-tag-dmarc {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.dns-tag-bimi {
  background: rgba(20, 184, 166, 0.18);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

.dns-tag-mx {
  background: rgba(244, 114, 182, 0.18);
  color: #f472b6;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.dns-tag-a,
.dns-tag-aaaa {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.dns-tag-cname {
  background: rgba(163, 230, 53, 0.18);
  color: #a3e635;
  border: 1px solid rgba(163, 230, 53, 0.3);
}

.dns-tag-ns {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.dns-tag-txt {
  background: rgba(156, 163, 175, 0.18);
  color: #d1d5db;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.dns-tag-ptr,
.dns-tag-soa {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.dns-tag-caa {
  background: rgba(251, 146, 60, 0.18);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.dns-tag-srv {
  background: rgba(34, 211, 238, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.dns-tag-https,
.dns-tag-svcb {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.dns-tag-naptr {
  background: rgba(232, 121, 249, 0.18);
  color: #e879f9;
  border: 1px solid rgba(232, 121, 249, 0.3);
}

.dns-tag-dnskey,
.dns-tag-ds,
.dns-tag-tlsa {
  background: rgba(192, 132, 252, 0.18);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

/* Light mode adjustments for DNS tags */
body.light-mode .dns-tag-spf {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.25);
}

body.light-mode .dns-tag-dkim {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.25);
}

body.light-mode .dns-tag-dmarc {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.25);
}

body.light-mode .dns-tag-bimi {
  background: rgba(20, 184, 166, 0.12);
  color: #0d9488;
  border-color: rgba(20, 184, 166, 0.25);
}

body.light-mode .dns-tag-mx {
  background: rgba(244, 114, 182, 0.12);
  color: #db2777;
  border-color: rgba(244, 114, 182, 0.25);
}

body.light-mode .dns-tag-a,
body.light-mode .dns-tag-aaaa {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.25);
}

body.light-mode .dns-tag-cname {
  background: rgba(132, 204, 22, 0.12);
  color: #4d7c0f;
  border-color: rgba(132, 204, 22, 0.25);
}

body.light-mode .dns-tag-ns {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

body.light-mode .dns-tag-txt {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border-color: rgba(107, 114, 128, 0.25);
}

body.light-mode .dns-tag-ptr,
body.light-mode .dns-tag-soa {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border-color: rgba(99, 102, 241, 0.25);
}

body.light-mode .dns-tag-caa {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  border-color: rgba(234, 88, 12, 0.25);
}

body.light-mode .dns-tag-srv {
  background: rgba(6, 182, 212, 0.12);
  color: #0891b2;
  border-color: rgba(6, 182, 212, 0.25);
}

body.light-mode .dns-tag-https,
body.light-mode .dns-tag-svcb {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}

body.light-mode .dns-tag-naptr {
  background: rgba(192, 38, 211, 0.12);
  color: #a21caf;
  border-color: rgba(192, 38, 211, 0.25);
}

body.light-mode .dns-tag-dnskey,
body.light-mode .dns-tag-ds,
body.light-mode .dns-tag-tlsa {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
  border-color: rgba(147, 51, 234, 0.25);
}

/* --- Auth Result Badges (pass, fail, softfail, etc.) --- */
.dns-result {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85em;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: baseline;
}

.dns-result-pass {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dns-result-fail {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.dns-result-softfail {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.dns-result-neutral {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dns-result-none {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.dns-result-permerror {
  background: rgba(185, 28, 28, 0.15);
  color: #dc2626;
  border: 1px solid rgba(185, 28, 28, 0.3);
}

.dns-result-temperror {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.dns-result-bestguesspass {
  background: rgba(20, 184, 166, 0.15);
  color: #14b8a6;
  border: 1px solid rgba(20, 184, 166, 0.3);
}

/* Light mode auth result adjustments */
body.light-mode .dns-result-pass {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.25);
}

body.light-mode .dns-result-fail {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

body.light-mode .dns-result-softfail {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

body.light-mode .dns-result-neutral {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.25);
}

body.light-mode .dns-result-none {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
  border-color: rgba(107, 114, 128, 0.25);
}

body.light-mode .dns-result-permerror {
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.25);
}

body.light-mode .dns-result-temperror {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.25);
}

body.light-mode .dns-result-bestguesspass {
  background: rgba(20, 184, 166, 0.12);
  color: #0d9488;
  border-color: rgba(20, 184, 166, 0.25);
}

/* --- DNS Record Value Highlights (inside code blocks / records) --- */
.dns-mechanism {
  display: inline;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

.dns-mechanism-include {
  color: #60a5fa;
}

.dns-mechanism-ip {
  color: #a78bfa;
}

.dns-mechanism-all-pass {
  color: #22c55e;
}

.dns-mechanism-all-fail {
  color: #ef4444;
}

.dns-mechanism-all-softfail {
  color: #f59e0b;
}

.dns-mechanism-all-neutral {
  color: #3b82f6;
}

.dns-mechanism-redirect {
  color: #14b8a6;
}

body.light-mode .dns-mechanism-include { color: #2563eb; }
body.light-mode .dns-mechanism-ip { color: #7c3aed; }
body.light-mode .dns-mechanism-all-pass { color: #16a34a; }
body.light-mode .dns-mechanism-all-fail { color: #dc2626; }
body.light-mode .dns-mechanism-all-softfail { color: #d97706; }
body.light-mode .dns-mechanism-all-neutral { color: #2563eb; }
body.light-mode .dns-mechanism-redirect { color: #0d9488; }

/* --- DNS Record Cards (for structured lookup results) --- */
.dns-record-card {
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
  border-left: 3px solid var(--chat-accent);
  font-size: 13px;
  line-height: 1.6;
}

body.dark-mode .dns-record-card {
  background: rgba(38, 196, 255, 0.06);
  border-left-color: var(--chat-accent);
}

body.light-mode .dns-record-card {
  background: rgba(0, 84, 255, 0.05);
  border-left-color: var(--chat-accent-dark);
}

.dns-record-card code {
  font-size: 12px;
}

/* --- DMARC Policy Tags --- */
.dns-policy-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.85em;
}

.dns-policy-reject {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.dns-policy-quarantine {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.dns-policy-none {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

body.light-mode .dns-policy-reject {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

body.light-mode .dns-policy-quarantine {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

body.light-mode .dns-policy-none {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
  border-color: rgba(107, 114, 128, 0.25);
}

/* --- Domain Name Highlights --- */
.dns-domain {
  color: #93c5fd;
  font-weight: 500;
  border-bottom: 1px dotted rgba(147, 197, 253, 0.4);
}

body.light-mode .dns-domain {
  color: #2563eb;
  border-bottom-color: rgba(37, 99, 235, 0.3);
}

/* ========================================================================
   21) ANIMATIONS
   ======================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================================================
   22) HIDE reCAPTCHA BADGE
   ======================================================================== */
.grecaptcha-badge,
.hide-recaptcha {
  visibility: hidden !important;
  display: none !important;
}

/* ========================================================================
   23) RESPONSIVE — TABLET (768px)
   ======================================================================== */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .content {
    margin-top: 70px;
    margin-bottom: 24px;
  }

  .nav-links {
    display: none !important;
  }

  .chat-container {
    height: calc(100vh - 180px);
    border-radius: 20px;
  }

  .chat-header {
    padding: 16px 18px 14px;
  }

  .chat-messages {
    padding: 16px 18px;
    gap: 14px;
  }

  .message {
    max-width: 90%;
  }

  .quick-actions {
    padding: 10px 18px 4px;
  }

  .chat-input-area {
    padding: 14px 18px 16px;
  }

  /* Footer responsive */
  .footer-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 30px 10px 20px;
    max-width: 360px;
    margin: 0 auto;
  }

  .footer-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .footer-column {
    text-align: center;
  }

  .footer-column h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  .footer-column li {
    margin-bottom: 4px;
  }

  .footer-address {
    margin-top: 0;
  }

  .footer-address h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  .footer-address p {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .footer-address .social-icons {
    gap: 8px;
    margin-top: 8px;
  }

  .footer-address .social-icons img {
    width: 20px;
    height: 20px;
  }

  .footer-bottom {
    padding: 10px 8px;
    font-size: 12px;
  }

  .logo-title {
    font-size: 1.5rem;
  }
}

/* ========================================================================
   24) RESPONSIVE — SMALL MOBILE (480px)
   ======================================================================== */
@media (max-width: 480px) {
  .container {
    padding: 16px 10px;
  }

  .content {
    margin-top: 64px;
  }

  .chat-container {
    height: calc(100vh - 160px);
    border-radius: 16px;
  }

  .chat-header {
    padding: 14px 14px 12px;
    gap: 10px;
  }

  .chat-header-avatar {
    width: 34px;
    height: 34px;
  }

  .chat-header-info h2 {
    font-size: 16px;
  }

  .chat-messages {
    padding: 14px;
    gap: 12px;
  }

  .message {
    max-width: 92%;
  }

  .message.marvin .message-avatar {
    width: 28px;
    height: 28px;
  }

  .message.marvin .message-bubble,
  .message.user .message-bubble {
    padding: 12px 14px;
    font-size: 14px;
  }

  .quick-actions {
    padding: 8px 14px 4px;
    gap: 6px;
  }

  .quick-action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .chat-input-area {
    padding: 12px 14px 14px;
  }

  .chat-input {
    font-size: 14px;
  }

  .chat-send-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 10px;
  }

  .chat-send-btn svg {
    width: 16px;
    height: 16px;
  }

  .chat-input-marvin {
    width: 54px;
    height: 54px;
    min-width: 54px;
  }

  .chat-disclaimer {
    font-size: 10px;
    padding: 6px 14px 2px;
  }

  .site-footer {
    margin-top: 40px;
  }

  .footer-top {
    padding: 20px 10px 15px;
    gap: 16px;
  }

  .footer-logo {
    max-width: 100px;
  }

  .logo-title {
    font-size: 1.25rem;
  }

  .footer-column h4 {
    font-size: 0.85rem;
    margin-bottom: 4px;
  }

  .footer-column li {
    margin-bottom: 3px;
    font-size: 12px;
  }

  .footer-address h4 {
    font-size: 0.85rem;
  }

  .footer-address p {
    font-size: 12px;
  }

  .footer-address .social-icons {
    gap: 6px;
    margin-top: 6px;
  }

  .footer-address .social-icons img {
    width: 18px;
    height: 18px;
  }

  .footer-bottom {
    padding: 8px 6px;
    font-size: 11px;
  }

  .footer-bottom a {
    margin: 0 4px;
  }

  .flyout-menu {
    width: 100%;
    max-width: 100%;
    padding: 55px 16px 16px 16px;
    gap: 2px;
  }

  .flyout-menu a {
    padding: 11px 12px;
    font-size: 14px;
  }
}

/* ========================================================================
   25) MOBILE KEYBOARD OPTIMIZATION & RESPONSIVE CHAT
   ======================================================================== */

/* Use dynamic viewport height for better mobile keyboard handling */
@supports (height: 100dvh) {
  @media (max-width: 768px) {
    .chat-container {
      height: calc(100dvh - 180px);
    }
  }
  @media (max-width: 480px) {
    .chat-container {
      height: calc(100dvh - 140px);
    }
  }
}

/* Small viewport height fallback for when keyboard is open */
@supports (height: 100svh) {
  @media (max-width: 768px) {
    body.keyboard-open .chat-container {
      height: 100svh !important;
      max-height: 100svh !important;
    }
  }
}

/* Ensure chat container uses flexbox for proper layout */
.chat-container {
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-header,
.quick-actions,
.chat-input-area,
.chat-disclaimer {
  flex-shrink: 0;
}

/* ── Mobile-first chat input improvements ── */
@media (max-width: 768px) {
  /* Make input area sticky at bottom */
  .chat-input-area {
    position: sticky;
    bottom: 0;
    background: inherit;
    z-index: 10;
  }

  /* Ensure proper touch targets (44px minimum) */
  .chat-send-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .quick-action-btn {
    min-height: 40px;
    padding: 10px 16px;
  }

  .chat-header-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* Horizontal scrolling quick actions on mobile */
  .quick-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 8px;
    margin-bottom: -4px;
  }

  .quick-actions::-webkit-scrollbar {
    display: none;
  }

  .quick-action-btn {
    flex-shrink: 0;
  }

  /* Larger text input on mobile for easier typing */
  .chat-input {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    line-height: 1.4;
  }

  /* Reduce message bubble padding slightly */
  .message.marvin .message-bubble,
  .message.user .message-bubble {
    padding: 12px 14px;
  }
}

/* ── Keyboard open state (added via JS) ── */
@media (max-width: 768px) {
  body.keyboard-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* When keyboard is open, make chat container fixed and full screen */
  body.keyboard-open .container.content {
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    height: 100%;
  }

  body.keyboard-open .chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100% !important;
    max-height: none !important;
    border-radius: 0;
    z-index: 9999;
  }

  /* Use visual viewport height when available */
  body.keyboard-open .chat-container {
    height: calc(var(--viewport-height, 100vh)) !important;
  }

  body.keyboard-open .nav-menu,
  body.keyboard-open .site-footer,
  body.keyboard-open .creator {
    display: none !important;
  }

  body.keyboard-open .chat-messages {
    flex: 1;
    min-height: 0;
    padding-bottom: 8px;
  }

  body.keyboard-open .chat-input-area {
    flex-shrink: 0;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  }

  /* Compact header when keyboard is open */
  body.keyboard-open .chat-header {
    padding: 10px 14px 8px;
  }

  body.keyboard-open .chat-header-avatar {
    width: 30px;
    height: 30px;
  }

  body.keyboard-open .chat-header-info h2 {
    font-size: 14px;
  }

  body.keyboard-open .chat-header-info p {
    display: none;
  }

  /* Hide quick actions when keyboard is open to save space */
  body.keyboard-open .quick-actions {
    display: none !important;
  }

  /* Hide marvin image when keyboard is open */
  body.keyboard-open .chat-input-marvin {
    display: none;
  }

  /* Hide disclaimer when keyboard is open */
  body.keyboard-open .chat-disclaimer {
    display: none;
  }

  /* Ensure input wrapper takes full width */
  body.keyboard-open .chat-input-wrapper {
    flex: 1;
  }

  /* Smaller input padding when keyboard is open */
  body.keyboard-open .chat-input-wrapper {
    padding: 8px 12px;
  }

  /* Hide scroll-to-bottom button when keyboard is open (takes space) */
  body.keyboard-open .scroll-bottom-btn {
    bottom: 80px;
  }
}

/* ── iOS safe area padding ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .chat-input-area {
      padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
    .chat-disclaimer {
      padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    .chat-container {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* ── Very small screens (iPhone SE, etc.) ── */
@media (max-width: 375px) {
  .chat-header {
    padding: 12px 12px 10px;
    gap: 8px;
  }

  .chat-header-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-header-info h2 {
    font-size: 15px;
  }

  .chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .message {
    max-width: 94%;
  }

  .message.marvin .message-bubble,
  .message.user .message-bubble {
    padding: 10px 12px;
    font-size: 13px;
  }

  .quick-actions {
    padding: 6px 12px 4px;
    gap: 5px;
  }

  .quick-action-btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .chat-input-area {
    padding: 10px 12px 12px;
    gap: 8px;
  }

  .chat-input-marvin {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .chat-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
}

/* ── Landscape mode on mobile ── */
@media (max-width: 896px) and (max-height: 500px) and (orientation: landscape) {
  .chat-container {
    height: calc(100dvh - 60px);
    border-radius: 12px;
  }

  .content {
    margin-top: 50px;
  }

  .chat-header {
    padding: 8px 16px 6px;
  }

  .chat-header-avatar {
    width: 28px;
    height: 28px;
  }

  .chat-messages {
    padding: 10px 16px;
    gap: 8px;
  }

  .quick-actions {
    padding: 6px 16px 2px;
  }

  .chat-input-area {
    padding: 8px 16px 10px;
  }

  .chat-input-marvin {
    display: none;
  }

  .chat-disclaimer {
    display: none;
  }

  /* Hide nav in landscape mobile */
  .nav-links {
    display: none !important;
  }
}

/* ========================================================================
   Tool Suggestion Links — Styled callout boxes for DNSai tools
   ======================================================================== */

/* Horizontal rule styling for tool callout separators */
.message-bubble hr {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: 16px 0 12px;
  opacity: 0.5;
}

/* Tool callout box (text between --- markers becomes styled) */
.message-bubble hr + p strong,
.message-bubble hr + p:has(a[href*="dnsai.com"]) {
  display: block;
  margin-bottom: 8px;
}

/* Style links that go to DNSai tools with domain params */
.message-bubble a[href*="domain_list="],
.message-bubble a[href*="dnsai.com/advanced-lookup"],
.message-bubble a[href*="dnsai.com/report"],
.message-bubble a[href*="dnsai.com/profile"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin: 4px 0;
  background: linear-gradient(135deg, rgba(38, 196, 255, 0.15) 0%, rgba(0, 84, 255, 0.15) 100%);
  border: 1px solid rgba(38, 196, 255, 0.3);
  border-radius: 8px;
  color: var(--chat-accent);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.message-bubble a[href*="domain_list="]:hover,
.message-bubble a[href*="dnsai.com/advanced-lookup"]:hover,
.message-bubble a[href*="dnsai.com/report"]:hover,
.message-bubble a[href*="dnsai.com/profile"]:hover {
  background: linear-gradient(135deg, rgba(38, 196, 255, 0.25) 0%, rgba(0, 84, 255, 0.25) 100%);
  border-color: rgba(38, 196, 255, 0.5);
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(38, 196, 255, 0.2);
}

/* Light mode adjustments */
body.light-mode .message-bubble a[href*="domain_list="],
body.light-mode .message-bubble a[href*="dnsai.com/advanced-lookup"],
body.light-mode .message-bubble a[href*="dnsai.com/report"],
body.light-mode .message-bubble a[href*="dnsai.com/profile"] {
  background: linear-gradient(135deg, rgba(0, 84, 255, 0.1) 0%, rgba(4, 71, 211, 0.1) 100%);
  border-color: rgba(0, 84, 255, 0.3);
  color: var(--chat-accent-dark);
}

body.light-mode .message-bubble a[href*="domain_list="]:hover,
body.light-mode .message-bubble a[href*="dnsai.com/advanced-lookup"]:hover,
body.light-mode .message-bubble a[href*="dnsai.com/report"]:hover,
body.light-mode .message-bubble a[href*="dnsai.com/profile"]:hover {
  background: linear-gradient(135deg, rgba(0, 84, 255, 0.2) 0%, rgba(4, 71, 211, 0.2) 100%);
  border-color: rgba(0, 84, 255, 0.5);
  box-shadow: 0 4px 12px rgba(0, 84, 255, 0.15);
}

/* Tool links in lists should display as blocks */
.message-bubble li a[href*="domain_list="],
.message-bubble li a[href*="dnsai.com/advanced-lookup"],
.message-bubble li a[href*="dnsai.com/report"],
.message-bubble li a[href*="dnsai.com/profile"] {
  display: inline-flex;
}

/* Make sure the list items with tool links have proper spacing */
.message-bubble ul:has(a[href*="domain_list="]),
.message-bubble ul:has(a[href*="dnsai.com/advanced-lookup"]),
.message-bubble ul:has(a[href*="dnsai.com/report"]) {
  list-style: none;
  padding-left: 0;
  margin: 12px 0;
}

.message-bubble ul:has(a[href*="domain_list="]) li,
.message-bubble ul:has(a[href*="dnsai.com/advanced-lookup"]) li {
  margin-bottom: 8px;
}

/* ========================================================================
   DNS Utilities Dropdown Menu
   ------------------------------------------------------------------------
   Desktop nav-dropdown styling was intentionally removed 2026-07-10 so the
   top nav defers to the site-wide rules in main.min.css — identical to the
   dropdowns on /bulk-lookup/. The local copy here (centered 500px flex menu,
   chat-theme variables) collided with main.min.css and rendered the
   dropdowns broken. The mobile flyout styles below are unaffected.
   ======================================================================== */

/* Flyout menu section headers */
.flyout-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--chat-accent);
  padding: 12px 12px 6px;
  margin-top: 8px;
  border-top: 1px solid var(--clr-border);
}

.flyout-section-header:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 10px;
}

.flyout-menu a.active {
  color: var(--chat-accent);
  font-weight: 600;
}

body.light-mode .flyout-section-header {
  color: var(--chat-accent-dark);
}

/* Responsive: .nav-dropdown is hidden on mobile by main.min.css (max-width:1024px). */

/* ========================================================================
   MOBILE FIX — Comprehensive Mobile Optimization
   ======================================================================== */

/* ── Base mobile layout fixes ── */
@media (max-width: 768px) {
  /* Fix viewport issues */
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  /* Better container sizing */
  .container {
    padding: 12px;
    width: 100%;
    max-width: 100%;
  }

  .content {
    margin-top: 60px;
    margin-bottom: 16px;
  }

  /* Chat container - fill screen properly */
  .chat-container {
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
    min-height: 400px;
    border-radius: 16px;
    margin: 0;
  }

  /* Hide creator on mobile */
  .creator {
    display: none;
  }

  /* Hide footer on mobile to give more space to chat */
  .site-footer {
    display: none;
  }
}

/* ── Small mobile (480px and below) - major improvements ── */
@media (max-width: 480px) {
  .container {
    padding: 8px;
  }

  .content {
    margin-top: 56px;
    margin-bottom: 8px;
  }

  /* Chat container fills the screen */
  .chat-container {
    height: calc(100vh - 80px);
    height: calc(100dvh - 80px);
    min-height: 350px;
    border-radius: 12px;
  }

  /* Compact header */
  .chat-header {
    padding: 12px 12px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .chat-header-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-header-info {
    flex: 1;
    min-width: 0;
  }

  .chat-header-info h2 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-header-info p {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Header buttons - smaller and closer together */
  .chat-header-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 6px;
  }

  .chat-header-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Messages area - more space */
  .chat-messages {
    padding: 10px;
    gap: 10px;
  }

  /* Message bubbles - larger text, better readability */
  .message {
    max-width: 95%;
    gap: 6px;
  }

  .message.marvin .message-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }

  .message.marvin .message-bubble,
  .message.user .message-bubble {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
  }

  /* Welcome message list */
  .message-bubble ul {
    padding-left: 16px;
    margin: 6px 0;
  }

  .message-bubble li {
    margin-bottom: 6px;
    font-size: 13px;
  }

  /* Quick actions - horizontal scroll with larger buttons */
  .quick-actions {
    padding: 8px 10px;
    gap: 6px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .quick-actions::-webkit-scrollbar {
    display: none;
  }

  .quick-action-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    min-height: 36px;
  }

  /* Chat input area */
  .chat-input-area {
    padding: 10px;
    gap: 8px;
  }

  .chat-input-wrapper {
    flex: 1;
    padding: 8px 12px;
    min-height: 44px;
  }

  .chat-input {
    font-size: 16px !important; /* Prevents iOS zoom */
    line-height: 1.4;
    min-height: 24px;
  }

  .chat-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
  }

  .chat-send-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Hide marvin image on small screens */
  .chat-input-marvin {
    display: none;
  }

  /* Smaller disclaimer */
  .chat-disclaimer {
    padding: 6px 10px;
    font-size: 9px;
    line-height: 1.4;
  }

  .chat-legal-links {
    display: none; /* Hide legal links on very small screens */
  }

  /* Scroll to bottom button */
  .scroll-bottom-btn {
    bottom: 120px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  .scroll-bottom-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* ── Extra small screens (iPhone SE, small Android) ── */
@media (max-width: 375px) {
  .content {
    margin-top: 52px;
  }

  .chat-container {
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
    border-radius: 10px;
  }

  .chat-header {
    padding: 10px 10px 8px;
  }

  .chat-header-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-header-info h2 {
    font-size: 14px;
  }

  .chat-header-info p {
    font-size: 10px;
  }

  /* Only show first header button (new chat) */
  .chat-header-btn:nth-child(n+3) {
    display: none;
  }

  .chat-messages {
    padding: 8px;
    gap: 8px;
  }

  .message.marvin .message-avatar {
    width: 22px;
    height: 22px;
  }

  .message.marvin .message-bubble,
  .message.user .message-bubble {
    padding: 8px 10px;
    font-size: 13px;
  }

  .quick-actions {
    padding: 6px 8px;
  }

  .quick-action-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 32px;
  }

  .chat-input-area {
    padding: 8px;
  }

  .chat-input-wrapper {
    padding: 6px 10px;
    min-height: 40px;
  }

  .chat-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .chat-disclaimer {
    padding: 4px 8px;
    font-size: 8px;
  }
}

/* ── Touch-friendly improvements ── */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .quick-action-btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .chat-send-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .chat-header-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* Remove hover effects that don't work on touch */
  .quick-action-btn:hover {
    transform: none;
  }
}

/* ── Fix for notched phones (iPhone X and later) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 480px) {
    .chat-container {
      padding-bottom: env(safe-area-inset-bottom);
    }

    .chat-input-area {
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
  }
}
