:root {
  --font-main: "IBM Plex Mono", monospace;
  --radius: 12px;
  --radius-sm: 6px;
  --transition: 0.18s ease;
}

body.theme #topbar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-size: var(--font-size-base, 15px);
  transition:
    background var(--transition),
    color var(--transition);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
}

@media (min-width: 601px) {
  #messages {
    padding-left: max(24px, calc((100% - 720px) / 2));
    padding-right: max(24px, calc((100% - 720px) / 2));
  }
  #input-area {
    padding-left: max(14px, calc((100% - 720px) / 2));
    padding-right: max(14px, calc((100% - 720px) / 2));
  }
  #img-preview-wrap,
  #file-preview-wrap {
    padding-left: max(14px, calc((100% - 720px) / 2));
    padding-right: max(14px, calc((100% - 720px) / 2));
  }
  #options-panel .options-inner {
    max-width: 720px;
    margin: 0 auto;
  }
}

.win98-titlebar {
  display: none;
  background: linear-gradient(to right, #000080, #1084d0);
  color: white;
  padding: 3px 6px;
  font-size: 12px;
  font-family: "Share Tech Mono", monospace;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.win98-btn {
  background: var(--surface2);
  border: 1px solid;
  border-color: #fff #808080 #808080 #fff;
  color: #000;
  width: 16px;
  height: 14px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-family: "Share Tech Mono", monospace;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

#logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.5px;
  flex-shrink: 0;
  font-family: var(--font-main);
}

@media (max-width: 600px) {
  #logo {
    font-size: 12px;
  }
}

#led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
  box-shadow: 0 0 4px currentColor;
}

#led.ready {
  background: var(--led-ready);
  color: var(--led-ready);
}

#led.generating {
  background: var(--led-gen);
  color: var(--led-gen);
  animation: pulse 0.8s ease-in-out infinite;
}

#led.stopped {
  background: var(--led-stop);
  color: var(--led-stop);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.topbar-spacer {
  flex: 1;
}

.modal-logo {
  max-width: 180px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
}

.icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.icon-btn:active {
  transform: scale(0.95);
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar.open {
  transform: translateX(0);
}

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#sidebar-header span {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

#chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  border: 1px solid transparent;
  transition: all var(--transition);
  position: relative;
}

.chat-item:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.chat-item.active {
  background: var(--surface2);
  color: var(--accent);
  border-color: var(--accent);
}

.chat-item .chat-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item .del-chat {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  border-radius: 4px;
  transition: all var(--transition);
  font-family: var(--font-mono, monospace);
}

.chat-item:hover .del-chat {
  opacity: 1;
}

.chat-item .del-chat:hover {
  color: var(--led-stop);
}

#sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#new-chat-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: var(--user-text, #fff);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

#new-chat-btn:hover {
  opacity: 0.88;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  display: none;
}

#overlay.visible {
  display: block;
}

/* ── Public Chat Panel ──────────────────────────────────────────────────── */

#public-chat-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 101;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#public-chat-panel.open {
  transform: translateX(0);
}

#public-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#public-chat-header span {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

#public-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.public-chat-empty {
  color: var(--text3);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
  opacity: 0.6;
}

.public-chat-msg {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
  line-height: 1.45;
}

.public-chat-time {
  color: var(--text3);
  font-size: 10px;
  font-family: var(--font-mono, "IBM Plex Mono", monospace);
  opacity: 0.6;
  flex-shrink: 0;
  min-width: 36px;
}

.public-chat-nick {
  color: var(--accent, #1de9b6);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.public-chat-nick-admin {
  color: #ff4444;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  text-shadow: 0 0 8px rgba(255,68,68,0.4);
}

.public-chat-text {
  color: var(--text);
  word-break: break-word;
  flex: 1;
  min-width: 100%;
}

.public-chat-link {
  color: var(--accent, #1de9b6);
  text-decoration: underline;
  word-break: break-all;
}

.public-chat-link:hover {
  opacity: 0.8;
}

#public-chat-input-area {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding: 8px 0 0 0;
}

#public-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 0 8px;
}

#public-chat-input {
  flex: 1;
  background: var(--input-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
}

#public-chat-input:focus {
  border-color: var(--accent, #1de9b6);
}

#public-chat-send-btn {
  background: var(--accent, #1de9b6);
  color: #000;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

#public-chat-send-btn:hover {
  opacity: 0.85;
}

#public-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Public Chat Reactions ───────────────────────────────────────────── */

.public-chat-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin-top: 3px;
}

.chat-reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 5px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chat-reaction-badge:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  transform: scale(1.08);
}

.chat-reaction-badge.active {
  background: rgba(29, 233, 182, 0.12);
  border-color: var(--accent, #1de9b6);
  box-shadow: 0 0 4px rgba(29, 233, 182, 0.12);
}

.chat-reaction-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  margin-left: 1px;
}

.chat-reaction-badge.active .chat-reaction-count {
  color: var(--accent, #1de9b6);
}

.chat-reaction-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.12);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  font-size: 11px;
  color: var(--text3);
}

.public-chat-msg:hover .chat-reaction-add {
  opacity: 1;
}

.chat-reaction-add:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent, #1de9b6);
  color: var(--accent, #1de9b6);
}

/* Emoji picker popup */
.chat-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  max-width: 240px;
}

.chat-emoji-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.12s ease;
  user-select: none;
}

.chat-emoji-option:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.15);
}

/* Mobile responsive */
@media (max-width: 480px) {
  #public-chat-panel {
    width: 100%;
  }
}

#messages-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  min-height: 0;
}

#messages::-webkit-scrollbar {
  width: 5px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background: var(--scrollbar, var(--border));
  border-radius: 99px;
}

#welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  color: var(--text3);
  text-align: center;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#welcome h2 {
  color: var(--accent);
  font-size: 22px;
  font-family: var(--font-main);
}

#welcome p {
  font-size: 13px;
  max-width: 280px;
  line-height: 1.7;
}

/* Virtual scroll placeholders — preserve scrollbar geometry while only
   rendering messages that are near the viewport. */
.vs-spacer {
  flex-shrink: 0;
  width: 100%;
  pointer-events: none;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.ai {
  align-items: flex-start;
}

.msg-bubble {
  max-width: 85%;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-main);
  font-size: var(--font-size-base, 15px);
  line-height: 1.65;
  position: relative;
  word-break: break-word;
}

.msg-text li {
  margin-left: 15px;
}
.msg-row.user .msg-bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: var(--radius-sm);
}

.msg-row.ai .msg-bubble {
  background: var(--ai-bg);
  color: var(--ai-text);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-sm);
}

.msg-img {
  max-width: 200px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  display: block;
}

.msg-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  padding: 0 4px;
}

.msg-row:hover .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text3);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all var(--transition);
  font-family: var(--font-mono, monospace);
}

.msg-action-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.msg-text h1,
.msg-text h2,
.msg-text h3 {
  margin: 10px 0 6px;
  color: var(--accent);
  font-family: var(--font-main);
}

.msg-text p {
  margin-bottom: 8px;
}

.msg-text p:last-child {
  margin-bottom: 0;
}

.msg-text ul,
.msg-text ol {
  padding-left: 18px;
  margin-bottom: 8px;
}

.msg-text li {
  margin-bottom: 4px;
}

.msg-text code:not(pre code) {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
  font-family: var(--font-mono, "IBM Plex Mono", monospace);
  color: var(--accent2, var(--accent));
}

.msg-text pre {
  position: relative;
  margin: 10px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.msg-text pre code {
  display: block;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #1e2030 !important;
  color: #cdd6f4 !important;
  border-radius: 0;
}

.copy-code-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  padding: 3px 8px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  z-index: 2;
}

.copy-code-btn:hover {
  background: var(--accent);
  color: var(--user-text);
}

.msg-text blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text2);
  margin: 8px 0;
  font-style: italic;
}

.msg-text .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.msg-text .table-wrapper::-webkit-scrollbar {
  height: 4px;
}

.msg-text .table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.msg-text .table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px;
}

.msg-text table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  margin: 0;
  font-size: 13px;
}

.msg-text th,
.msg-text td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.msg-text th {
  background: var(--surface2);
}

.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--text3);
  border-radius: 50%;
  margin: 0 2px;
  animation: bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

.search-activity-block {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  font-size: 13px;
  color: var(--text2);
}
.search-activity-block summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary, #1de9b6);
  font-weight: 500;
  user-select: none;
  padding: 2px 0;
}
.search-activity-block summary::-webkit-details-marker {
  color: var(--primary, #1de9b6);
}
.search-activity-block summary .typing-dot {
  display: inline-block;
  background: var(--primary, #1de9b6);
  width: 4px;
  height: 4px;
  margin: 0 1px;
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.search-activity-block summary .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.search-activity-block summary .typing-dot:nth-child(3) { animation-delay: 0.4s; }

.search-activity-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 0 2px 0;
}

/* Each source row */
.search-activity-content .web-search-source {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--text2);
  font-size: 12px;
  font-family: var(--font-mono, monospace);
  transition: background 0.15s;
  animation: source-pop-in 0.25s ease-out;
}
.search-activity-content .web-search-source:hover {
  background: rgba(29, 233, 182, 0.08);
}

/* Source number */
.src-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(29, 233, 182, 0.15);
  color: var(--primary, #1de9b6);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Domain name */
.src-domain {
  color: var(--primary, #1de9b6);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* URL path */
.src-path {
  color: var(--text3);
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

@keyframes source-pop-in {
  0% { opacity: 0; transform: translateX(-8px); }
  100% { opacity: 1; transform: translateX(0); }
}

#options-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow-y: auto;
  max-height: 0;
  transition: max-height 0.3s ease;
  flex-shrink: 0;
}

#options-panel.open {
  max-height: 70vh;
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
}

.options-inner {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opt-label {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  min-width: 70px;
}

.opt-select,
.opt-input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition);
  min-width: 0;
}

.opt-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.opt-select:focus,
.opt-input:focus {
  border-color: var(--accent);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}

.theme-btn {
  padding: 6px 2px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: var(--font-main);
}

.theme-btn:hover,
.theme-btn.active {
  background: var(--accent);
  color: var(--user-text);
  border-color: var(--accent);
}

#img-preview-wrap {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#img-preview-wrap.visible {
  display: flex;
}

#img-preview {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

#img-name {
  font-size: 12px;
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#img-remove {
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 18px;
  font-family: var(--font-mono, monospace);
}

#file-preview-wrap {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#file-preview-wrap.visible {
  display: flex;
}

#file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text2);
  max-width: 220px;
}

.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-chip button {
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.file-chip button:hover {
  color: var(--text);
}

#scroll-bottom-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 10;
  transition:
    opacity 0.15s,
    transform 0.15s;
  opacity: 0;
  transform: translateY(8px);
}

#scroll-bottom-btn.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.file-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  max-width: 100%;
  overflow: hidden;
}

.file-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-row.user .file-badge {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--user-text);
}

#input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
  flex-shrink: 0;
}

#input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#user-input {
  flex: 1;
  min-height: 42px;
  max-height: 140px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-main);
  font-size: var(--font-size-base, 15px);
  padding: 10px 14px;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.5;
}

#user-input:focus {
  border-color: var(--accent);
}

