:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --border: #e0e0e3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.05), 0 16px 40px rgba(0, 0, 0, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand .dot {
  color: var(--accent);
}

.nav-link {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

/* Page shell */
.page {
  padding-top: 32px;
  padding-bottom: 24px;
}

.page-title {
  font-size: clamp(26px, 4.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-sub {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 16px;
  max-width: 640px;
}

/* Tool card */
.tool-card {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Segmented control */
.segmented {
  display: flex;
  background: #e8e8ed;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.segmented label {
  flex: 1;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  color: #3a3a3c;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Checkbox rows */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Range slider */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-value {
  min-width: 44px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

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

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* Result */
.result {
  margin-top: 22px;
  padding: 20px 20px 22px;
  background: var(--accent-soft);
  border-radius: 12px;
  text-align: center;
  display: none;
}

.result.show {
  display: block;
}

.result-value {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
  letter-spacing: -0.02em;
  word-break: break-word;
}

.result-value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px;
  letter-spacing: 0.02em;
}

.result-caption {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 15px;
}

.result-detail {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text);
}

.result-detail .muted {
  color: var(--text-muted);
}

/* Password strength meter */
.meter {
  margin-top: 8px;
  height: 6px;
  border-radius: 3px;
  background: #e8e8ed;
  overflow: hidden;
}

.meter-bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width 0.2s, background 0.2s;
}

.meter-label {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}

/* Ad slot */
.ad-slot {
  margin-top: 28px;
}

.ad-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ad-placeholder {
  margin-top: 6px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  background: #fafafa;
}

/* Related tools */
.related {
  margin-top: 28px;
}

.related h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 32px 20px 48px;
  background: #fff;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 13px;
}

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

.footer-links .muted {
  color: #b9b9be;
  font-size: 13px;
}

.footer-brand {
  font-weight: 700;
  color: var(--text);
}

.footer-muted {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 18px;
}

/* Homepage */
.hero {
  text-align: center;
  padding: 56px 0 8px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero p {
  color: var(--text-muted);
  font-size: 18px;
  margin-top: 12px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.search {
  max-width: 520px;
  margin: 28px auto 0;
}

.search input {
  padding: 14px 18px;
  font-size: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 32px;
  padding-bottom: 8px;
}

.tool-card-link {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.tool-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}

.tool-icon {
  font-size: 28px;
  line-height: 1;
}

.tool-name {
  font-weight: 600;
  color: var(--text);
  margin-top: 10px;
  font-size: 16px;
}

.tool-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.tool-card-link.coming-soon {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
  background: #fafafa;
}

.tool-card-link.coming-soon:hover {
  transform: none;
  border-color: var(--border);
}

.badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e8e8ed;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 3px 10px;
}

.no-results {
  display: none;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.no-results.show {
  display: block;
}

/* Toasts */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .tool-card {
    padding: 20px;
  }
}
