:root{
  --bg:#f6f8f6;
  --card:#dfdfdf;
  --text:#2f2f2f;
  --muted:#7a857a;
  --brand:#91bea8;
  --brand-2:#c3e6cc;
  --ring:#9fd5b060;
}

* { box-sizing: border-box; }

body{
  margin:0;
  font:16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color:var(--text);
  min-height:100dvh;
  display:grid;
  place-items:center;
  padding:24px;
}

.container{
  width:100%;
  max-width:720px;
  background:var(--card);
  border-radius:18px;
  padding:28px;
  box-shadow: 0 6px 18px #00000015;
}

h1{
  margin:0 0 18px;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing:.3px;
  color:var(--brand);
}

h2{
  margin:24px 0 8px;
  font-size:18px;
  color:var(--brand);
}

.row{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:14px;
}

.two-cols{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  gap:12px;
  align-items:end;
}

label{
  font-weight:600;
  font-size:14px;
  color:var(--muted);
}

input, select, button{
  font:inherit;
  border-radius:12px;
  border:1px solid #dcdedc;
  background:#fdfdfd;
  color:var(--text);
  padding:12px 14px;
  outline:none;
  width:100%;
}

input:focus, select:focus, button:focus{
  box-shadow: 0 0 0 4px var(--ring);
}

.primary{
  background: var(--brand);
  border:0;
  font-weight:700;
  cursor:pointer;
  color:#1f2d21;
  transition:0.2s;
}
.primary:hover{
  filter:brightness(1.05);
}

.swap{
  height:42px;
  width:42px;
  border-radius:50%;
  border:1px solid #dcdedc;
  background:#f9faf9;
  cursor:pointer;
  color:var(--muted);
}

.result{
  margin-top:18px;
  padding:18px;
  background:#f3f7f4;
  border:1px solid #e0e4e1;
  border-radius:14px;
  overflow-wrap: break-word;
}

.muted{
  color:var(--muted);
  font-size:14px;
  margin-top:6px;
}

.history{
  margin-top:14px;
  padding-top:6px;
  border-top:1px dashed #dcdedc;
}
#historyList{
  display:grid;
  gap:6px;
  padding-left:18px;
}
#historyList li{
  color:var(--muted);
}

/* -------- Responsividade -------- */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .container {
    padding: 20px;
    border-radius: 14px;
  }

  .two-cols {
    grid-template-columns: 1fr;
  }

  .swap {
    margin: 8px auto;
  }

  h1 {
    font-size: 22px;
    text-align: center;
  }

  button, input, select {
    font-size: 15px;
    padding: 12px;
  }
}
