*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-primary: #0f0f13;
  --bg-secondary: #1a1a24;
  --bg-card: #22223a;
  --bg-hover: #2a2a45;
  --border: #2e2e4a;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0c0;
  --text-muted: #6b6b8a;
  --accent: #7c5cfc;
  --accent-hover: #6a4ae6;
  --accent-light: rgba(124, 92, 252, 0.15);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h1 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 500;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 20px;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
  overflow-y: auto;
  height: 100vh;
}
.tool-section {
  display: none;
  animation: fadeIn .35s ease;
}
.tool-section.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.tool-header { margin-bottom: 28px; }
.tool-header h2 {
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tool-header p {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}
.card:hover { border-color: rgba(124,92,252,.3); }
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}
input[type="text"],
input[type="number"],
input[type="url"],
input[type="color"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}
textarea.mono { font-family: var(--mono); }
select { cursor: pointer; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform .15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,92,252,.35);
}
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
  transform: translateY(-1px);
}
.btn-success {
  background: var(--success);
  color: #000;
}
.btn-success:hover {
  background: #2bc48a;
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 200px; }
.col-2 { flex: 2; min-width: 280px; }
.col-3 { flex: 3; min-width: 300px; }

.output-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  min-height: 44px;
  word-break: break-all;
  position: relative;
  max-height: 300px;
  overflow-y: auto;
}

.badge-result {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 22px;
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 90;
}

.pw-display {
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 22px;
  text-align: center;
  letter-spacing: 2px;
  word-break: break-all;
  margin-bottom: 16px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition);
}
.pw-display:hover { border-color: var(--accent); }
.pw-strength {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}
.pw-strength .bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.pw-strength .bar.active.weak { background: var(--danger); }
.pw-strength .bar.active.medium { background: var(--warning); }
.pw-strength .bar.active.strong { background: var(--success); }

.color-preview {
  width: 100%;
  height: 100px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.color-grid .swatch {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px;
  font-size: 9px;
  font-family: var(--mono);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: transform var(--transition);
}
.color-grid .swatch:hover { transform: scale(1.08); }

.image-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-secondary);
}
.image-dropzone:hover,
.image-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.image-dropzone .icon { font-size: 42px; margin-bottom: 8px; }
.image-dropzone p { color: var(--text-secondary); font-size: 14px; }
.image-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  display: none;
}
.image-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.timezone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.timezone-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  transition: border-color var(--transition);
}
.timezone-card:hover { border-color: var(--accent); }
.timezone-card .city { font-size: 13px; font-weight: 600; }
.timezone-card .time { font-size: 18px; font-family: var(--mono); margin: 4px 0; }
.timezone-card .date { font-size: 11px; color: var(--text-muted); }
.timezone-card .offset { font-size: 11px; color: var(--text-muted); }
.regex-match {
  background: rgba(251,191,36,.2);
  border-radius: 2px;
  cursor: pointer;
}
.regex-match.active { background: rgba(251,191,36,.4); }
.regex-groups {
  font-size: 13px;
  font-family: var(--mono);
  line-height: 1.6;
}
.regex-flags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.regex-flags label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  margin: 0;
}

.uuid-list {
  max-height: 360px;
  overflow-y: auto;
}
.uuid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 13px;
  transition: border-color var(--transition);
}
.uuid-item:hover { border-color: var(--accent); }
.uuid-item .copy-uuid {
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition);
  font-size: 16px;
}
.uuid-item .copy-uuid:hover { color: var(--accent); }

.md-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 400px;
}
.md-container textarea {
  min-height: 400px;
  font-size: 14px;
  resize: none;
}
.md-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-y: auto;
  min-height: 400px;
  line-height: 1.7;
}
.md-preview h1 { font-size: 24px; margin: 16px 0 8px; }
.md-preview h2 { font-size: 20px; margin: 14px 0 6px; }
.md-preview h3 { font-size: 17px; margin: 12px 0 4px; }
.md-preview p { margin: 8px 0; }
.md-preview code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
}
.md-preview pre {
  background: var(--bg-primary);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 12px 0;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text-secondary);
  margin: 12px 0;
}
.md-preview img { max-width: 100%; border-radius: var(--radius-sm); }
.md-preview table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.md-preview th, .md-preview td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.md-preview th { background: var(--bg-hover); }
.md-preview ul, .md-preview ol { padding-left: 24px; margin: 8px 0; }
.md-preview a { color: var(--accent); }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .overlay.open { display: block; }
  .main {
    padding: 24px 16px 24px 60px;
    height: auto;
    min-height: 100vh;
  }
  .md-container {
    grid-template-columns: 1fr;
  }
  .row { flex-direction: column; }
  .tool-header h2 { font-size: 22px; }
}
