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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e2e8f0;
  padding: 1rem;
}

.card {
  background: #1e293b;
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #f8fafc;
}

.subtitle {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-bottom: 2rem;
}

/* Small uppercase heading used above form controls */
.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

/* Primary call-to-action button */
.btn-primary {
  width: 100%;
  padding: 0.875rem;
  border-radius: 0.75rem;
  border: none;
  background: #6366f1;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover { background: #4f46e5; }
.btn-primary:active { transform: scale(0.98); }

/* "Home" link shown beneath a tool's card */
.home-link {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s;
}

.home-link:hover { color: #e2e8f0; }

/* ===== Home page ===== */

body.page-home {
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

header p {
  color: #64748b;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 700px;
}

.tool-card {
  max-width: none;
  border: 1.5px solid #334155;
  padding: 2rem 1.75rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: none;
}

.tool-card:hover {
  border-color: #6366f1;
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
}

.card-desc {
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.5;
}

.arrow {
  margin-top: auto;
  padding-top: 1rem;
  color: #6366f1;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap 0.15s;
}

.tool-card:hover .arrow { gap: 0.65rem; }

/* ===== Password generator ===== */

.card-wide {
  max-width: 520px;
}

/* Format selector */
.format-label {
  margin-bottom: 0.75rem;
}

.format-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.format-btn {
  flex: 1;
  min-width: 100px;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1.5px solid #334155;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.format-btn:hover { border-color: #6366f1; color: #f8fafc; }

.format-btn.active {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

/* Password display */
.password-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.password-display {
  width: 100%;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 0.75rem;
  padding: 1rem 3.5rem 1rem 1.25rem;
  font-size: 1.25rem;
  font-family: 'Courier New', monospace;
  color: #a5f3fc;
  word-break: break-all;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
}

.copy-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 0.4rem;
  color: #64748b;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-btn:hover { color: #a5f3fc; background: #1e3a4a; }
.copy-btn.copied { color: #4ade80; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(4rem);
  background: #22c55e;
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  pointer-events: none;
  transition: transform 0.25s ease;
  z-index: 100;
}

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

/* Advanced options */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 1.75rem;
  margin-bottom: 0;
  transition: color 0.15s;
}

.advanced-toggle:hover { color: #cbd5e1; }

.advanced-toggle svg {
  transition: transform 0.2s;
}

.advanced-toggle.open svg { transform: rotate(180deg); }

.advanced-body {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1.25rem;
  background: #0f172a;
  border-radius: 0.75rem;
  border: 1.5px solid #334155;
}

.advanced-body.open { display: flex; }

.option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.option-row input[type="checkbox"] {
  appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px solid #475569;
  border-radius: 0.3rem;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
}

.option-row input[type="checkbox"]:checked {
  background: #6366f1;
  border-color: #6366f1;
}

.option-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.option-label {
  font-size: 0.875rem;
  color: #cbd5e1;
}

.option-label span {
  color: #64748b;
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

.generate-btn { margin-top: 1.5rem; }

/* ===== MPG calculator ===== */

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
}

.field input {
  width: 100%;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: #e2e8f0;
  transition: border-color 0.15s;
  outline: none;
}

.field input:focus { border-color: #6366f1; }

.field input::placeholder { color: #475569; }

.calc-btn {
  margin-top: 0.5rem;
}

.results {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result {
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-label {
  font-size: 0.875rem;
  color: #94a3b8;
}

.result-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #a5f3fc;
  font-family: 'Courier New', monospace;
}

.result-value:empty::before {
  content: '—';
  color: #334155;
}