#user-input::placeholder {
  color: var(--text3);
}

#send-btn {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: var(--user-text, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: all var(--transition);
  font-family: var(--font-mono, monospace);
}

#send-btn:hover {
  opacity: 0.85;
}

#send-btn:active {
  transform: scale(0.94);
}

#send-btn.stop {
  background: var(--led-stop);
}

.bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  display: none;
}

.bottom-row .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 16px;
  display: none;
}

#api-key-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

#api-key-modal.hidden {
  display: none;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-box h2 {
  font-size: 16px;
  color: var(--accent);
  font-family: var(--font-main);
}

.modal-box p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

.modal-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--user-text, #fff);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-family: var(--font-main);
  transition: all var(--transition);
}

.modal-btn:hover {
  opacity: 0.87;
}

#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--user-text, #fff);
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-main);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
}

.win98-status {
  display: none;
  background: var(--surface2);
  border-top: 1px solid #808080;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text2);
  font-family: "Share Tech Mono", monospace;
  flex-shrink: 0;
}

.logog {
  max-width: 150px;
}

.file-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.file-modal-overlay.open {
  display: flex;
}

.file-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
  color: var(--accent);
  font-family: var(--font-main);
  font-weight: 500;
}

.file-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  margin: 0;
  border-radius: 0;
}

.file-modal-content::-webkit-scrollbar {
  width: 5px;
}

.file-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.file-modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

.run-code-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: #2a6e2a;
  border: 1px solid #4aaa4a;
  border-radius: var(--radius-sm);
  color: #aaffaa;
  cursor: pointer;
  padding: 3px 10px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  z-index: 3;
}

.run-code-btn:hover {
  background: #3a8a3a;
  color: #ccffcc;
  border-color: #6acc6a;
}

.copy-code-btn.dl-btn {
  right: 6px;
}

.msg-text pre .copy-code-btn:not(.dl-btn) {
  right: 104px;
}

.msg-text pre:has(.run-code-btn) .dl-btn {
  right: 76px;
}

.msg-text pre:has(.run-code-btn) .copy-code-btn:not(.dl-btn) {
  right: 175px;
}

.msg-text pre {
  padding-bottom: 34px;
}

@media (max-width: 600px) {
  body.theme-cozy,
  body.theme-coffee,
  body.theme-lofi {
    --font-size-base: 15px;
  }
  body.theme-cozy .msg-bubble,
  body.theme-coffee .msg-bubble,
  body.theme-lofi .msg-bubble {
    font-size: 15px;
  }
  body.theme-cozy .opt-label,
  body.theme-coffee .opt-label,
  body.theme-lofi .opt-label {
    font-size: 12px;
  }
  body.theme-cozy .opt-select,
  body.theme-coffee .opt-select,
  body.theme-lofi .opt-select,
  body.theme-cozy .opt-input,
  body.theme-coffee .opt-input,
  body.theme-lofi .opt-input {
    font-size: 13px;
  }
  body.theme-cozy #user-input,
  body.theme-coffee #user-input,
  body.theme-lofi #user-input {
    font-size: 15px;
  }
  body.theme-cozy .theme-btn,
  body.theme-coffee .theme-btn,
  body.theme-lofi .theme-btn {
    font-size: 11px;
  }
  body.theme-cozy #welcome h2,
  body.theme-coffee #welcome h2,
  body.theme-lofi #welcome h2 {
    font-size: 20px;
  }
  body.theme-cozy #welcome p,
  body.theme-coffee #welcome p,
  body.theme-lofi #welcome p {
    font-size: 13px;
  }
  body.theme-cozy .modal-box h2,
  body.theme-coffee .modal-box h2,
  body.theme-lofi .modal-box h2 {
    font-size: 15px;
  }
  body.theme-cozy .modal-box p,
  body.theme-coffee .modal-box p,
  body.theme-lofi .modal-box p {
    font-size: 13px;
  }
  body.theme-cozy .modal-btn,
  body.theme-coffee .modal-btn,
  body.theme-lofi .modal-btn {
    font-size: 14px;
  }
  body.theme-terminal .msg-bubble {
    font-size: 13px;
  }
  body.theme-terminal #user-input {
    font-size: 13px;
  }
  .file-modal-box {
    max-height: 90vh;
  }
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border2);
  border-radius: 22px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.opt-file-btn {
  width: auto;
  padding: 0 10px;
  gap: 5px;
  font-size: 13px;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  max-width: 140px;
}

@media (max-width: 600px) {
  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }

  .theme-btn {
    font-size: 10px;
    padding: 6px 4px;
    word-break: break-word;
    hyphens: auto;
  }

  .options-inner {
    padding: 10px 10px;
    min-width: 0;
    overflow: hidden;
  }

  .opt-row {
    min-width: 0;
    overflow: hidden;
  }

  .opt-select,
  .opt-input {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .opt-file-btn {
    font-size: 12px;
    padding: 0 7px;
    max-width: 110px;
  }
  .opt-label {
    min-width: 50px;
  }
  .opt-row {
    flex-wrap: nowrap;
    overflow: hidden;
  }
}

