@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f111a;
  --bg-card:    #1a1d2e;
  --bg-card-2:  #222640;
  --bg-input:   #161929;
  --border:     rgba(255,255,255,0.06);
  --border-lit: rgba(255,255,255,0.12);
  --text:       #e2e8f0;
  --text-dim:   #8892b0;
  --text-muted: #5a6480;
  --accent:     #7c3aed;
  --accent-2:   #a78bfa;
  --accent-glow:rgba(124,58,237,0.25);
  --cyan:       #06b6d4;
  --green:      #10b981;
  --green-dim:  rgba(16,185,129,0.15);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.12);
  --orange:     #f59e0b;
  --gradient:   linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --gradient-2: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  --radius:     12px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.site-header {
  background: linear-gradient(180deg, rgba(124,58,237,0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.header-logo {
  width: 38px; height: 38px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.header-logo svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 16px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; line-height: 1.2;
}
.brand-tag {
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.header-nav {
  display: flex; align-items: center; gap: 6px;
}
.nav-link {
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-dim); text-decoration: none;
  border-radius: 8px; transition: all .2s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--accent-2); background: var(--accent-glow); }
.nav-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  background: var(--gradient-2); color: #fff;
  padding: 2px 7px; border-radius: 20px; margin-left: 5px;
  letter-spacing: 0.3px;
}

/* ── CONTAINER ── */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 40px 60px; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-glow {
  background: linear-gradient(135deg, rgba(124,58,237,0.06) 0%, rgba(6,182,212,0.04) 100%);
  border-color: rgba(124,58,237,0.15);
}

/* ── UPLOAD ── */
.upload-zone {
  border: 2px dashed rgba(124,58,237,0.3);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(124,58,237,0.04) 0%, rgba(6,182,212,0.02) 100%);
  cursor: pointer;
  transition: all .3s ease;
  position: relative;
  margin-bottom: 20px;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(124,58,237,0.08) 0%, rgba(6,182,212,0.04) 100%);
  box-shadow: 0 0 30px var(--accent-glow);
}
.upload-zone.ready {
  border-color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 20px rgba(16,185,129,0.15);
}
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%;
}
.upload-icon-wrap {
  width: 64px; height: 64px;
  background: var(--gradient);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.upload-icon-wrap svg { width: 28px; height: 28px; }
.upload-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.upload-desc {
  font-size: 13px; color: var(--text-dim); margin-bottom: 4px;
}
.upload-formats {
  display: inline-flex; gap: 6px; margin-top: 10px;
}
.format-tag {
  font-size: 11px; font-weight: 600; color: var(--accent-2);
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.2);
  padding: 3px 10px; border-radius: 20px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.file-chosen {
  font-size: 13px; font-weight: 600; color: var(--green);
  margin-top: 12px; display: none;
}

/* ── FORM OPTIONS ── */
.form-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.checkbox-row {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.checkbox-row input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer; border-radius: 4px;
}
.checkbox-row span {
  font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none;
}

.btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gradient);
  color: #fff; border: none;
  border-radius: 10px; padding: 11px 28px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .2s; font-family: inherit;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-lit);
  color: var(--text-dim); border-radius: 10px;
  padding: 11px 20px; font-size: 13px;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.success-note { font-size: 12px; color: var(--green); font-weight: 600; }

/* ── ERROR ── */
.error-box {
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--red); font-size: 13px; font-weight: 500;
  margin-bottom: 20px;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient);
}
.stat-val {
  font-size: 26px; font-weight: 800; line-height: 1.1;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 600; margin-top: 6px;
}

/* ── SECTION HEAD ── */
.section-head {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-head .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gradient);
}

