* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: #020617;
  border-bottom: 1px solid #1e293b;
}

.tool-header > div {
  min-width: 0;
}

.tool-header h1 {
  margin: 8px 0 4px;
  font-size: clamp(23px, 7vw, 32px);
  white-space: nowrap;
}

.tool-header p {
  margin: 0;
  color: #94a3b8;
}

.back-link {
  color: #38bdf8;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
}

.status-pill {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 999px;
  background: #064e3b;
  color: #a7f3d0;
  font-size: 14px;
  font-weight: bold;
}

.tool-layout {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.tool-card {
  padding: 24px;
  border: 1px solid #263244;
  border-radius: 20px;
  background: #111827;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.eyebrow {
  color: #38bdf8;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tool-card h2 {
  margin: 12px 0 22px;
  font-size: 26px;
}

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-weight: bold;
}

input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid #334155;
  border-radius: 12px;
  outline: none;
  background: #020617;
  color: #e5e7eb;
  font-size: 16px;
}

input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

button {
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: #38bdf8;
  color: #020617;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
}

button:hover {
  background: #67e8f9;
}

button:focus-visible,
.bottom-back-button:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.3);
  outline-offset: 3px;
}

.secondary-button {
  border: 1px solid #334155;
  background: #1e293b;
  color: #e5e7eb;
}

.secondary-button:hover {
  background: #334155;
}

.result-box {
  margin-bottom: 22px;
  padding: 26px;
  border: 1px solid #334155;
  border-radius: 18px;
  background: #020617;
}

.result-box p {
  margin: 0 0 12px;
  color: #94a3b8;
}

.result-box strong {
  display: block;
  color: #67e8f9;
  font-size: clamp(32px, 8vw, 44px);
  word-break: break-word;
}

.result-box.error {
  border-color: #7f1d1d;
}

.result-box.error strong {
  color: #fca5a5;
  font-size: 20px;
  line-height: 1.4;
}

.quick-reference {
  padding: 20px;
  border: 1px solid #263244;
  border-radius: 18px;
  background: #020617;
}

.quick-reference h3 {
  margin: 0 0 10px;
}

.quick-reference p {
  margin: 0 0 16px;
  color: #94a3b8;
  line-height: 1.5;
}

.formula-example {
  padding: 14px;
  border-left: 3px solid #38bdf8;
  border-radius: 0 10px 10px 0;
  background: rgba(56, 189, 248, 0.08);
}

.formula-example span,
.formula-example strong {
  display: block;
}

.formula-example span {
  margin-bottom: 5px;
  color: #38bdf8;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.formula-example strong {
  color: #e5e7eb;
  line-height: 1.4;
}

footer {
  padding: 20px;
  color: #64748b;
  text-align: center;
}

.bottom-back-container {
  width: 100%;
  max-width: none;
  margin: 0 auto 20px;
  padding: 0 20px;
}

.bottom-back-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 24px;
  border: 1px solid #263244;
  border-radius: 18px;
  background: #111827;
  color: #38bdf8;
  font-size: 18px;
  font-weight: bold;
  text-decoration: none;
  transition: 0.2s ease;
}

.bottom-back-button:hover {
  border-color: #38bdf8;
  background: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.12);
}

@media (max-width: 850px) {
  .tool-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .tool-header {
    padding: 18px 14px;
  }

  .tool-header h1 {
    white-space: normal;
  }

  .tool-header p {
    font-size: 13px;
    line-height: 1.4;
  }

  .tool-layout {
    padding: 14px;
  }

  .tool-card {
    padding: 18px;
    border-radius: 16px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }
}