.reasoning-content {
  /* Tło i podstawowy wygląd */
  background: linear-gradient(135deg, #050a0f 0%, #0a1520 100%);
  border: 1px solid #00f3ff;
  border-radius: 4px; /* ostrzejsze kąty dla stylu sci-fi */
  padding: 24px 24px 24px 45px;
  position: relative;
  overflow: hidden;
  color: #e0f7fa;
  font-family: "Courier New", Courier, monospace; /* Czcionka monospace */
  box-shadow:
    0 0 15px rgba(0, 243, 255, 0.15),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  line-height: 1.6;
}

/* Efekt skanowania laserowego wokół całej ramki */

.reasoning-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 4px;
  padding: 1px; /* Grubość lasera */
  background: linear-gradient(
    90deg,
    transparent,
    #00f3ff,
    #ff00ff,
    transparent
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: scan-line 4s linear infinite;
  pointer-events: none;
}

.reasoning-content::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

@keyframes scan-line {
  0% {
    transform: translateX(-100%) skewX(-15deg);
  }
  100% {
    transform: translateX(400%) skewX(-15deg);
  }
}

.reasoning-content h3 {
  color: #ff00ff; /* Magenta dla kontrastu */
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 3px;
  margin-bottom: 20px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
  text-shadow: 0 0 5px #ff00ff;
  animation: text-flicker 3s infinite;
}

@keyframes text-flicker {
  0%,
  19%,
  21%,
  23%,
  25%,
  54%,
  56%,
  100% {
    opacity: 0.9;
    text-shadow:
      0 0 5px #ff00ff,
      0 0 10px #ff00ff;
  }
  20%,
  24%,
  55% {
    opacity: 0.4;
    text-shadow: none;
  }
}

.reasoning-content p {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
  color: #cfd8dc;
}

.reasoning-content p::before {
  content: ">";
  position: absolute;
  left: -25px;
  color: #00f3ff;
  opacity: 0.7;
}

.response-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text3);
  opacity: 0.65;
  margin-top: 3px;
  margin-left: 4px;
  font-family: var(--font-mono, monospace);
  transition: opacity 0.2s;
}

.response-time-badge:hover {
  opacity: 1;
}

.response-time-badge i {
  font-size: 12px;
}

.delete-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
}

.delete-modal-overlay.open {
  display: flex;
}

.delete-modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px 22px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  animation: modal-pop 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
  from {
    transform: scale(0.88);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.delete-modal-icon {
  font-size: 32px;
  color: var(--accent);
  opacity: 0.85;
  line-height: 1;
}

.delete-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e0e0e0);
  margin-top: 2px;
}

.delete-modal-desc {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  line-height: 1.5;
}

.delete-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.delete-modal-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.1s;
}

.delete-modal-btn:hover {
  opacity: 0.85;
}

.delete-modal-btn:active {
  transform: scale(0.97);
}

.delete-modal-btn.cancel {
  background: var(--bg3, var(--bg2));
  color: var(--text2);
  border: 1px solid var(--border);
}

.delete-modal-btn.confirm {
  background: var(--accent);
  color: #fff;
}

.buyabout {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.buyabout a {
  text-decoration: none;
}

.sidebar-io-row {
  display: flex;
  gap: 6px;
  padding: 8px 12px 4px;
}

.sidebar-io-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg2, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  color: var(--text3, #888);
  font-family: inherit;
  font-size: 11px;
  padding: 7px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
  letter-spacing: 0.5px;
}

.sidebar-io-btn:hover {
  border-color: var(--accent, #7c5cbf);
  color: var(--text, #e0e0e0);
  background: var(--bg3, #222240);
}

.sidebar-io-btn i {
  font-size: 13px;
}

/* ─── Temperature slider ─────────────────────────────────────────────────────── */

#temperature-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary, #1de9b6);
  cursor: pointer;
  box-shadow: 0 0 4px var(--primary, #1de9b6);
}

#temperature-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary, #1de9b6);
  cursor: pointer;
  border: none;
}

#temperature-input::-webkit-inner-spin-button,
#temperature-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ─── Key input indicator ───────────────────────────────────────────────────── */

.opt-input.has-key {
  border-color: #1de9b6 !important;
  background: rgba(29, 233, 182, 0.04);
}

/* ─── Modal close button ────────────────────────────────────────────────────── */

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text2, #aaa);
  line-height: 1;
  padding: 2px 6px;
}

/* ─── Access info stat cards ─────────────────────────────────────────────────── */

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 10px 12px;
}

.stat-label {
  font-size: 10px;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
}

/* ─── Access ID input ────────────────────────────────────────────────────────── */

.access-id-input {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 1px;
}

/* ─── Provider key row ───────────────────────────────────────────────────────── */

.provider-key-row .icon-btn {
  width: 36px;
  height: 36px;
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Thinking toggle label ──────────────────────────────────────────────────── */

.thinking-toggle-label {
  font-size: 12px;
  color: var(--text3);
  margin-left: 4px;
}

/* ─── Achievement popup ─────────────────────────────────────────────────────── */

.achievement-popup {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  background: var(--surface, #1a1a2e);
  border: 2px solid var(--primary, #1de9b6);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(29,233,182,0.15);
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease;
  max-width: 360px;
  pointer-events: none;
}

.achievement-popup.show {
  transform: translateX(0);
  opacity: 1;
}

.achievement-popup-icon {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
  animation: ach-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Letter-based provider badges */
.achievement-popup-icon.letter-icon {
  font-size: 20px;
  font-weight: 800;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  font-family: var(--font);
}

@keyframes ach-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.achievement-popup-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.achievement-popup-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary, #1de9b6);
  opacity: 0.85;
  font-weight: 600;
}

.achievement-popup-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #e0e0e0);
  line-height: 1.2;
}

.achievement-popup-desc {
  font-size: 12px;
  color: var(--text3, #888);
  line-height: 1.3;
}

@media (max-width: 600px) {
  .achievement-popup {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
    padding: 12px 14px;
    gap: 10px;
    border-radius: 10px;
  }
  .achievement-popup-icon { font-size: 30px; }
  .achievement-popup-name { font-size: 13px; }
  .achievement-popup-desc { font-size: 10px; }
  .achievement-popup-title { font-size: 9px; letter-spacing: 1px; }
}

/* ─── Level-up popup ────────────────────────────────────────────────────────── */

.levelup-popup {
  position: fixed;
  bottom: 32px;
  right: 24px;
  z-index: 1999;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface, #1a1a2e);
  border: 2px solid #ffd700;
  border-radius: 12px;
  padding: 16px 22px;
  box-shadow: 0 0 24px rgba(255,215,0,0.35), 0 8px 32px rgba(0,0,0,0.5);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 240px;
  max-width: 360px;
  pointer-events: none;
}

.levelup-popup.show {
  transform: translateX(0);
}

.levelup-popup-icon {
  font-size: 44px;
  line-height: 1;
  animation: levelupPulse 0.6s ease-in-out infinite alternate;
}

@keyframes levelupPulse {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

.levelup-popup-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.levelup-popup-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffd700;
  font-weight: 600;
}

.levelup-popup-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #e0e0e0);
}

.levelup-popup-desc {
  font-size: 11px;
  color: var(--text3, #888);
}

@media (max-width: 600px) {
  .levelup-popup {
    bottom: 12px;
    right: 8px;
    left: 8px;
    min-width: auto;
    max-width: none;
    padding: 12px 14px;
    gap: 10px;
    border-radius: 10px;
  }
  .levelup-popup-icon { font-size: 30px; }
  .levelup-popup-name { font-size: 15px; }
  .levelup-popup-desc { font-size: 10px; }
  .levelup-popup-title { font-size: 9px; letter-spacing: 1px; }
}

/* ─── User stats modal (Account Info) mobile ──────────────────────────────────── */

@media (max-width: 600px) {
  #user-stats-modal .modal-box {
    max-width: 100%;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    gap: 8px;
    border-radius: 10px;
    box-sizing: border-box;
  }
  #user-stats-modal .modal-box h2 {
    font-size: 13px;
    margin-bottom: 0;
  }
  #user-stats-modal .modal-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
  #user-stats-modal #usm-stats-wrap {
    max-height: 100px;
    overflow-x: hidden;
  }
  #user-stats-modal #usm-stats {
    min-width: 0;
  }
  #user-stats-modal #usm-plans {
    min-width: 0;
  }
  #user-stats-modal #usm-email {
    font-size: 11px;
    padding: 4px 8px;
    margin-bottom: 6px;
  }
  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
    gap: 4px;
  }
  .achievement-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 6px;
  }
  .achievements-section-title {
    font-size: 9px;
    margin-bottom: 4px;
  }
}

