:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5c667a;
  --border: #d5dbe8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --error: #c62828;
  --shadow: 0 8px 30px rgba(20, 30, 60, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --card: #181f2f;
    --text: #e8ecf5;
    --muted: #97a1b6;
    --border: #2c3650;
    --accent: #4c8dff;
    --accent-text: #0b1020;
    --error: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.card {
  width: 100%;
  max-width: 460px;
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

h1 { margin: 0 0 4px; font-size: 1.5rem; }
.subtitle { margin: 0 0 20px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }

input, select {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pair { display: flex; align-items: flex-end; gap: 10px; margin-top: 16px; }

.icon-button {
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.icon-button:hover { background: var(--bg); }

.output { margin: 24px 0 16px; min-height: 110px; }
.result { margin: 0 0 8px; font-size: 1.35rem; font-weight: 700; word-break: break-word; }
.meta { margin: 0; font-size: 0.9rem; color: var(--muted); }
.status { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }
.status.error { color: var(--error); }

.secondary {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.secondary:hover { filter: brightness(1.08); }

footer { max-width: 460px; font-size: 0.8rem; text-align: center; color: var(--muted); }
footer a { color: inherit; }

@media (max-width: 420px) {
  .pair { flex-wrap: wrap; }
  .pair .field { flex: 1 1 100%; }
  .icon-button { margin: 0 auto; transform: rotate(90deg); }
}
