:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-muted: #6b7280;
  --border: #e2e4e9;
  --accent: #7c3348;
  --accent-hover: #692b3d;
  --error-bg: #fdecec;
  --error-text: #9b2226;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
}

.app {
  width: 100%;
  max-width: 420px;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.state {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
}

.state.error {
  color: var(--error-text);
}

.error p {
  margin: 0 0 16px;
}

#retryBtn {
  border: 1px solid var(--error-text);
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

#retryBtn:hover {
  background: var(--error-text);
  color: #fff;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select {
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

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

.row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}

#swapBtn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  color: var(--accent);
}

#swapBtn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.result {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 16px 8px;
  border-radius: 8px;
  background: #faf5f6;
  color: var(--accent);
  word-break: break-word;
}

.rates-strip {
  display: flex;
  gap: 8px;
  width: 100vw;
  position: relative;
  left: 50%;
  margin-left: -50vw;
  margin-top: 16px;
  padding: 2px 16px 4px;
  box-sizing: border-box;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rates-strip::-webkit-scrollbar {
  display: none;
}

.rates-strip.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.rate-tile {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-width: 92px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}

.rate-tile .rate-code {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rate-tile .rate-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.rate-tile .rate-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