/* ─── Achievement grid in Account Info ──────────────────────────────────────── */

.achievements-section {
  margin-bottom: 14px;
}

.achievements-section-title {
  font-size: 10px;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 6px;
}

.achievement-icon {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
}

.achievement-icon:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--primary, #1de9b6);
  transform: scale(1.12);
  box-shadow: 0 0 14px rgba(29,233,182,0.2);
  z-index: 2;
}

.achievement-icon.earned {
  border-color: var(--primary, #1de9b6);
  background: rgba(29,233,182,0.08);
}

.achievement-icon.locked {
  filter: grayscale(0.6);
  opacity: 0.55;
}

.achievement-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--primary, #1de9b6);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 10px rgba(29,233,182,0.1);
}

.achievement-tooltip .ach-tip-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #e0e0e0);
}

.achievement-tooltip .ach-tip-desc {
  font-size: 10px;
  color: var(--text2, #ccc);
  margin-top: 2px;
  opacity: 0.85;
}

.achievement-tooltip .ach-tip-desc:last-child {
  font-weight: 600;
  margin-top: 3px;
  opacity: 1;
}

.achievement-icon:hover .achievement-tooltip {
  opacity: 1;
}

/* Arrow for tooltip */
.achievement-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--primary, #1de9b6);
}

.achievements-none {
  font-size: 11px;
  color: var(--text3, #888);
  opacity: 0.5;
  font-style: italic;
}

/* ─── Level / XP bar in Account Info ───────────────────────────────────────────── */

.xp-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary,#1de9b6), #00e5ff);
  border-radius: 6px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(29,233,182,0.35);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ACCOUNT INFO — Shared Dark Theme (independent of app theme)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Overlay ─── */
.aci-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1900;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.aci-overlay.open {
  display: flex;
}

/* ─── Modal box ─── */
.aci-modal {
  --aci-bg:        #0d1117;
  --aci-surface:   #161b22;
  --aci-surface2:  #1c2333;
  --aci-border:    #30363d;
  --aci-border2:   #484f58;
  --aci-text:      #e6edf3;
  --aci-text2:     #8b949e;
  --aci-text3:     #6e7681;
  --aci-accent:    #1de9b6;
  --aci-accent2:   #00e5ff;
  --aci-red:       #f85149;
  --aci-red-hover: #ff6b63;
  --aci-green:     #3fb950;
  --aci-yellow:    #d29922;

  background: var(--aci-bg);
  border: 1px solid var(--aci-border);
  border-radius: 14px;
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow:
    0 0 0 1px rgba(48,54,61,0.4),
    0 8px 32px rgba(0,0,0,0.55),
    0 0 60px rgba(29,233,182,0.04);
  color: var(--aci-text);
  font-family: "Montserrat", "IBM Plex Mono", sans-serif;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--aci-border) transparent;
}

.aci-modal::-webkit-scrollbar { width: 5px; }
.aci-modal::-webkit-scrollbar-track { background: transparent; }
.aci-modal::-webkit-scrollbar-thumb {
  background: var(--aci-border);
  border-radius: 99px;
}

/* ─── Close button ─── */
.aci-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--aci-text2);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  z-index: 2;
}
.aci-close-btn:hover {
  background: var(--aci-surface2);
  border-color: var(--aci-border);
  color: var(--aci-text);
}