/* ── META ── */
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color .2s;
}
.meta-box:hover { border-color: var(--border-lit); }
.meta-key {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px;
}
.meta-val { font-size: 13px; color: var(--text); word-break: break-word; }
.meta-val.missing { color: var(--red); font-style: italic; opacity: 0.8; }
.meta-val.ok { color: var(--green); font-weight: 600; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip {
  background: rgba(124,58,237,0.12);
  color: var(--accent-2);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 500;
}

/* ── TABS ── */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg-input);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 4px; border: 1px solid var(--border);
  border-bottom: none;
}
.tab {
  flex: 1; padding: 10px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
  background: transparent; border: none;
  border-radius: 8px; transition: all .2s; font-family: inherit;
  text-align: center;
}
.tab.active {
  color: #fff; background: var(--gradient);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.tab:hover:not(.active) { color: var(--text-dim); background: rgba(255,255,255,0.03); }
.tab-count {
  display: inline-block;
  font-size: 10px; font-weight: 700; border-radius: 20px;
  padding: 1px 7px; margin-left: 5px;
  background: rgba(255,255,255,0.08); color: var(--text-muted);
}
.tab.active .tab-count { background: rgba(255,255,255,0.2); color: #fff; }
.ngram-panel { display: none; }
.ngram-panel.active { display: block; }

/* ── TABLE ── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-card-2);
  padding: 12px 16px; text-align: left;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(124,58,237,0.04); }
td { padding: 10px 16px; vertical-align: middle; }
.rank { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.phrase {
  font-size: 13px; font-weight: 600; color: var(--accent-2);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}
.num {
  font-size: 13px; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── PROMINENCE ── */
.proms { display: flex; gap: 3px; flex-wrap: wrap; }
.prom {
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; letter-spacing: 0.3px; text-transform: uppercase;
}
.prom.on {
  background: rgba(124,58,237,0.15);
  color: var(--accent-2);
  border: 1px solid rgba(124,58,237,0.25);
}
.prom.off {
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  border: 1px solid var(--border);
  opacity: 0.4;
}
.empty-state { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── SEARCH ── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 14px;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar input {
  border: none; outline: none; font-size: 14px;
  color: var(--text); background: transparent;
  flex: 1; font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.search-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0; display: none; transition: color .2s;
}
.search-clear:hover { color: var(--red); }
tr.hidden { display: none; }
.no-results { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; display: none; }

/* ── GUIDE ── */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 8px; }
.guide-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  transition: border-color .2s;
}
.guide-item:hover { border-color: var(--border-lit); }
.guide-key { font-size: 12px; font-weight: 700; color: var(--accent-2); margin-bottom: 4px; }
.guide-val { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── INLINE LOADING ── */
.inline-loading {
  display: none;
  background: var(--bg-card);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 20px;
  animation: slideDown .3s ease-out;
  box-shadow: 0 0 20px var(--accent-glow);
}
.inline-loading.active { display: block; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.inline-loading-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.inline-loading-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.inline-loading-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(124,58,237,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.inline-loading-msg { font-size: 12px; color: var(--text-muted); }
.inline-loading-bar-wrap {
  background: rgba(124,58,237,0.1);
  border-radius: 99px; height: 6px; overflow: hidden;
}
.inline-loading-bar {
  height: 100%; border-radius: 99px;
  background: var(--gradient);
  width: 0%;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  margin-top: 20px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex; align-items: center; gap: 10px;
}
.footer-logo {
  width: 28px; height: 28px;
  background: var(--gradient);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.footer-name { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.footer-copy { font-size: 12px; color: var(--text-muted); }
.footer-links {
  display: flex; gap: 20px;
}
.footer-link {
  font-size: 12px; color: var(--text-muted);
  text-decoration: none; transition: color .2s;
}
.footer-link:hover { color: var(--accent-2); }

.btn-top {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 10px;
  padding: 10px 22px; font-size: 13px;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-top:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── PAGE INTRO ── */
.page-intro {
  text-align: center;
  padding: 40px 20px 10px;
}
.page-intro h1 {
  font-size: 28px; font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.page-intro p {
  font-size: 15px; color: var(--text-dim);
  max-width: 500px; margin: 0 auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .site-header { padding: 0 16px; }
  .header-nav { display: none; }
  .meta-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .tabs { flex-wrap: wrap; }
  .page-intro { padding: 24px 16px 0; }
  .page-intro h1 { font-size: 22px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .site-footer { padding: 24px 16px; }
}
