:root {
  --primary-color: #10b981;
  --primary-dark: #047857;
  --background-color: #f0f2f5;
  --text-color: #111827;
  --card-background: #ffffff;
  --text-secondary: #374151;
  --spacing: 2rem;
  --border-radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--background-color);
  padding: var(--spacing);
}

header {
  margin-bottom: var(--spacing);
}

.home-link {
  font-size: 1.2rem;
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  border: var(--primary-dark) 2px solid;
}

.home-link svg {
  margin-right: 0.5rem;
  fill: var(--primary-dark);
}

.home-link:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border: var(--primary-color) 2px solid;
}

.home-link:hover svg {
  fill: white;
}

h1 {
  color: var(--text-color);
  margin-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: 800;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing);
  margin-top: var(--spacing);
}

.page-card {
  background: var(--card-background);
  padding: 1.75rem;
  cursor: pointer;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.page-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.page-card h2 {
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.25rem;
}

.page-card a {
  color: inherit;
  text-decoration: none;
}

.page-card a:hover {
  color: var(--primary-color);
}

.page-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

footer {
  margin-top: var(--spacing);
  padding-top: var(--spacing);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  color: var(--text-secondary);
}

@media (max-width: 1024px) {
  .page-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tool styling */
.tool {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 2rem 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  max-width: 800px;
}

.tool p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tool > div {
  margin-bottom: 1.5rem;
}

.tool > div:last-child {
  margin-bottom: 0;
}

/* Form field containers */
.tool .form-field {
  margin-bottom: 1.5rem;
}

/* Labels */
.tool label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
}

/* Text inputs, number inputs, textareas, and selects */
.tool input[type="text"],
.tool input[type="number"],
.tool input[type="email"],
.tool input[type="tel"],
.tool input[type="url"],
.tool input[type="password"],
.tool textarea,
.tool select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background-color: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1rem;
}

.tool input[type="text"]:focus,
.tool input[type="number"]:focus,
.tool input[type="email"]:focus,
.tool input[type="tel"]:focus,
.tool input[type="url"]:focus,
.tool input[type="password"]:focus,
.tool textarea:focus,
.tool select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.tool input[type="text"]:hover,
.tool input[type="number"]:hover,
.tool input[type="email"]:hover,
.tool input[type="tel"]:hover,
.tool input[type="url"]:hover,
.tool input[type="password"]:hover,
.tool textarea:hover,
.tool select:hover {
  border-color: #d1d5db;
}

/* Textarea specific */
.tool textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

/* Select dropdown specific */
.tool select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Checkbox and Radio Button styling - Each on new line */
.tool input[type="checkbox"],
.tool input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-right: 0.75rem;
  margin-bottom: 0;
  cursor: pointer;
  accent-color: var(--primary-color);
  display: block;
  float: left;
  margin-top: 0.1em;
}

/* Container for each radio/checkbox item on separate line */
.tool .radio-item,
.tool .checkbox-item {
  display: block;
  margin-bottom: 0.75rem;
  clear: both;
  overflow: hidden;
}

/* Labels for checkboxes and radios - inline with the input */
.tool input[type="checkbox"] + label,
.tool input[type="radio"] + label {
  display: block;
  margin-left: 2rem;
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

/* Alternative styling using :has selector for modern browsers */
.tool label:has(input[type="checkbox"]),
.tool label:has(input[type="radio"]) {
  display: block;
  margin-bottom: 0.75rem;
  cursor: pointer;
  overflow: hidden;
}

.tool label:has(input[type="checkbox"]) input,
.tool label:has(input[type="radio"]) input {
  float: left;
  margin-top: 0.1em;
}

/* Small inputs for inline use */
.tool input[style*="width:80px"],
.tool input[style*="width: 80px"] {
  width: 80px !important;
  display: inline-block;
  margin-right: 0.5rem;
}

/* Fieldset and legend for radio groups */
.tool fieldset {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin: 0;
  margin-bottom: 1.5rem;
}

.tool legend {
  display: block;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

/* Buttons */
.tool button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin-top: 1rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  font-family: inherit;
}

.tool button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tool button:active {
  transform: translateY(0);
}

.tool button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

/* Secondary button styling */
.tool button.secondary {
  background: #6b7280;
}

.tool button.secondary:hover {
  background: #4b5563;
}

/* Danger button styling */
.tool button.danger {
  background: #ef4444;
}

.tool button.danger:hover {
  background: #dc2626;
}

/* Result displays */
.tool #result,
.tool #resultContainer,
.tool #results,
.tool #output,
.tool [id$="result"],
.tool [id$="Result"],
.tool [id$="Container"],
.tool .result,
.tool .result-area {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  background-color: #f8fafc;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 3rem;
}

.tool #result h3,
.tool #resultContainer h3,
.tool [id$="result"] h3,
.tool [id$="Result"] h3,
.tool .result h3,
.tool .result-area h3 {
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.tool #result h2,
.tool #resultContainer h2,
.tool .result-area h2 {
  color: var(--primary-dark);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

/* Small text and helper text */
.tool small,
.tool .helper-text {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-style: italic;
}

/* Stats and info boxes */
.tool #stats,
.tool #pickedNames,
.tool [id$="stats"],
.tool [id$="Stats"],
.tool .stats,
.tool .info-box,
.tool #bmiGuide {
  background-color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tool #bmiGuide h3,
.tool .info-box h3 {
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.tool #bmiGuide ul,
.tool .info-box ul {
  list-style-position: inside;
  color: var(--text-secondary);
}

.tool #bmiGuide li,
.tool .info-box li {
  margin-bottom: 0.25rem;
}

/* Color Values and Copyable Elements */
.tool span[style*="cursor: pointer"],
.tool [title*="copy"],
.tool [title*="Copy"] {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  transition: all 0.2s ease;
}

.tool span[style*="cursor: pointer"]:hover,
.tool [title*="copy"]:hover,
.tool [title*="Copy"]:hover {
  border-color: var(--primary-color);
  background: #f0fdf4;
}

/* Tables in tools */
.tool table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tool table th,
.tool table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.tool table th {
  background-color: #f9fafb;
  font-weight: 600;
  color: var(--text-color);
}

.tool table tr:last-child td {
  border-bottom: none;
}

.tool table tr:hover {
  background-color: #f9fafb;
}

/* Error and success states */
.tool .error {
  color: #ef4444;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.75rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.tool .success {
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.75rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

/* Loading state */
.tool .loading {
  color: #6b7280;
  font-style: italic;
}

/* Flexible layout helpers */
.tool .flex {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.tool .flex-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Input groups */
.tool .input-group {
  display: flex;
  gap: 0.5rem;
  align-items: end;
}

.tool .input-group input,
.tool .input-group select {
  flex: 1;
}

.tool .input-group button {
  margin: 0;
  white-space: nowrap;
}

/* Responsive adjustments for tools */
@media (max-width: 640px) {
  .tool {
    padding: 1.5rem;
    margin: 1rem 0;
  }
  
  .tool input[style*="width:80px"],
  .tool input[style*="width: 80px"] {
    width: 100px !important;
    margin-bottom: 0.5rem;
  }
  
  .tool button {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.75rem;
  }
  
  .tool table {
    font-size: 0.9rem;
  }
  
  .tool table th,
  .tool table td {
    padding: 0.5rem;
  }
  
  .tool .input-group {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
  
  body {
    padding: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
}

ul {
  padding-left: 1.5rem;
  list-style-type: disc;
}

ol {
  padding-left: 1.5rem;
  list-style-type: decimal;
}