:root {
  --page-bg-1: #060112;
  --page-bg-2: #13002b;
  --page-bg-3: #2a004f;
  --page-bg-4: #ec4899;
  --card-bg: rgba(13,12,32,.92);
  --card-border: rgba(255,255,255,.14);
  --card-inner: rgba(255,255,255,.05);
  --ink: #f8fafc;
  --muted: rgba(248,250,252,.72);
  --accent: #ec4899;
  --accent-2: #38bdf8;
  --accent-3: #a855f7;
  --danger: #fb7185;
  --panel-radius: 32px;
  --panel-shadow: 0 30px 70px rgba(3,4,15,.75);
  --btn-radius: 14px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(-45deg, var(--page-bg-1), var(--page-bg-2), var(--page-bg-3), var(--page-bg-4));
  background-size: 400% 400%;
  animation: toolboxBgShift 12s ease infinite;
  color: var(--ink);
  font-family: inherit;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(20px, 4vw, 60px) clamp(16px, 4vw, 48px);
}

@keyframes toolboxBgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.tool-shell {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: clamp(1.4rem, 3vw, 2.6rem);
}

.tool-hero {
  background: rgba(12, 10, 30, .82);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 36px;
  padding: 10px 12px;
  box-shadow: var(--panel-shadow);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.tool-hero::after,
.tool-hero::before {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(55px);
  opacity: .45;
  pointer-events: none;
  z-index: 0;
}

.tool-hero::after {
  top: -80px;
  right: -60px;
  background: radial-gradient(circle, rgba(236,72,153,.7), transparent 55%);
}

.tool-hero::before {
  bottom: -90px;
  left: -80px;
  background: radial-gradient(circle, rgba(56,189,248,.5), transparent 65%);
}

.tool-hero > * {
  position: relative;
  z-index: 1;
}

.tool-hint {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  letter-spacing: .45em;
  text-transform: uppercase;
  font-size: .75rem;
  color: rgba(248,250,252,.65);
  margin-bottom: .8rem;
}

.tool-hint::before {
  content: '';
  width: 28px;
  height: 1px;
  background: rgba(248,250,252,.35);
}

.tool-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: .32em;
  text-transform: uppercase;
}

.tool-hero p {
  margin: .6rem 0 0;
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.6;
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.4rem;
}

.tool-pill {
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(135deg, rgba(236,72,153,.35), rgba(56,189,248,.25));
  font-weight: 700;
  letter-spacing: .15em;
  font-size: .75rem;
  text-transform: uppercase;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--panel-radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  position: relative;
  overflow: hidden;
  box-shadow: var(--panel-shadow);
  isolation: isolate;
}

.panel::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--panel-radius) - 10px);
  background: linear-gradient(135deg, rgba(255,255,255,.06), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.tool-card {
  padding: clamp(1.4rem, 3vw, 2.4rem);
  overflow: visible;
}

.tool-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.tool-slab {
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(16,15,35,.82);
  padding: 1.1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.tool-highlight {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 220px;
  background: linear-gradient(135deg, rgba(236,72,153,.2), rgba(15,23,42,.85));
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
}

.controls .btn {
  flex: 1 1 0;
  min-width: 140px;
}

.btn {
  border-radius: var(--btn-radius);
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.02));
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .85rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  transition: transform .15s ease, box-shadow .25s ease, background .2s ease;
  text-decoration: none;
}

.btn span {
  font-size: 1.2rem;
  line-height: 1;
}

.btn:hover {
  box-shadow: 0 15px 35px rgba(5,8,20,.55);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(120deg, #06b6d4, #6366f1, #ec4899);
  border-color: transparent;
}

.btn.danger {
  background: linear-gradient(120deg, #fb7185, #f43f5e);
  border-color: transparent;
}

.btn.toggle {
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.18);
  opacity: .9;
}

.btn.toggle.on,
.btn.toggle.active {
  background: linear-gradient(120deg, #a855f7, #06b6d4);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 25px 45px rgba(6,182,212,.35);
  opacity: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.02));
  font-weight: 700;
  letter-spacing: .05em;
  gap: .35rem;
}

.pill {
  padding: .6rem 1.4rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.2);
  background: linear-gradient(135deg, rgba(236,72,153,.35), rgba(56,189,248,.3));
  font-weight: 700;
  letter-spacing: .05em;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}

.dropdown {
  position: relative;
  width: 100%;
}

.dropdown-toggle {
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: var(--btn-radius);
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  text-align: center;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  transition: box-shadow .25s ease, transform .15s ease;
}

.dropdown-toggle:hover {
  box-shadow: 0 15px 45px rgba(0,0,0,.55);
  transform: translateY(-1px);
}

.dropdown-menu {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%) scale(.95);
  opacity: 0;
  pointer-events: none;
  min-width: 100%;
  background: rgba(8,10,24,.98);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 35px 80px rgba(0,0,0,.7);
  padding: .75rem 0;
  z-index: 40;
  transition: opacity .2s ease, transform .2s ease;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.dropdown-menu button {
  width: 100%;
  padding: .7rem 1.2rem;
  background: transparent;
  border: none;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease;
}

.dropdown-menu button:hover {
  background: linear-gradient(120deg, rgba(236,72,153,.35), rgba(56,189,248,.2));
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
  font-size: .85rem;
  letter-spacing: .05em;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: linear-gradient(120deg, rgba(6,182,212,.95), rgba(236,72,153,.95));
  color: #fff;
  padding: .85rem 1.2rem;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 15px 50px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 60;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  body {
    padding: 20px 16px 30px;
  }
  .controls {
    flex-direction: column;
  }
  .controls .btn {
    width: 100%;
    min-width: 0;
  }
  .brand {
    width: 100%;
    justify-content: center;
  }
}
