/* Simple Calculator — finished styles */

/* 1. Colors in one place, so they are easy to change */
:root {
  --ink: #1b1f24;
  --muted: #4a5360;
  --paper: #f6f7f9;
  --card: #ffffff;
  --accent: #1f5fbf;
  --error: #b3261e;
  --focus: #f2a900;
}

/* 2. Readable page: comfortable text size and line spacing */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

/* 3. One centered card that never gets wider than a phone-friendly column */
.calculator {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.25rem; }

/* 4. Each label sits directly above its box */
.field { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

/* 5. Big, easy-to-tap controls. 16px+ text stops phones from zooming in. */
input, select, button {
  font: inherit;
  width: 100%;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
  border: 2px solid #8a94a3;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

/* 6. A bright outline shows where the keyboard is */
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 7. Mistakes are shown with words AND color, never color alone */
input[aria-invalid="true"] { border-color: var(--error); }
.error { color: var(--error); margin: 0.25rem 0 0; font-size: 1rem; }
.hint { color: var(--muted); font-size: 1rem; margin: 0 0 1rem; }

/* 8. Buttons side by side, each taking half the width */
.actions { display: flex; gap: 0.75rem; }
button {
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.secondary { background: #fff; color: var(--accent); }

/* 9. The result stands out */
.result { margin-top: 1.5rem; }
output {
  display: block;
  min-height: 3rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: #eef3fb;
  font-size: 1.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
output[data-state="error"] { background: #fdecea; color: var(--error); }

/* 10. On narrow phones, use the full width */
@media (max-width: 480px) {
  .calculator { margin: 0; border-radius: 0; min-height: 100vh; }
}
