.chat-launcher { position: fixed; right: 22px; bottom: 20px; z-index: 20; max-width: calc(100% - 44px); padding: 14px 20px; border: 1px solid #edc495; border-radius: 28px; background: #e7bc85; color: #211409; box-shadow: 0 4px 24px #0008; font: 600 .95rem/1.4 var(--body); cursor: pointer; }
.competition-chat { position: fixed; inset: auto 20px 20px auto; width: 440px; max-width: calc(100% - 40px); height: 670px; max-height: calc(100dvh - 40px); margin: 0; padding: 0; border: 1px solid #8e6a42; border-radius: 12px; background: #100d0a; color: #fff8ea; box-shadow: 0 15px 80px #000b; overflow: hidden; }
.competition-chat[open] { display: flex; flex-direction: column; }
.competition-chat::backdrop { background: #0008; }
body:has(.competition-chat[open]) { overflow: hidden; }
.chat-header { display: flex; flex: none; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #48362a; }
.chat-header h2 { font-size: 1.65rem; letter-spacing: -.03em; }
.chat-header p { margin-top: 7px; color: #e3d3c1; font-size: .875rem; line-height: 1.4; }
.competition-chat .chat-header .chat-close { flex: none; margin-left: auto; min-height: 30px; padding: 4px 8px; font-size: .8125rem; line-height: 1.3; }
.competition-chat button { min-height: 44px; border: 1px solid #8e6a42; border-radius: 5px; background: #24190f; color: #fff8ea; padding: 8px 12px; font: 500 .875rem/1.4 var(--body); cursor: pointer; }
.competition-chat button:disabled { opacity: .55; cursor: wait; }
.chat-log { position: relative; flex: 1; min-height: 90px; overflow-y: auto; overscroll-behavior: contain; padding: 18px; }
.chat-message { margin-bottom: 16px; padding: 14px; border: 1px solid #48362a; border-radius: 8px; font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.chat-message p { white-space: pre-wrap; }
.chat-message > * + * { margin-top: 14px; }
.chat-message h3 { font: 700 1rem/1.4 var(--body); color: #f3d5ad; }
.chat-message ul { margin-bottom: 0; padding-left: 20px; }
.chat-message li + li { margin-top: 8px; }
.chat-message .chat-sources { padding-top: 12px; border-top: 1px solid #48362a; }
.chat-thinking { display: flex; align-items: start; gap: 12px; border-color: #bd925e; background: #2c2013; }
.chat-thinking strong { display: block; color: #f3d5ad; font-size: 1rem; }
.chat-thinking > div { margin-top: 0; }
.chat-thinking p { margin-top: 8px; color: #e3d3c1; font-size: .875rem; }
.chat-thinking-dots { display: flex; flex: none; gap: 4px; margin-top: 8px; }
.chat-thinking-dots i { width: 7px; height: 7px; border-radius: 50%; background: #f3d5ad; animation: chat-pulse 1.2s ease-in-out infinite; }
.chat-thinking-dots i:nth-child(2) { animation-delay: .16s; }
.chat-thinking-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes chat-pulse { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .chat-thinking-dots i { animation: none; opacity: 1; } }
.chat-user { margin-left: 28px; background: #382818; border-color: #705231; }
.chat-assistant { margin-right: 12px; background: #19130e; }
.chat-sources { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: .875rem; }
.chat-sources a { color: #f3d5ad; }
.chat-suggestions { display: flex; flex: none; flex-wrap: nowrap; gap: 6px; padding: 0 10px 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.competition-chat .chat-suggestions button { flex: 0 0 auto; min-height: 34px; padding: 5px 7px; background: transparent; font-size: .8125rem; line-height: 1.35; white-space: nowrap; }
.chat-form { padding: 8px 18px; border-top: 1px solid #48362a; }
.chat-input-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chat-form label { display: block; font-size: .875rem; }
.chat-input-row { display: flex; align-items: stretch; gap: 8px; }
.chat-input-row textarea { flex: 1; min-width: 0; resize: none; border: 1px solid #8e6a42; border-radius: 5px; background: #080503; color: #fff8ea; padding: 10px; font: 16px/1.4 var(--body); }
.competition-chat .chat-input-row button { background: #e7bc85; color: #211409; }
.chat-status { font-size: .875rem; color: #e3d3c1; margin-top: 7px; }
.chat-status:empty { display: none; }
.chat-footer { flex: none; padding: 0 18px 8px; font-size: .75rem; line-height: 1.4; color: #e3d3c1; }
.competition-chat .chat-reset { min-height: 28px; border: 0; padding: 2px 0; background: transparent; text-decoration: underline; display: block; }
@media (max-width: 600px) {
  .chat-launcher { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .competition-chat { inset: 8px; width: auto; height: calc(100dvh - 16px); max-width: none; max-height: none; }
  .chat-header { padding: 10px 14px; }
  .chat-log { padding: 14px; }
  .chat-suggestions { gap: 6px; padding-inline: 14px; }
}
@media print { .chat-launcher, .competition-chat { display: none !important; } }