/* ─── Identity frame (Nick + Email) ─── */
.aci-identity {
  border-radius: 10px;
  padding: 8px 14px;
  text-align: center;
  position: relative;
}

.aci-nick {
  font-size: 17px;
  font-weight: 700;
  color: var(--aci-accent);
  letter-spacing: 0.5px;
  font-family: "Montserrat", "IBM Plex Mono", sans-serif;
  word-break: break-word;
  line-height: 1.3;
}

.aci-email {
  font-size: 11px;
  color: var(--aci-text2);
  margin-top: 4px;
  word-break: break-all;
  font-family: "Montserrat", sans-serif;
  opacity: 0.75;
}

/* ─── Profile row: avatar far left + badge/requests far right ─── */
.aci-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0;
  padding: 10px 10px;
  background: var(--aci-surface);
  border: 1px solid var(--aci-border);
  border-radius: 10px;
}

.aci-badge-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ─── Avatar ─── */
.aci-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--aci-surface);
  border: 2px solid var(--aci-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: var(--aci-text2);
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.aci-avatar:hover {
  border-color: var(--aci-accent);
  box-shadow: 0 0 12px rgba(29,233,182,0.2);
}

.aci-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aci-avatar-delete {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--aci-red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.15s;
  z-index: 2;
}
.aci-avatar-delete.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  font-size: 8px;
  top: -4px;
  right: -4px;
  background: transparent;
  color: var(--text3);
  border-radius: 50%;
}

/* Desktop: red button visible only on hover */
@media (hover: hover) and (pointer: fine) {
  .aci-avatar-delete.visible {
    opacity: 0;
    width: 20px;
    height: 20px;
    font-size: 10px;
    top: -2px;
    right: -2px;
    background: var(--aci-red);
    color: #fff;
  }
  .aci-avatar-wrap:hover .aci-avatar-delete.visible {
    opacity: 1;
  }
}
.aci-avatar-delete:hover {
  transform: scale(1.2);
}

.aci-avatar-wrap {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* ─── Badge ─── */
.aci-badge {
  text-align: center;
}

.aci-badge img {
  height: 64px;
  image-rendering: pixelated;
  border-radius: 8px;
  border: 2px solid var(--aci-accent);
  box-shadow: 0 0 16px rgba(29,233,182,0.18);
  cursor: pointer;
}

.aci-badge-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--aci-accent);
  margin-top: 4px;
  letter-spacing: 1px;
}

.aci-badge-sub {
  font-size: 10px;
  color: var(--aci-text2);
  opacity: 0.6;
}

/* ─── Requests display (under badge in right column) ─── */
.aci-requests {
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.aci-requests-label {
  font-size: 10px;
  color: var(--aci-text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.aci-requests-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--aci-accent);
  font-family: "IBM Plex Mono", monospace;
}

.aci-badge-next {
  display: none;
  font-size: 10px;
  color: var(--aci-yellow);
  margin-top: 3px;
  animation: fadeIn 0.2s;
}

/* ─── Level row ─── */
.aci-level-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.aci-level-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--aci-accent);
  letter-spacing: 0.5px;
}

.aci-xp-text {
  font-size: 10px;
  color: var(--aci-text3);
  font-family: "IBM Plex Mono", monospace;
}

/* ─── XP bar ─── */
.aci-xp-track {
  width: 100%;
  height: 8px;
  background: var(--aci-surface);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--aci-border);
}

.aci-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--aci-accent), var(--aci-accent2));
  border-radius: 6px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(29,233,182,0.3);
}

.aci-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.aci-total-chars {
  font-size: 10px;
  color: var(--aci-text3);
  font-family: "IBM Plex Mono", monospace;
  opacity: 0.6;
}

.aci-ranking-link {
  font-size: 10px;
  color: var(--aci-yellow);
  text-decoration: none;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
  transition: color 0.2s;
  white-space: nowrap;
}
.aci-ranking-link:hover {
  color: #f0c000;
  text-shadow: 0 0 6px rgba(240,192,0,0.3);
}

/* ─── Collapsible sections ─── */
.aci-section {
  background: var(--aci-surface);
  border: 1px solid var(--aci-border);
  border-radius: 10px;
  overflow: hidden;
}

.aci-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--aci-text);
  transition: background 0.15s;
}

.aci-section-header:hover {
  background: var(--aci-surface2);
}

.aci-section-header-static {
  cursor: default;
}

.aci-section-header-static:hover {
  background: transparent;
}

.aci-section-count {
  font-size: 10px;
  color: var(--aci-text3);
  font-weight: 400;
  margin-left: 4px;
}

.aci-chevron {
  font-size: 14px;
  color: var(--aci-text3);
  transition: transform 0.25s ease;
}

.aci-section.open .aci-chevron {
  transform: rotate(180deg);
}

.aci-section-body {
  padding: 0 14px 12px;
  display: block;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--aci-border) transparent;
}
.aci-section-body::-webkit-scrollbar { width: 4px; }
.aci-section-body::-webkit-scrollbar-track { background: transparent; }
.aci-section-body::-webkit-scrollbar-thumb {
  background: var(--aci-border);
  border-radius: 99px;
}

/* Static section (Plans) — always open, but scrollable if too many */
.aci-section-static .aci-section-body {
  max-height: 180px;
  overflow-y: auto;
}

.aci-section:not(.open) .aci-section-body {
  display: none;
}

