/* NPM Size Explorer — Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #CB3837; --primary-light: #E8524A;
  --accent: #10B981; --warn: #F59E0B; --danger: #EF4444;
  --bg: #0B0F1A; --bg-card: rgba(255,255,255,0.04);
  --bg-glass: rgba(255,255,255,0.06); --border: rgba(255,255,255,0.08);
  --text: #E8E8E8; --text-dim: #9CA3AF; --text-muted: #6B7280;
  --radius: 12px; --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', monospace;
  --shadow: 0 4px 24px rgba(0,0,0,0.3); --transition: 250ms ease;
}
html { font-size: 16px; } body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }

.header { position: sticky; top: 0; z-index: 100; background: rgba(11,15,26,0.85); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.header__inner { max-width: 850px; margin: 0 auto; padding: 0.75rem 1.5rem; display: flex; align-items: center; }
.header__brand { display: flex; align-items: center; gap: 0.6rem; }
.header__icon { font-size: 1.3rem; } .header__title { font-size: 1.15rem; font-weight: 700; }

.btn { display: inline-flex; align-items: center; gap: 0.4rem; border: none; cursor: pointer; font-family: var(--font); font-size: 0.85rem; font-weight: 500; border-radius: var(--radius-sm); transition: all var(--transition); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn--accent { background: var(--primary); color: #fff; padding: 0.55rem 1.1rem; font-weight: 600; }
.btn--accent:hover { filter: brightness(1.15); }

.main { max-width: 850px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }

.search-row { display: flex; gap: 0.5rem; }
.pkg-input { flex: 1; padding: 0.6rem 0.85rem; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--mono); font-size: 0.95rem; }
.pkg-input:focus { outline: none; border-color: var(--primary); }

.loader { text-align: center; padding: 2rem; display: flex; gap: 0.3rem; justify-content: center; }
.loader.hidden { display: none; }
.loader-dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; animation: bounce 0.6s infinite alternate; }
.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { to { transform: translateY(-8px); opacity: 0.5; } }

.results.hidden { display: none; }

.pkg-header { margin-top: 1rem; padding: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.pkg-name { font-size: 1.3rem; font-weight: 800; }
.pkg-ver { font-family: var(--mono); font-size: 0.85rem; color: var(--text-dim); }
.pkg-desc { font-size: 0.88rem; color: var(--text-dim); margin-top: 0.25rem; }
.pkg-meta { display: flex; gap: 1rem; margin-top: 0.3rem; font-size: 0.78rem; color: var(--text-muted); }
.pkg-link { color: var(--primary-light); text-decoration: none; }
.pkg-link:hover { text-decoration: underline; }

.size-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.size-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; text-align: center; }
.size-card__label { font-size: 0.7rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.size-card__value { font-size: 1.4rem; font-weight: 800; font-family: var(--mono); margin-top: 0.15rem; }
.size-green { color: var(--accent); } .size-yellow { color: var(--warn); } .size-red { color: var(--danger); }

.feature-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.5rem; }
.pill { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid; }
.pill--green { color: var(--accent); border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.1); }
.pill--yellow { color: var(--warn); border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.1); }
.pill--red { color: var(--danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.1); }

.result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-top: 0.75rem; }
.card-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; }

.dep-tree { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.dep-item { font-family: var(--mono); font-size: 0.78rem; padding: 0.25rem 0.6rem; background: rgba(203,56,55,0.08); border: 1px solid rgba(203,56,55,0.2); border-radius: 999px; cursor: pointer; transition: all var(--transition); }
.dep-item:hover { background: rgba(203,56,55,0.16); }
.dep-empty { font-size: 0.82rem; color: var(--text-muted); }

canvas { width: 100%; height: auto; display: block; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 0.6rem 1.25rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow); z-index: 500; animation: toastIn 300ms ease; }
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 600px) { .main { padding: 1rem; } }
