/* Minimal, clean UI with brand header/footer */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-ink: #fff;
  --border: #e2e8f0;
  --radius: 16px;
  --accent-1: #2563eb;
  --accent-2: #1d4ed8;
  --focus: #0ea5e9;

  --weak: #ef4444;         /* red */
  --avg: #f59e0b;          /* amber */
  --strong: #10b981;       /* emerald */
  --vstrong: #06b6d4;      /* cyan */
  --super: #7c3aed;        /* violet */
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
.wrap { max-width: 920px; margin: 0 auto; padding: 20px; }

/* ====== Header (shared) ====== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(29,78,216,0.18);
}
.brand-title {
  display: grid;
  line-height: 1.1;
}
.brand-title .site-name {
  font-size: 12px;
  color: var(--muted);
}
.brand-title .product-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ====== Footer (shared) ====== */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.site-footer nav { display: flex; gap: 16px; }

/* ====== Content ====== */
header h1 { margin: 0 0 6px; font-weight: 700; letter-spacing: -0.02em; }
.subtle { color: var(--muted); margin: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 8px 24px rgba(2,6,23,0.06); }
main .card { margin-top: 6px; }

fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
legend { color: var(--muted); padding: 0 6px; }
.row { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; margin: 12px 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 10px 0; }
.grid label { position: relative; }

input[type=number],
input[type=password],
input[type=text] {
  width: 100%;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }

button { cursor: pointer; border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 600; transition: transform .06s ease-in-out, box-shadow .15s ease; }
button.primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 14px rgba(37,99,235,0.25); }
button.primary:active { transform: translateY(1px); }
button.secondary { background: #e2e8f0; color: #0f172a; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Actions row in form: strength meter + button */
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.form-actions .primary { margin-left: auto; }

/* Strength meter */
.strength-meter { display: inline-flex; align-items: center; gap: 10px; }
.strength-meter .bars { display: inline-flex; gap: 4px; }
.strength-meter .bars span {
  width: 10px; height: 12px; border-radius: 3px; background: #e5e7eb; border: 1px solid #e2e8f0;
  transition: background-color .15s ease, border-color .15s ease;
}
.strength-meter .label { font-size: 13px; color: var(--muted); }

/* Color states by data-level (1..5) */
.strength-meter[data-level="1"] .bars span:nth-child(-n+1) { background: var(--weak); border-color: var(--weak); }
.strength-meter[data-level="2"] .bars span:nth-child(-n+2) { background: var(--avg); border-color: var(--avg); }
.strength-meter[data-level="3"] .bars span:nth-child(-n+3) { background: var(--strong); border-color: var(--strong); }
.strength-meter[data-level="4"] .bars span:nth-child(-n+4) { background: var(--vstrong); border-color: var(--vstrong); }
.strength-meter[data-level="5"] .bars span:nth-child(-n+5) { background: var(--super); border-color: var(--super); }

.result { margin-top: 20px; }
.result.hidden { display: none; }
.pw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.3rem; padding: 12px; background: #f1f5f9; border: 1px dashed var(--border); border-radius: 8px; word-break: break-all; }
.actions { margin-top: 10px; display: flex; gap: 10px; }
.msg { margin-top: 8px; color: var(--muted); }

.ad-container { margin: 10px auto; }
.ad-slot { width: 100%; min-height: 90px; background: #f1f5f9; border: 1px dashed var(--border); border-radius: 12px; display:flex; align-items:center; justify-content:center; color: var(--muted); }
.ad-slot::after { content: "Ad Slot (collapsed when ads are off)"; }

/* Table */
table { width:100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); text-align:left; }

/* --- Badge (centered) --- */
.badge-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: #fff;
  border-radius: 9999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  margin: 12px auto 0 auto;
  line-height: 1.2;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 8px 20px rgba(29,78,216,0.25);
  width: fit-content;
}
.badge-stats strong { font-size: 16px; margin-left: 6px; }

.badge-delta {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

/* Accessible (i) tooltip for special characters */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 12px;
  line-height: 1;
  border: 1px solid var(--border);
}
.info-btn:focus { outline: none; }
.info-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(14,165,233,0.35);
  border-color: var(--focus);
}

.tooltip {
  position: absolute;
  left: 0;
  top: 100%;
  transform: translateY(6px);
  background: #0f172a;
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(2,6,23,0.25);
  font-size: 12px;
  line-height: 1.3;
  max-width: 320px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.info-btn:hover + .tooltip,
.info-btn:focus + .tooltip {
  opacity: 1;
  pointer-events: auto;
}

/* below-form paragraph */
.below-form {
  margin: 20px 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
}
.below-form a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* subtle bump animation */
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.bump { animation: bump .28s ease-in-out; }

@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }
  .site-footer .foot-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .primary { margin-left: 0; }
}