/* ─── Achievements grid ─── */
.aci-achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.aci-achievements-grid::-webkit-scrollbar { width: 4px; }
.aci-achievements-grid::-webkit-scrollbar-track { background: transparent; }
.aci-achievements-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.aci-achievements-none {
  font-size: 11px;
  color: var(--aci-text3);
  opacity: 0.55;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

/* ─── Plans list ─── */
.aci-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(48,54,61,0.4);
  gap: 8px;
}

.aci-plan-row:last-child {
  border-bottom: none;
}

.aci-plan-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--aci-text);
}

.aci-plan-detail {
  font-size: 10px;
  color: var(--aci-text3);
  opacity: 0.7;
}

.aci-plan-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: "Montserrat", sans-serif;
}

.aci-plan-badge.unlimited {
  background: var(--aci-green);
  color: #000;
}

.aci-plan-badge.expired {
  background: var(--aci-red);
  color: #fff;
}

.aci-plan-badge.remaining {
  background: var(--aci-accent);
  color: #000;
}

.aci-plan-badge.free {
  background: #f0c000;
  color: #000;
}

/* ─── Custom colored badges ─── */
.aci-plan-badge-custom {
  padding: 3px 10px;
}

/* Special: Neon glow pulse */
.aci-plan-badge-custom[style*="#00f0ff"] {
  animation: aciNeonPulse 2s ease-in-out infinite;
}

@keyframes aciNeonPulse {
  0%, 100% { box-shadow: 0 0 6px #00f0ff; }
  50% { box-shadow: 0 0 16px #00f0ff, 0 0 24px rgba(0,240,255,0.4); }
}

/* Special: Glitch effect */
.aci-plan-badge-custom[style*="#ff00aa"] {
  animation: aciGlitch 1.5s steps(2) infinite;
  padding: 1px 6px;
  font-size: 9px;
}

@keyframes aciGlitch {
  0% { transform: skewX(0deg); }
  25% { transform: skewX(3deg) translateX(1px); }
  50% { transform: skewX(-2deg) translateX(-1px); }
  75% { transform: skewX(1deg); }
  100% { transform: skewX(0deg); }
}

/* Glitch effect for plan name */
.aci-plan-name-glitch {
  animation: aciNameGlitch 0.3s steps(2) infinite;
  text-shadow: 0 0 8px #fff, 0 0 16px #ff00aa, 2px 0 #ff00aa, -1px -1px #0ff;
}

@keyframes aciNameGlitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0); }
}

/* Special: Christmas — animated red/green border */
.aci-plan-badge-custom[style*="#ff0000"] {
  animation: aciXmas 1s linear infinite;
}

