﻿/* ===== THEME COLOR VARIABLES ===== */
body {
  --a: #00ff88;
  --ar: 0,255,136;
  --a03: rgba(0,255,136,.03);
  --a04: rgba(0,255,136,.04);
  --a05: rgba(0,255,136,.05);
  --a06: rgba(0,255,136,.06);
  --a07: rgba(0,255,136,.07);
  --a08: rgba(0,255,136,.08);
  --a09: rgba(0,255,136,.09);
  --a10: rgba(0,255,136,.1);
  --a12: rgba(0,255,136,.12);
  --a14: rgba(0,255,136,.14);
  --a15: rgba(0,255,136,.15);
  --a18: rgba(0,255,136,.18);
  --a20: rgba(0,255,136,.2);
  --a22: rgba(0,255,136,.22);
  --a24: rgba(0,255,136,.24);
  --a80: rgba(0,255,136,.8);
  --t1: #d7ffe8;
  --t2: #9cffc9;
  --t3: #7fbf98;
  --t4: #89bea0;
  --t5: #dfffea;
  --t6: #a7d8bb;
}

body[data-theme="blue"] {
  --a: #00aaff;
  --ar: 0,170,255;
  --a03: rgba(0,170,255,.03);
  --a04: rgba(0,170,255,.04);
  --a05: rgba(0,170,255,.05);
  --a06: rgba(0,170,255,.06);
  --a07: rgba(0,170,255,.07);
  --a08: rgba(0,170,255,.08);
  --a09: rgba(0,170,255,.09);
  --a10: rgba(0,170,255,.1);
  --a12: rgba(0,170,255,.12);
  --a14: rgba(0,170,255,.14);
  --a15: rgba(0,170,255,.15);
  --a18: rgba(0,170,255,.18);
  --a20: rgba(0,170,255,.2);
  --a22: rgba(0,170,255,.22);
  --a24: rgba(0,170,255,.24);
  --a80: rgba(0,170,255,.8);
  --t1: #d7eaff;
  --t2: #9cc4ff;
  --t3: #7f9ebf;
  --t4: #89a0be;
  --t5: #dfeeff;
  --t6: #a7bfdb;
}

body[data-theme="purple"] {
  --a: #bb55ff;
  --ar: 187,85,255;
  --a03: rgba(187,85,255,.03);
  --a04: rgba(187,85,255,.04);
  --a05: rgba(187,85,255,.05);
  --a06: rgba(187,85,255,.06);
  --a07: rgba(187,85,255,.07);
  --a08: rgba(187,85,255,.08);
  --a09: rgba(187,85,255,.09);
  --a10: rgba(187,85,255,.1);
  --a12: rgba(187,85,255,.12);
  --a14: rgba(187,85,255,.14);
  --a15: rgba(187,85,255,.15);
  --a18: rgba(187,85,255,.18);
  --a20: rgba(187,85,255,.2);
  --a22: rgba(187,85,255,.22);
  --a24: rgba(187,85,255,.24);
  --a80: rgba(187,85,255,.8);
  --t1: #ead7ff;
  --t2: #c99cff;
  --t3: #9a7fbf;
  --t4: #a089be;
  --t5: #efdffe;
  --t6: #bba7db;
}

body[data-theme="amber"] {
  --a: #ffaa00;
  --ar: 255,170,0;
  --a03: rgba(255,170,0,.03);
  --a04: rgba(255,170,0,.04);
  --a05: rgba(255,170,0,.05);
  --a06: rgba(255,170,0,.06);
  --a07: rgba(255,170,0,.07);
  --a08: rgba(255,170,0,.08);
  --a09: rgba(255,170,0,.09);
  --a10: rgba(255,170,0,.1);
  --a12: rgba(255,170,0,.12);
  --a14: rgba(255,170,0,.14);
  --a15: rgba(255,170,0,.15);
  --a18: rgba(255,170,0,.18);
  --a20: rgba(255,170,0,.2);
  --a22: rgba(255,170,0,.22);
  --a24: rgba(255,170,0,.24);
  --a80: rgba(255,170,0,.8);
  --t1: #fff0d7;
  --t2: #ffd99c;
  --t3: #bf987f;
  --t4: #bea089;
  --t5: #fff5df;
  --t6: #dbbfa7;
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: #020402;
  color: var(--t1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
  overflow-x: hidden;
  transition: color .35s;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, var(--a08), transparent 35%),
              radial-gradient(circle at bottom, var(--a04), transparent 30%);
  pointer-events: none;
  z-index: 0;
  transition: background .5s;
}

