/* ai'd 75-80% ngl*/

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: radial-gradient(circle at top, #1a1f2e 0%, #0a0d14 45%, #070a10 100%);
  color: #d2f8d2;
}

body[data-theme="matrix"] {
  background: radial-gradient(circle at top, #04230f 0%, #02170b 45%, #010a05 100%);
  color: #98ffb6;
}

body[data-theme="matrix"] .terminal-shell,
body[data-theme="matrix"] .terminal-input,
body[data-theme="matrix"] .auto-panel,
body[data-theme="matrix"] .settings-panel,
body[data-theme="matrix"] .bangs-popup-card,
body[data-theme="matrix"] #auto-panel-list li,
body[data-theme="matrix"] .bangs-list li,
body[data-theme="matrix"] .settings-row select,
body[data-theme="matrix"] .settings-row input[type="text"],
body[data-theme="matrix"] #clear-suggestions,
body[data-theme="matrix"] .remove-suggestion,
body[data-theme="matrix"] .remove-bang,
body[data-theme="matrix"] .settings-action button,
body[data-theme="matrix"] .settings-btn {
  border-color: #1b8f4d;
  background: #041b10;
  color: #9cffba;
}

body[data-theme="dracula"] {
  background: radial-gradient(circle at top, #2b2142 0%, #191426 45%, #110d1a 100%);
  color: #f8f8f2;
}

body[data-theme="dracula"] .terminal-topbar { background: #221a33; border-bottom-color: #5e4a8f; }
body[data-theme="dracula"] .terminal-shell,
body[data-theme="dracula"] .terminal-input,
body[data-theme="dracula"] .auto-panel,
body[data-theme="dracula"] .settings-panel,
body[data-theme="dracula"] .bangs-popup-card,
body[data-theme="dracula"] #auto-panel-list li,
body[data-theme="dracula"] .bangs-list li,
body[data-theme="dracula"] .settings-row select,
body[data-theme="dracula"] .settings-row input[type="text"],
body[data-theme="dracula"] #clear-suggestions,
body[data-theme="dracula"] .remove-suggestion,
body[data-theme="dracula"] .remove-bang,
body[data-theme="dracula"] .settings-action button,
body[data-theme="dracula"] .settings-btn {
  border-color: #6f56a8;
  background: #1c1630;
  color: #f8f8f2;
}

body[data-theme="amber"] {
  background: radial-gradient(circle at top, #2b1b02 0%, #1b1203 45%, #120b02 100%);
  color: #ffd57a;
}

body[data-theme="amber"] .terminal-topbar { background: #2a1c08; border-bottom-color: #8b5e1a; }
body[data-theme="amber"] .terminal-shell,
body[data-theme="amber"] .terminal-input,
body[data-theme="amber"] .auto-panel,
body[data-theme="amber"] .settings-panel,
body[data-theme="amber"] .bangs-popup-card,
body[data-theme="amber"] #auto-panel-list li,
body[data-theme="amber"] .bangs-list li,
body[data-theme="amber"] .settings-row select,
body[data-theme="amber"] .settings-row input[type="text"],
body[data-theme="amber"] #clear-suggestions,
body[data-theme="amber"] .remove-suggestion,
body[data-theme="amber"] .remove-bang,
body[data-theme="amber"] .settings-action button,
body[data-theme="amber"] .settings-btn {
  border-color: #996723;
  background: #1b1205;
  color: #ffd57a;
}

.terminal-shell {
  width: min(900px, 92vw);
  border: 1px solid #2f3e35;
  border-radius: 12px;
  background: #0c1118;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.terminal-topbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #263428;
  background: #121a25;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red {
  background: #ff5f56;
}

.dot.yellow {
  background: #ffbd2e;
}

.dot.green {
  background: #27c93f;
}

.title {
  margin: 0 auto;
  color: #8ea39d;
  font-size: 0.9rem;
}

.settings-btn {
  border: 1px solid #33463f;
  border-radius: 8px;
  background: #0f1c1a;
  color: #9ee4a7;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.settings-btn:hover {
  background: #173024;
}

.terminal-body {
  padding: 1.1rem;
}

.terminal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.terminal-layout.with-suggestions {
  grid-template-columns: minmax(0, 1fr) 240px;
}

.terminal-main {
  min-width: 0;
}

.meta-line {
  margin: 0;
  color: #7bcf87;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
}

.meta-line + .meta-line {
  margin-top: 0.35rem;
}

#time,
#date {
  color: #d9ffdb;
}

.terminal-input {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid #2c4331;
  border-radius: 8px;
  background: #0a1510;
  padding: 0.7rem 0.8rem;
}

.prompt {
  color: #92e89d;
  white-space: nowrap;
}

.terminal-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #d8ffd9;
  font: inherit;
}

.terminal-input input::placeholder {
  color: #6a9b74;
}

#hint {
  margin: 0.75rem 0 0;
  color: #6ca378;
  font-size: 0.9rem;
}

.auto-panel {
  border: 1px solid #2c4331;
  border-radius: 8px;
  background: #0a1510;
  padding: 0.7rem;
  height: fit-content;
  max-height: min(34vh, 11.5rem);
  overflow: hidden;
}

.auto-title {
  margin: 0 0 0.5rem;
  color: #94e09e;
  font-size: 0.85rem;
  text-transform: lowercase;
}

.auto-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.auto-head .auto-title {
  margin: 0;
}

#clear-suggestions {
  border: 1px solid #30493a;
  border-radius: 6px;
  background: #12231a;
  color: #9de3a6;
  padding: 0.2rem 0.45rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

#clear-suggestions:hover {
  background: #173024;
}

#auto-panel-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

#auto-panel-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  border: 1px solid #23362a;
  border-radius: 6px;
  background: #0f1e16;
  color: #cef7d2;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  font-size: 0.86rem;
  word-break: break-word;
}