@keyframes aciXmas {
  0% { border-color: #ff0000; }
  33% { border-color: #00cc00; }
  66% { border-color: #ff0000; }
  100% { border-color: #00cc00; }
}

/* Special: Pulse Purple — pulsing glow (has border, unlike regular purple) */
.aci-plan-badge-custom[style*="solid #bb86fc"] {
  animation: aciPulsePurple 1.5s ease-in-out infinite;
}

@keyframes aciPulsePurple {
  0%, 100% { box-shadow: 0 0 6px #bb86fc; }
  50% { box-shadow: 0 0 20px #bb86fc, 0 0 32px rgba(187,134,252,0.6); }
}

/* Special: Black White Neon — running border glow */
.aci-plan-badge-custom[style*="solid #fff"] {
  animation: aciBWneon 1.2s linear infinite;
}

@keyframes aciBWneon {
  0%   { box-shadow: inset 2px 0 0 #fff, 0 0 8px #fff; }
  25%  { box-shadow: inset 0 -2px 0 #fff, 0 0 12px #fff; }
  50%  { box-shadow: inset -2px 0 0 #fff, 0 0 8px #fff; }
  75%  { box-shadow: inset 0 2px 0 #fff, 0 0 12px #fff; }
  100% { box-shadow: inset 2px 0 0 #fff, 0 0 8px #fff; }
}

/* ─── Request by Model ─── */
.aci-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(48,54,61,0.35);
  min-width: 0;
}

.aci-model-row:last-child {
  border-bottom: none;
}

.aci-model-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--aci-text);
  opacity: 0.85;
}

.aci-model-bar-wrap {
  flex: 0 0 50px;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.aci-model-bar {
  height: 100%;
  background: var(--aci-accent);
  border-radius: 3px;
  transition: width 0.4s;
}

.aci-model-count {
  flex: 0 0 auto;
  min-width: 28px;
  text-align: right;
  font-size: 11px;
  color: var(--aci-text2);
  font-family: "IBM Plex Mono", monospace;
}

/* ─── Expand button for models ─── */
.aci-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 6px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--aci-border);
  border-radius: 6px;
  color: var(--aci-text2);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: all 0.2s;
}

.aci-expand-btn:hover {
  background: var(--aci-surface2);
  color: var(--aci-text);
  border-color: var(--aci-border2);
}

.aci-expand-btn .ti-chevron-down {
  transition: transform 0.25s;
}

.aci-expand-btn.expanded .ti-chevron-down {
  transform: rotate(180deg);
}

/* ─── Buttons ─── */
.aci-buttons {
  display: flex;
  gap: 8px;
}

.aci-btn {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: "Montserrat", "IBM Plex Mono", sans-serif;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  flex: 1;
}

.aci-btn:active {
  transform: scale(0.97);
}

.aci-btn-primary {
  background: var(--aci-accent);
  color: #000;
}

.aci-btn-primary:hover {
  background: #3deec4;
  box-shadow: 0 0 14px rgba(29,233,182,0.25);
}

.aci-btn-outline {
  background: transparent;
  border: 1px solid var(--aci-accent);
  color: var(--aci-accent);
}

.aci-btn-outline:hover {
  background: rgba(29,233,182,0.08);
}

.aci-btn-danger {
  background: var(--aci-red);
  color: #fff;
}

.aci-btn-danger:hover {
  background: var(--aci-red-hover);
}


/* ─── Change Password form ─── */
.aci-cp-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--aci-border);
}

.aci-input {
  width: 100%;
  background: var(--aci-surface);
  border: 1px solid var(--aci-border);
  border-radius: 7px;
  color: var(--aci-text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s;
}

.aci-input:focus {
  border-color: var(--aci-accent);
}

.aci-cp-error {
  color: var(--aci-red);
  font-size: 11px;
  min-height: 16px;
}

.aci-cp-buttons {
  display: flex;
  gap: 8px;
}

/* ─── Models total ─── */
.aci-models-total {
  font-size: 10px;
  color: var(--aci-text3);
  text-align: right;
  margin-top: 6px;
  opacity: 0.7;
}

/* ─── No plans ─── */
.aci-no-data {
  font-size: 11px;
  color: var(--aci-text3);
  opacity: 0.5;
  text-align: center;
  padding: 6px 0;
}

/* ─── Hide old hover tooltips everywhere (replaced by centered tap) ─── */
.achievement-icon .achievement-tooltip { display: none !important; }

/* ─── Centered achievement tooltip (on click) ─── */
.aci-ach-center-tip {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  background: #161b22;
  border: 2px solid #1de9b6;
  border-radius: 14px;
  padding: 20px 24px;
  text-align: center;
  min-width: 200px;
  max-width: 280px;
  box-shadow: 0 0 30px rgba(29,233,182,0.25), 0 12px 48px rgba(0,0,0,0.6);
  animation: aciTipIn 0.2s ease-out;
  cursor: pointer;
}

@keyframes aciTipIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.aci-ach-center-tip-emoji {
  font-size: 42px;
  margin-bottom: 6px;
}

.aci-ach-center-tip-name {
  font-size: 15px;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 4px;
  font-family: "Montserrat", "IBM Plex Mono", sans-serif;
}

.aci-ach-center-tip-desc {
  font-size: 11px;
  color: #8b949e;
  line-height: 1.4;
}

.aci-ach-center-tip-status {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ACCOUNT INFO — Mobile
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  .aci-modal {
    max-width: 100%;
    width: 94%;
    max-height: 90vh;
    padding: 18px 14px 16px;
    gap: 10px;
    border-radius: 12px;
  }

  .aci-nick { font-size: 15px; }
  .aci-email { font-size: 10px; }
  .aci-avatar { width: 100px; height: 100px; font-size: 40px; }
  .aci-badge img { height: 54px; }
  .aci-section-header { font-size: 11px; padding: 8px 10px; }
  .aci-section-body { padding: 0 10px 10px; }
  .aci-btn { padding: 8px 10px; font-size: 10px; }
  .aci-identity { padding: 6px 10px; }
  .aci-achievements-grid { grid-template-columns: repeat(auto-fill, minmax(24px, 1fr)); gap: 8px; }
  .aci-achievements-grid .achievement-icon { width: 28px; height: 28px; font-size: 14px; border-radius: 6px; }
  .aci-requests { margin-top: 2px; gap: 4px; }
  .aci-requests-label { font-size: 9px; }
  .aci-requests-value { font-size: 9px; }

  /* Tighter scroll on mobile */
  .aci-section:not(.aci-section-static.open) .aci-section-body {
    max-height: 120px;
  }
  .aci-section.open .aci-section-body {
    max-height: 160px;
  }
  .aci-section-static .aci-section-body {
    max-height: 140px;
  }
}

@media (max-width: 380px) {
  .aci-modal {
    width: 98%;
    padding: 14px 10px 12px;
    gap: 8px;
    border-radius: 10px;
  }
  .aci-nick { font-size: 14px; }
  .aci-avatar { width: 100px; height: 100px; font-size: 36px; }
  .aci-badge img { height: 46px; }
  .aci-badge-name { font-size: 11px; }
  .aci-badge-sub { font-size: 9px; }
  .aci-requests-label { font-size: 8px; }
  .aci-requests-value { font-size: 8px; }

  /* Keep buttons in one line */
  .aci-buttons { gap: 6px; }
  .aci-btn { padding: 7px 8px; font-size: 9px; }
}

/* ── Slash Command Popup ─────────────────────────────────────────────── */

.slash-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #1e2233;               /* fixed dark bg — readable in all themes */
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.slash-popup.visible { display: block; }

.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13px;
  color: #d4dce8;                    /* light text — always readable on dark bg */
  transition: background 0.1s;
}
.slash-item:hover,
.slash-item.active {
  background: #4a8cff;               /* fixed blue — always contrasts with white text */
  color: #fff;
}
.slash-item:hover .slash-desc,
.slash-item.active .slash-desc {
  color: rgba(255,255,255,0.8);
}
.slash-item .slash-cmd {
  font-weight: 700;
  white-space: nowrap;
  min-width: 80px;
}
.slash-item .slash-desc {
  opacity: 0.7;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Help Modal ──────────────────────────────────────────────────────── */

.help-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}
.help-modal-overlay.visible { display: flex; }

.help-modal {
  background: var(--surface, #1a1e2a);
  border: 1px solid var(--border, #2a3040);
  border-radius: var(--radius, 12px);
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  font-family: var(--font-main);
  color: var(--text, #c8d6e9);
}
.help-modal h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--accent, #3b82f6);
}
.help-modal .help-content {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 16px;
}
.help-modal .help-content code {
  background: var(--bg-input, rgba(255,255,255,0.06));
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}
.help-modal .help-close {
  display: inline-block;
  padding: 8px 20px;
  background: #4a8cff;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
}
.help-modal .help-close:hover {
  filter: brightness(1.1);
}
