:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --ink: #172026;
  --muted: #60707a;
  --line: #cfd8dc;
  --button: #ffffff;
  --button-active: #193f5a;
  --button-active-ink: #ffffff;
  --accent: #1b7f5f;
  --warn: #8a4a00;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--button);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible {
  outline: 3px solid #2a7fff;
  outline-offset: 2px;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.converter {
  width: min(100%, 420px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.sync-button {
  min-width: 96px;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.directions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.directions button[aria-pressed="true"] {
  background: var(--button-active);
  border-color: var(--button-active);
  color: var(--button-active-ink);
}

.rate-panel {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.display {
  display: grid;
  gap: 8px;
  padding: 18px 0 10px;
}

.display-line {
  min-height: 44px;
  overflow-wrap: anywhere;
  text-align: right;
  line-height: 1.15;
}

.source-line {
  color: var(--muted);
  font-size: 1.45rem;
}

.result-line {
  font-size: 2.15rem;
  font-weight: 800;
}

.message {
  min-height: 22px;
  margin: 0 0 10px;
  color: var(--warn);
  font-size: 0.95rem;
  line-height: 1.35;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.keypad button {
  aspect-ratio: 1.18 / 1;
  font-size: 1.25rem;
}

.keypad .equals {
  grid-row: span 2;
  aspect-ratio: auto;
  background: var(--button-active);
  border-color: var(--button-active);
  color: var(--button-active-ink);
}

.keypad .zero {
  grid-column: span 2;
  aspect-ratio: auto;
}

@media (max-width: 360px) {
  .app {
    padding: 12px;
  }

  .result-line {
    font-size: 1.85rem;
  }

  .source-line {
    font-size: 1.25rem;
  }
}