.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(rgba(255,255,255,.03), rgba(255,255,255,0) 2px);
  background-size: 100% 4px;
  mix-blend-mode: screen;
  opacity: .15;
}

/* ===== SCROLLBAR ===== */
body::-webkit-scrollbar { width: 10px; height: 10px; }
body::-webkit-scrollbar-track { background: #040704; }
body::-webkit-scrollbar-thumb {
  background: var(--a10);
  border: 1px solid var(--a20);
  border-radius: 999px;
}

/* ===== LINKS ===== */
a { color: var(--a); text-decoration: none; transition: color .35s, text-shadow .25s; }
a:hover { text-shadow: 0 0 12px var(--a80); }

/* ===== LAYOUT ===== */
main { position: relative; z-index: 2; padding-top: 4.5rem; }
header { position: relative; z-index: 2; }

/* ===== TOPBAR ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(2,4,2,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--a12);
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  transition: border-color .35s, box-shadow .35s;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.brand-mark {
  color: var(--a);
  text-shadow: 0 0 12px var(--a80);
  transition: color .35s, text-shadow .35s;
}

.menu { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }

.menu a {
  padding: .45rem .7rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--t2);
  transition: color .35s, border-color .25s, background .25s, box-shadow .25s;
}

.menu a:hover {
  border-color: var(--a24);
  background: var(--a06);
  box-shadow: 0 0 18px var(--a12);
}

/* ===== THEME SWITCH ===== */
.theme-switch { display: flex; gap: .45rem; align-items: center; }

.th-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2);
  cursor: pointer; padding: 0;
  transition: border-color .2s, transform .2s;
  flex-shrink: 0;
}
.th-btn:hover { transform: scale(1.2); }
.th-btn.active { border-color: #fff; transform: scale(1.15); }
.th-btn[data-theme=""] { background: #00ff88; }
.th-btn[data-theme="blue"] { background: #00aaff; }
.th-btn[data-theme="purple"] { background: #bb55ff; }
.th-btn[data-theme="amber"] { background: #ffaa00; }

/* ===== HERO ===== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 1rem;
  padding: 1.1rem 1.25rem 0;
  align-items: stretch;
}

.hero-copy, .hero-panel, .footer-note, .tool-card {
  background: linear-gradient(180deg, rgba(7,13,8,.95), rgba(4,7,4,.96));
  border: 1px solid var(--a12);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--a04), 0 18px 50px rgba(0,0,0,.35), 0 0 24px var(--a05);
  transition: border-color .35s, box-shadow .35s;
}

.hero-copy { padding: 1.4rem; }

.eyebrow {
  margin: 0 0 .55rem;
  color: var(--a);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .72rem;
  transition: color .35s;
}

.hero h1 {
  margin: .1rem 0 .75rem;
  font-size: clamp(2rem, 4vw, 4.3rem);
  line-height: .98;
  text-shadow: 0 0 20px var(--a22);
  transition: text-shadow .35s;
}

.lead {
  margin: 0 0 1rem;
  max-width: 62ch;
  color: var(--t6);
  line-height: 1.65;
  transition: color .35s;
}

/* ===== SEARCH ===== */
.search-shell { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.05rem; }

.search-shell input {
  flex: 1; min-width: 0;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--a20);
  background: #071009;
  color: var(--t5);
  font-size: 1rem;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--a04);
  transition: border-color .25s, box-shadow .25s, color .35s;
}

.search-shell input:focus {
  border-color: var(--a);
  box-shadow: 0 0 0 3px var(--a08), 0 0 24px var(--a12);
}

.search-shell button {
  padding: .95rem 1rem;
  border-radius: 14px;
  background: #08120b;
  border: 1px solid var(--a20);
  color: var(--a);
  cursor: pointer;
  transition: color .35s, border-color .35s, box-shadow .25s;
}

.search-shell button:hover { box-shadow: 0 0 18px var(--a18); }

.sticky-search { position: sticky; top: 5.2rem; z-index: 8; backdrop-filter: blur(12px); }

/* ===== COUNTERS ===== */
.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }

.counters article {
  padding: .9rem .95rem;
  border: 1px solid var(--a12);
  border-radius: 14px;
  background: var(--a03);
  transition: border-color .35s, background .35s;
}

.counters strong { display: block; color: var(--a); font-size: 1.25rem; transition: color .35s; }

.counters span {
  display: block;
  color: var(--t3);
  font-size: .75rem;
  margin-top: .2rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  transition: color .35s;
}

/* ===== HERO PANEL ===== */
.hero-panel { padding: 1rem; }

.panel-glass {
  display: grid; gap: .8rem;
  padding: .95rem;
  border-radius: 16px;
  border: 1px solid var(--a12);
  background: linear-gradient(180deg, var(--a05), var(--a03));
  transition: border-color .35s, background .35s;
}

.panel-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem .85rem;
  border-radius: 12px;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--a08);
  transition: border-color .35s;
}

