/* ---------- Basic variables & reset ---------- */
:root {
  --bg: #e1e3e6;
  --card: #ffffff;
  --text: #0f1720;
  --muted: #444953;
  --accent: #0ea5a4; /* teal-ish */
  --accent-contrast: #ffffff;
  --danger: #ef4444;
  --radius: 12px;
  --max-width: 1200px;
  --gap: 16px;
  --shadow: 0 6px 24px rgba(15, 23, 40, 0.06);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;

  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* display: flex;
        align-items: center;
        justify-content: center; */
}
#related .global-btn {
  margin-left: 1.5rem;
}
/* ---------- Layout ---------- */
.calculator {
  width: 100%;
  max-width: var(--max-width);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: start;
}

@media (max-width: 880px) {
  .calculator {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .result {
    min-height: 140px;
  }
}

.calculator-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.calculator-header h1 {
  font-size: 32px;
  margin: 0.5rem 0;
  letter-spacing: -0.01em;
}
.calculator-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.calculator-section {
  background: #fafbfc;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #eef2f6;
}

.calculator-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calculator-title::before {
  content: "•";
  color: var(--accent);
  font-size: 24px;
}

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

label {
  font-size: 14px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.field {
  display: flex;
  gap: 8px;
  align-items: center;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.control {
  background: #ffffff;
  border: 1px solid #e6eef6;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 16px;
  width: 100%;
  outline: none;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.control:focus {
  box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.08);
  border-color: var(--accent);
}

.percent-suffix {
  min-width: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
button {
  cursor: pointer;
  border: 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
}
button:hover {
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 6px 18px rgba(14, 165, 164, 0.12);
}
.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(14, 165, 164, 0.18);
}
.btn-ghost {
  background: transparent;
  border: 1px solid #e6eef6;
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(14, 165, 164, 0.04);
}
.btn-danger {
  background: var(--danger);
  color: white;
}

/* ---------- Result card ---------- */
.result {
  background: linear-gradient(180deg, #ffffff, #fbfeff);
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #e9f3f4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  margin-top: 6px;
}
.result .label {
  font-size: 13px;
  color: var(--muted);
}
.result .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}
.small {
  font-size: 16px;
  color: var(--muted);
}

.note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* accessibility focus */
button:focus,
.control:focus {
  outline-offset: 2px;
}

/* tiny helpers */
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}

/* Keyboard shortcut hint */
.keyboard-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
kbd {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: inherit;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.mode-toggle input[type="checkbox"] {
  margin: 0;
  transform: scale(1.2);
}
.mode-toggle label {
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}

.input-form {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 1rem;
}

.result-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
