/* Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background: #F8F9FA; color: #212529; min-height: 100vh; }

/* Header */
header { background: #1a1a2e; color: #fff; padding: 1rem 1.5rem; }
header h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
header p  { font-size: 0.8rem; color: #aaa; margin-top: 0.2rem; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; padding: 1rem 1.5rem 0; background: #fff; border-bottom: 2px solid #e9ecef; overflow-x: auto; }
.tab-btn {
  padding: 0.5rem 1rem; border: none; background: none; cursor: pointer;
  font-size: 0.875rem; font-weight: 500; color: #6c757d; border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap; border-radius: 4px 4px 0 0; transition: 0.15s;
}
.tab-btn:hover { color: #343a40; background: #f8f9fa; }
.tab-btn.active { color: #0d6efd; border-bottom-color: #0d6efd; background: none; }

/* Main */
main { max-width: 860px; margin: 0 auto; padding: 1.5rem; }
.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* Tool sections */
.tool-header { margin-bottom: 1.25rem; }
.tool-header h2 { font-size: 1.1rem; font-weight: 700; }
.tool-header p  { font-size: 0.85rem; color: #6c757d; margin-top: 0.25rem; }

.card { background: #fff; border: 1px solid #e9ecef; border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }

label { display: block; font-size: 0.8rem; font-weight: 600; color: #495057; margin-bottom: 0.35rem; }

input[type="number"], input[type="text"], textarea, select {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #ced4da; border-radius: 6px;
  font-size: 0.9rem; outline: none; transition: border-color 0.15s;
  font-family: inherit; background: #fff; color: #212529;
}
input:focus, textarea:focus, select:focus { border-color: #0d6efd; box-shadow: 0 0 0 3px rgba(13,110,253,0.1); }
textarea { resize: vertical; min-height: 90px; }

.btn {
  display: inline-block; padding: 0.5rem 1.25rem; border: none; border-radius: 6px;
  font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: 0.15s;
}
.btn-primary { background: #0d6efd; color: #fff; }
.btn-primary:hover { background: #0b5ed7; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.radio-group, .check-group { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
.radio-group label, .check-group label {
  display: flex; align-items: center; gap: 0.35rem;
  font-weight: 400; color: #495057; cursor: pointer; font-size: 0.85rem;
}

/* Results */
.result-card {
  background: #f0f4ff; border: 1px solid #c7d9ff; border-radius: 8px; padding: 1rem; margin-top: 0.75rem;
}
.result-main { font-size: 2rem; font-weight: 700; color: #0d6efd; }
.result-sub  { font-size: 0.95rem; color: #343a40; margin-top: 0.25rem; }
.result-meta { font-size: 0.78rem; color: #6c757d; margin-top: 0.2rem; }
.copy-btn {
  margin-top: 0.6rem; padding: 0.3rem 0.75rem; border: 1px solid #0d6efd;
  background: transparent; color: #0d6efd; border-radius: 5px; cursor: pointer; font-size: 0.8rem;
  transition: 0.15s;
}
.copy-btn:hover { background: #0d6efd; color: #fff; }

/* Divider */
.divider { border: none; border-top: 1px dashed #dee2e6; margin: 1.25rem 0; }

/* Diff */
.diff-wrap { font-family: monospace; font-size: 0.9rem; line-height: 1.6; word-break: break-all; }
.diff-changed { background: #fff3cd; border-bottom: 2px solid #ffc107; border-radius: 2px; }

/* Char type */
.ct-output { font-size: 1.1rem; line-height: 2; word-break: break-all; }
.char-span { border-radius: 3px; padding: 0 1px; }

.stat-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.82rem; }
.stat-label { width: 70px; font-weight: 600; }
.stat-bar-wrap { flex: 1; background: #e9ecef; border-radius: 99px; height: 8px; overflow: hidden; }
.stat-bar { height: 100%; border-radius: 99px; min-width: 2px; transition: width 0.3s; }
.stat-num { width: 90px; text-align: right; color: #6c757d; }

/* Toast */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #212529; color: #fff; padding: 0.5rem 1.25rem; border-radius: 99px;
  font-size: 0.85rem; opacity: 0; pointer-events: none; transition: 0.2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Section label */
.section-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; color: #adb5bd;
  text-transform: uppercase; margin-bottom: 0.5rem;
}

/* Ad placeholder */
.ad-slot {
  background: #f8f9fa; border: 1px dashed #dee2e6; border-radius: 8px;
  padding: 1rem; text-align: center; color: #adb5bd; font-size: 0.78rem;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 600px) {
  main { padding: 1rem; }
  .result-main { font-size: 1.5rem; }
  .tabs { padding: 0.75rem 0.75rem 0; }
}