#auto-panel-list li + li {
  margin-top: 0.4rem;
}

#auto-panel-list li:hover {
  background: #173024;
}

#auto-panel-list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-suggestion {
  border: 1px solid #30493a;
  border-radius: 5px;
  background: #13261c;
  color: #9de3a6;
  width: 1.2rem;
  height: 1.2rem;
  line-height: 1;
  font: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.remove-suggestion:hover {
  background: #1e3e2d;
}

#auto-panel-list .empty {
  opacity: 0.7;
  cursor: default;
}

.settings-panel {
  margin-top: 0.9rem;
  border: 1px solid #2f4635;
  border-radius: 8px;
  background: #0b1813;
  padding: 0.85rem;
}

.settings-panel h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: #9de3a6;
  text-transform: lowercase;
}

.settings-group {
  border: 1px solid #23362a;
  border-radius: 7px;
  background: #0e1a14;
  padding: 0.65rem;
}

.settings-group + .settings-group {
  margin-top: 0.6rem;
}

.settings-group-title {
  margin: 0 0 0.55rem;
  color: #8fdc99;
  font-size: 0.78rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  color: #bce6c3;
  font-size: 0.9rem;
}

.settings-row + .settings-row {
  margin-top: 0.55rem;
}

.settings-row select,
.settings-row input[type="checkbox"] {
  accent-color: #7ce18a;
}

.settings-row select,
.settings-row input[type="text"] {
  border: 1px solid #30493a;
  border-radius: 6px;
  background: #12231a;
  color: #cbf4d2;
  padding: 0.35rem 0.45rem;
  font: inherit;
}

.settings-row input[type="text"] {
  min-width: 260px;
}

.settings-action button {
  border: 1px solid #30493a;
  border-radius: 6px;
  background: #173024;
  color: #cbf4d2;
  padding: 0.4rem 0.7rem;
  font: inherit;
  cursor: pointer;
}

.settings-action button:hover {
  background: #1d3b2b;
}

.settings-footer-action {
  margin-top: 0.7rem;
}

.bangs-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  place-items: center;
  padding: 1rem;
  z-index: 30;
}

.bangs-popup[hidden] {
  display: none;
}

.bangs-popup:not([hidden]) {
  display: grid;
}

.bangs-popup-card {
  width: min(640px, 100%);
  border: 1px solid #2f4635;
  border-radius: 10px;
  background: #0b1813;
  padding: 0.85rem;
}

.bangs-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.bangs-popup-head h3 {
  margin: 0;
  color: #9de3a6;
  font-size: 0.95rem;
  text-transform: lowercase;
}

.bangs-popup-head button {
  border: 1px solid #30493a;
  border-radius: 6px;
  background: #12231a;
  color: #cbf4d2;
  width: 1.8rem;
  height: 1.8rem;
  font: inherit;
  cursor: pointer;
}

.bangs-popup-head button:hover {
  background: #173024;
}

.bangs-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: #bce6c3;
  font-size: 0.85rem;
}

.bangs-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border: 1px solid #23362a;
  border-radius: 6px;
  background: #0f1e16;
  padding: 0.4rem 0.5rem;
}

.bangs-list li + li {
  margin-top: 0.4rem;
}

.bangs-list .bang-key {
  color: #95e5a0;
  white-space: nowrap;
}

.bangs-list .bang-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-bang {
  border: 1px solid #30493a;
  border-radius: 5px;
  background: #13261c;
  color: #9de3a6;
  width: 1.3rem;
  height: 1.3rem;
  line-height: 1;
  font: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.remove-bang:hover {
  background: #1e3e2d;
}

.bangs-list .empty {
  opacity: 0.7;
  justify-content: flex-start;
}

@media (max-width: 640px) {
  .terminal-layout {
    grid-template-columns: 1fr;
  }

  .terminal-input {
    flex-direction: column;
    align-items: flex-start;
  }

  .terminal-input input {
    width: 100%;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-row input[type="text"],
  .settings-row select {
    width: 100%;
    min-width: 0;
  }

  .settings-action {
    align-items: stretch;
  }

  .settings-action span {
    display: none;
  }

  .settings-action button {
    width: 100%;
  }

  .bangs-popup-card {
    width: 100%;
  }
}
