:root {
  --bg: #0b0f19;
  --card: #151d30;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #222f49;
  --danger: #ef4444;
  --success: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  margin-bottom: 24px;
  max-width: 650px;
}

header h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 8px;
}

header p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.category-title {
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 10px;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  max-width: 750px;
}

.tab-btn {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: 0.2s ease;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

main {
  width: 100%;
  max-width: 620px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.tool-card.active {
  display: block;
}

.tool-card h2 {
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.subtext {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: 0.2s;
  background: rgba(255,255,255,0.02);
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.05);
}

.control-group {
  margin-bottom: 16px;
}

.control-group label, .hearing-slider label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
  border-radius: 4px;
  outline: none;
  background: var(--border);
  cursor: pointer;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  width: 100%;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 10px;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-sm {
  width: auto;
  flex: 1;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.btn-danger {
  background: #334155;
}

.btn-danger:hover {
  background: var(--danger);
}

audio {
  width: 100%;
  margin-top: 16px;
  border-radius: 6px;
}

.meter-box {
  text-align: center;
  padding: 16px 0;
}

.db-num {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
}

.db-bar-bg {
  width: 100%;
  height: 14px;
  background: var(--border);
  border-radius: 7px;
  overflow: hidden;
  margin: 14px 0;
}

.db-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 100%);
  transition: width 0.08s ease;
}

.flash-box {
  height: 65px;
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 14px;
}

.status-msg {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.badge {
  background: rgba(16,185,129,0.15);
  color: #34d399;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  vertical-align: middle;
}

footer {
  margin-top: auto;
  padding: 36px 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Footer Links & Modals */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.footer-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  text-decoration: underline;
  transition: 0.2s;
}

.footer-btn:hover {
  color: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 999;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  position: relative;
  color: var(--text);
  line-height: 1.6;
  font-size: 0.9rem;
}

.modal-content h3 {
  margin-bottom: 12px;
  color: #fff;
  font-size: 1.2rem;
}

.modal-content p {
  color: var(--muted);
  margin-bottom: 10px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}