.panel-line span {
  color: var(--t3);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  transition: color .35s;
}

.panel-line strong { color: var(--a); font-size: .92rem; transition: color .35s; }

/* ===== SECTION HEAD ===== */
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem .7rem;
}

.section-head h2, .footer-note h3 { margin: .1rem 0 0; font-size: 1.35rem; }

.section-meta {
  color: var(--t3);
  font-size: .82rem;
  border: 1px solid var(--a12);
  padding: .5rem .75rem;
  border-radius: 999px;
  background: var(--a03);
  transition: color .35s, border-color .35s, background .35s;
}

/* ===== CARD GRID ===== */
.menu-stack { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; padding: 0 1.25rem 1.05rem; }
.tool-card.open { grid-column: 1 / -1; }

.tool-card {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--a12);
  background: linear-gradient(180deg, rgba(7,13,8,.95), rgba(4,7,4,.96));
  box-shadow: 0 0 0 1px var(--a04), 0 18px 50px rgba(0,0,0,.35), 0 0 24px var(--a05);
  transition: border-color .35s, box-shadow .35s;
}

.tool-card:hover {
  box-shadow: 0 0 0 1px var(--a14), 0 18px 50px rgba(0,0,0,.35), 0 0 30px var(--a12);
}

.tool-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  padding: .9rem 1rem;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.tool-title-wrap { display: flex; align-items: flex-start; gap: .75rem; min-width: 0; }

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem; height: 2.15rem;
  border-radius: 10px;
  background: var(--a08);
  border: 1px solid var(--a18);
  color: var(--a);
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 14px var(--a08);
  transition: color .35s, border-color .35s, background .35s, box-shadow .35s;
}

.tool-title { margin: 0; font-size: 1rem; }

.tool-desc {
  margin: .18rem 0 0;
  color: var(--t4);
  font-size: .76rem;
  line-height: 1.4;
  transition: color .35s;
}

.tool-right { display: flex; align-items: center; gap: .45rem; }

.badge {
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .3rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--a15);
  color: var(--a);
  background: var(--a06);
  transition: color .35s, border-color .35s, background .35s;
}

.arrow {
  color: var(--a);
  font-size: 1.45rem;
  line-height: 1;
  transition: transform .2s ease, color .35s;
}

.tool-card.open .arrow { transform: rotate(90deg); }

/* ===== UNIT TAGS (collapsed card) ===== */
.unit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: 0 1rem .7rem;
  border-top: 1px solid var(--a06);
}

.tool-card.open .unit-tags { display: none; }

.unit-tag {
  display: inline-block;
  padding: .18rem .45rem;
  font-size: .62rem;
  letter-spacing: .04em;
  border-radius: 999px;
  border: 1px solid var(--a12);
  color: var(--t3);
  background: var(--a03);
  transition: color .35s, border-color .35s, background .35s;
}

.tool-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--a09);
  transition: border-color .35s;
}

/* ===== UNIT LIST & PILLS ===== */
.unit-list, .unit-list[hidden] { display: none !important; }

.unit-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .45rem;
  padding: .58rem .65rem;
  border: 1px solid var(--a12);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
  cursor: pointer;
  font-size: .88rem;
  transition: border-color .25s, box-shadow .25s, transform .15s;
}

.unit-pill:hover { box-shadow: 0 0 18px var(--a08); transform: translateY(-1px); }
.unit-pill small { display: none; }

.unit-pill.active {
  border-color: var(--a);
  box-shadow: 0 0 0 1px var(--a10), 0 0 20px var(--a12);
}

/* ===== AD STRIPS ===== */
.ad-strip {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: .7rem;
  padding: 0 1.25rem 1rem;
}
.ad-strip--bottom { padding-top: 0; margin-top: -.2rem; }

