* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #050705;
  color: #33ff66;
  font-family: "Courier New", "Consolas", monospace;
}

#crt {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  min-height: 100vh;
}

#ascii-header {
  color: #33ff66;
  font-size: 9px;
  line-height: 1.1;
  text-shadow: 0 0 6px rgba(51,255,102,0.6);
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 8px 0;
}

#statusbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid #1a5c2b;
  border-bottom: 1px solid #1a5c2b;
  padding: 6px 4px;
  font-size: 12px;
  margin-bottom: 16px;
  color: #7fffa0;
}

#conn-status { color: #ffb300; }
#conn-status.online { color: #33ff66; }

.prompt {
  color: #ffb300;
  font-weight: bold;
  margin-right: 6px;
}

.dim {
  color: #1e7a38;
}

#search-panel {
  margin-bottom: 10px;
}

#search-input {
  background: #050705;
  border: 1px solid #1a5c2b;
  color: #33ff66;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
  max-width: 640px;
  outline: none;
}

#search-input:focus {
  border-color: #33ff66;
  box-shadow: 0 0 8px rgba(51,255,102,0.4);
}

#search-results {
  margin-top: 6px;
  max-width: 640px;
}

.search-result {
  padding: 6px 10px;
  border: 1px solid #123a1c;
  cursor: pointer;
  font-size: 13px;
}
.search-result:hover {
  background: #0d2b16;
  border-color: #33ff66;
}

#active-location {
  margin: 14px 0;
  font-size: 13px;
}

.hidden { display: none !important; }

#model-toggle-panel {
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

#model-toggles, #view-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toggle-btn, .view-btn {
  background: #0a1f0f;
  border: 1px solid #1a5c2b;
  color: #7fffa0;
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}

.toggle-btn.active, .view-btn.active {
  background: #123a1c;
  color: #33ff66;
  border-color: #33ff66;
  box-shadow: 0 0 6px rgba(51,255,102,0.35);
}

.toggle-btn:hover, .view-btn:hover {
  border-color: #33ff66;
}

.section-title {
  color: #ffb300;
  font-size: 12px;
  margin: 18px 0 8px;
  letter-spacing: 0.5px;
}

#output { margin-top: 10px; }

table.term-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  margin-bottom: 22px;
}

table.term-table caption {
  text-align: left;
  color: #ffb300;
  font-size: 13px;
  padding-bottom: 6px;
}

table.term-table th, table.term-table td {
  border: 1px solid #123a1c;
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}

table.term-table thead tr:first-child th {
  text-align: center;
  background: #0d2b16;
  color: #33ccff;
  letter-spacing: 0.5px;
}

table.term-table th {
  color: #ffb300;
  background: #0a1f0f;
  position: sticky;
  top: 0;
}

table.term-table tr:nth-child(even) td {
  background: #071309;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid #1a5c2b;
  max-height: 480px;
  overflow-y: auto;
}

.temp-hot { color: #ff5533; }
.temp-warm { color: #ffb300; }
.temp-mild { color: #33ff66; }
.temp-cold { color: #33ccff; }
.temp-freezing { color: #cc99ff; }

.precip-flag { color: #33ccff; }
.storm-flag { color: #ff5533; font-weight: bold; }

#events-panel { margin-top: 20px; }

.event-card {
  border: 1px solid #1a5c2b;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.event-card .ev-title {
  color: #ff5533;
  font-weight: bold;
}

.event-card .ev-meta {
  color: #7fffa0;
}

.event-card a {
  color: #33ccff;
}

#footer {
  margin-top: 30px;
  border-top: 1px solid #1a5c2b;
  padding-top: 8px;
  font-size: 11px;
}

.loading-line::after {
  content: "_";
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-track { background: #050705; }
::-webkit-scrollbar-thumb { background: #1a5c2b; }

/* ---------- Floating AI chat bubble ---------- */

#chat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0a1f0f;
  border: 2px solid #33ff66;
  color: #33ff66;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(51,255,102,0.5);
  z-index: 1000;
}

#chat-bubble:hover {
  background: #123a1c;
  box-shadow: 0 0 20px rgba(51,255,102,0.8);
}

#chat-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 440px;
  max-height: calc(100vh - 140px);
  background: #050705;
  border: 1px solid #33ff66;
  box-shadow: 0 0 24px rgba(51,255,102,0.35);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  font-size: 12px;
}

#chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #1a5c2b;
  color: #ffb300;
}

#chat-close {
  background: none;
  border: none;
  color: #ff5533;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  white-space: pre-wrap;
  line-height: 1.4;
  padding: 6px 8px;
  border: 1px solid #123a1c;
}

.chat-msg-user {
  color: #ffb300;
  border-color: #3a2c0a;
  align-self: flex-end;
  background: #1a1305;
}

.chat-msg-bot {
  color: #33ff66;
  background: #071309;
}

.chat-msg-error {
  color: #ff5533;
  border-color: #4a1a12;
}

#chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #1a5c2b;
}

#chat-input-row .prompt {
  margin-right: 0;
}

#chat-input {
  flex: 1;
  background: #050705;
  border: 1px solid #1a5c2b;
  color: #33ff66;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  min-width: 0;
}

#chat-input:focus {
  border-color: #33ff66;
}

#chat-send {
  background: #0a1f0f;
  border: 1px solid #1a5c2b;
  color: #7fffa0;
  font-family: inherit;
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
}

#chat-send:hover {
  border-color: #33ff66;
  color: #33ff66;
}

#chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}
