:root {
  --bg: #0b0e14;
  --panel: #101726;
  --panel2: #0f1422;
  --text: #e7ecff;
  --muted: #9aa6c4;
  --line: #22304d;
  --accent: #6ee7ff;
  --accent2: #b4ff6e;
  --danger: #ff6e6e;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r: 16px;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 20% 10%, rgba(110, 231, 255, .08), transparent 60%),
    radial-gradient(1200px 700px at 80% 30%, rgba(180, 255, 110, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 20, .78);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(110, 231, 255, .25), rgba(180, 255, 110, .16));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .3px
}

.subtitle {
  font-size: 12px;
  color: var(--muted)
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end
}

#q {
  width: min(260px, 35vw);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(16, 23, 38, .75);
  color: var(--text);
  outline: none;
}

#q:focus {
  border-color: rgba(110, 231, 255, .45);
  box-shadow: 0 0 0 4px rgba(110, 231, 255, .10)
}

.btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(16, 23, 38, .60);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(180, 255, 110, .35)
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(16, 23, 38, .45);
  color: var(--muted);
  user-select: none;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  padding: 14px;
}

.sidebar {
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(16, 23, 38, .55);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidehead {
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(15, 20, 34, .65);
}

.sidehead .h {
  font-weight: 800
}

.counts {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px
}

.catlist {
  padding: 6px;
}

@media (min-width: 981px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    position: sticky;
    top: 86px;
  }

  .sidehead {
    flex-shrink: 0;
  }

  .catlist {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

.catlist::-webkit-scrollbar {
  width: 5px;
}

.catlist::-webkit-scrollbar-track {
  background: transparent;
}

.catlist::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 99px;
}

.catlist::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .2);
}

.catbtn {
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.catbtn:hover {
  background: rgba(110, 231, 255, .06);
  border-color: rgba(110, 231, 255, .14)
}

.catbtn.active {
  background: rgba(180, 255, 110, .08);
  border-color: rgba(180, 255, 110, .22)
}

.catmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent)
}

.footerhint {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: var(--muted);
  font-size: 12px;
}

.content {
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(16, 23, 38, .35);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(15, 20, 34, .55);
}

.activeLabel {
  font-weight: 800
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(110, 231, 255, .10);
  border: 1px solid rgba(110, 231, 255, .20);
  color: var(--text);
  font-size: 12px;
}

.grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.card {
  border-radius: var(--r);
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(16, 23, 38, .62);
  padding: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
  cursor: pointer;
  transition: transform .08s ease, border-color .12s ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 231, 255, .22)
}

.cardTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.symbol {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .2px;
  color: var(--accent);
}

.smallTag {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(15, 20, 34, .55);
}

.meaning {
  margin-top: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.vibes {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.details {
  margin-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, .10);
  padding-top: 10px;
  display: none;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.card.open .details {
  display: block
}

.kv {
  display: flex;
  gap: 10px;
  margin: 6px 0;
}

.kv b {
  min-width: 86px;
  color: var(--muted);
  font-weight: 700
}

.compact .grid {
  grid-template-columns: repeat(4, minmax(0, 1fr))
}

.compact .vibes {
  display: none
}

.compact .details {
  display: none
}

.compact .symbol {
  font-size: 16px
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.modal.show {
  display: block
}

.modalCard {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(840px, 92vw);
  max-height: min(78vh, 760px);
  overflow: auto;
  background: rgba(16, 23, 38, .96);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 10;
}

.modalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 1;
}

.x {
  position: sticky;
  top: 0;
  float: right;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(15, 20, 34, .70);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

.x:hover {
  border-color: rgba(255, 110, 110, .35)
}

.modalH {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.modalSymbol {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
}

.modalTitle {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 6px;
}

.modalMeta {
  color: var(--muted);
  font-size: 12px
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr
  }

  .sidebar {
    min-height: auto
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

/* Utilities */
.sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, .10);
  margin: 0 4px;
}

.hidden {
  display: none !important;
}

#lensFilter {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(16, 23, 38, .75);
  color: var(--text);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e7ecff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4l128-128c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px top 50%;
  background-size: 8px auto;
  padding-right: 32px;
}

#lensFilter:hover {
  background-color: rgba(16, 23, 38, .90);
  border-color: rgba(180, 255, 110, .35);
}

#lensFilter:focus {
  border-color: rgba(110, 231, 255, .45);
}

/* Buttons */
.btn.accent {
  background: rgba(110, 231, 255, .15);
  border-color: rgba(110, 231, 255, .30);
  color: var(--accent);
  font-weight: 700;
}

.btn.accent:hover {
  background: rgba(110, 231, 255, .25);
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(255, 110, 110, .30);
  background: rgba(255, 110, 110, .10);
}

.btn.danger:hover {
  background: rgba(255, 110, 110, .20);
}

.btn.primary {
  background: var(--accent);
  color: var(--panel);
  font-weight: 700;
  border: none;
}

.btn.primary:hover {
  opacity: 0.9;
}

.ioControls {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.btn.small {
  padding: 6px 10px;
  font-size: 11px;
}

/* Form Styles */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(11, 14, 20, .60);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(11, 14, 20, .90);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* Card Actions */
.card {
  position: relative;
}

/* Ensure absolute positioning works */

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
}

/* Show actions on hover OR if a button inside is focused */
.card:hover .card-actions,
.card-actions:focus-within {
  opacity: 1;
}

.card-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(15, 20, 34, .95);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
}

.card-btn:hover {
  background: var(--accent);
  color: var(--panel);
  border-color: var(--accent);
}

.card-btn.del:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}