.ad-slot {
  min-height: 54px;
  border: 1px solid var(--a12);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-slot ins { display: block; width: 100%; min-height: 54px; }

.ad-slot--soft {
  border-style: dashed;
  color: var(--t3);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ===== CONVERTER ===== */
.converter { display: grid; gap: .8rem; padding-top: .8rem; }

.conv-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: .6rem;
  align-items: end;
}

.conv-field label, .result-box label {
  display: block;
  margin: 0 0 .35rem;
  color: var(--t3);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  transition: color .35s;
}

.conv-field input, .conv-field select {
  width: 100%;
  padding: .9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--a18);
  background: #061009;
  color: var(--t5);
  outline: none;
  font: inherit;
  transition: border-color .25s, box-shadow .25s, color .35s;
}

.conv-field input:focus, .conv-field select:focus {
  border-color: var(--a);
  box-shadow: 0 0 0 3px var(--a07);
}

.swap-btn {
  height: 48px; min-width: 48px;
  border-radius: 14px;
  border: 1px solid var(--a18);
  background: var(--a06);
  color: var(--a);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color .35s, border-color .35s, box-shadow .25s;
}

.swap-btn:hover { box-shadow: 0 0 20px var(--a12); }

/* ===== RESULT BOX ===== */
.result-box {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--a14);
  background: linear-gradient(180deg, var(--a07), rgba(0,0,0,.18));
  transition: border-color .35s, background .35s;
}

.result-value {
  font-size: 1.5rem;
  color: var(--a);
  word-break: break-word;
  text-shadow: 0 0 16px var(--a22);
  transition: color .35s, text-shadow .35s;
}

.result-sub {
  margin-top: .35rem;
  color: var(--t4);
  font-size: .8rem;
  transition: color .35s;
}

/* ===== QUICK DROP ===== */
.quick-drop {
  border: 1px solid var(--a12);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
  transition: border-color .35s;
}

.quick-drop summary {
  cursor: pointer;
  list-style: none;
  color: var(--a);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .75rem .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color .35s;
}

.quick-drop summary::-webkit-details-marker { display: none; }
.quick-drop summary::after { content: '+'; font-size: 1.1rem; opacity: .85; }
.quick-drop[open] summary::after { content: '\2212'; }
.quick-drop .quick-grid { padding: 0 .9rem .9rem; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .5rem;
}

.quick-item {
  padding: .75rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--a10);
  background: rgba(0,0,0,.14);
  transition: border-color .35s;
}

.quick-item strong { display: block; color: var(--a); transition: color .35s; }

.quick-item span {
  display: block;
  margin-top: .2rem;
  color: var(--t4);
  font-size: .76rem;
  transition: color .35s;
}

/* ===== EMPTY STATE ===== */
.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--t4);
  border: 1px dashed var(--a12);
  border-radius: 16px;
  background: rgba(0,0,0,.12);
  transition: color .35s, border-color .35s;
}

/* ===== FOOTER ===== */
.footer-note { margin: 0 1.25rem 1.5rem; padding: 1rem 1.15rem; }
.footer-note p { color: var(--t6); line-height: 1.65; transition: color .35s; }

/* ===== AD BAR ===== */
body { padding-bottom: 5rem; }

.ad-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(2,4,2,.97);
  border-top: 1px solid var(--a14);
  padding: .35rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  max-height: 70px;
  overflow: hidden;
  transition: border-color .35s;
}

.ad-bar ins { display: block !important; width: 100% !important; max-height: 60px; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.favorites { display: flex; flex-wrap: wrap; gap: .45rem; }

.fav-btn {
  border: 1px solid var(--a18);
  background: var(--a06);
  color: var(--a);
  border-radius: 999px;
  padding: .35rem .65rem;
  font: inherit;
  cursor: pointer;
  transition: color .35s, border-color .35s, background .25s;
}

.fav-btn.on { background: var(--a15); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .menu-stack { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .menu-stack { grid-template-columns: 1fr; padding: 0 1rem 1rem; }
  .ad-strip { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { padding: .85rem .9rem; flex-wrap: wrap; justify-content: center; }
  .brand { width: 100%; justify-content: center; }
  .menu { order: 3; width: 100%; }
  .theme-switch { order: 2; margin-left: auto; }
  main { padding-top: 9rem; }
  .sticky-search { top: 9.4rem; }
  .hero, .section-head, .menu-stack, .footer-note, .ad-strip { padding-left: .75rem; padding-right: .75rem; }
  .counters { grid-template-columns: 1fr 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .tool-header { padding: .88rem; }
  .tool-body { padding: 0 .88rem .88rem; }
  .conv-row { grid-template-columns: 1fr 1fr auto; gap: .5rem; }
}
