@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f0f5f2;
  --surface:      #ffffff;
  --surface2:     #e8f0ec;
  --accent:       #17a589;
  --accent-dark:  #128f76;
  --accent-light: #e6f7f3;
  --accent-glow:  rgba(23, 165, 137, 0.15);
  --text:         #0d1f19;
  --text-muted:   #5e7a72;
  --border:       rgba(0, 0, 0, 0.09);
  --radius:       16px;
  --radius-sm:    10px;
  --font-ui:      'Syne', sans-serif;
  --font-mono:    'Space Mono', monospace;
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ─── UTILITIES ─────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ─── SCREENS ───────────────────────────────────────────────── */

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 400ms var(--ease) both;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   SETUP SCREEN
═══════════════════════════════════════════════════════════════ */

#setup-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse 120% 50% at 50% -10%, rgba(23, 165, 137, 0.08) 0%, transparent 55%),
    var(--bg);
}

.setup-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid rgba(23, 165, 137, 0.15);
  border-radius: 24px;
  padding: 40px 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow:
    0 2px 0 rgba(23, 165, 137, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.1);
}

.logo {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 2px;
  display: block;
  animation: logoFloat 5s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(23, 165, 137, 0.25));
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-5px) rotate(1deg); }
}

.setup-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  line-height: 1;
}

.subtitle {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

/* ─── FIELD GROUP ───────────────────────────────────────────── */

.field-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-group label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.field-group input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-group input::placeholder {
  color: rgba(94, 122, 114, 0.45);
  font-weight: 400;
  font-style: italic;
}

.field-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}

/* Remove spinner arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; }
input[type=number] { -moz-appearance: textfield; }

/* ─── BUTTONS ───────────────────────────────────────────────── */

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 20px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 150ms ease, transform 120ms ease, box-shadow 150ms ease;
  margin-top: 6px;
  box-shadow: 0 4px 16px rgba(23, 165, 137, 0.3);
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 6px 24px rgba(23, 165, 137, 0.38);
}

.btn-primary:active { transform: scale(0.975); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 150ms ease;
  flex: 1;
}

.btn-secondary:hover {
  border-color: rgba(0, 0, 0, 0.22);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN SCREEN
═══════════════════════════════════════════════════════════════ */

#main-screen {
  background:
    radial-gradient(ellipse 90% 35% at 50% 110%, rgba(23, 165, 137, 0.07) 0%, transparent 55%),
    var(--bg);
}

/* ─── RATES HEADER ──────────────────────────────────────────── */

.rates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.rates-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.rate-item {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.rate-item strong {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.rate-separator {
  color: rgba(0, 0, 0, 0.15);
  font-size: 16px;
  line-height: 1;
}

.btn-edit {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease;
  opacity: 0.55;
}

.btn-edit:hover {
  background: rgba(0, 0, 0, 0.06);
  opacity: 1;
}

/* ─── EDIT FORM ─────────────────────────────────────────────── */

.edit-form {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideDown 220ms var(--ease);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.edit-actions {
  display: flex;
  gap: 8px;
}

.edit-actions .btn-primary {
  flex: 2;
  padding: 12px 16px;
  margin-top: 0;
  font-size: 13px;
}

/* ─── CALCULATOR ────────────────────────────────────────────── */

.calculator {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 36px 20px 48px;
  gap: 36px;
}

/* ─── UYU INPUT ─────────────────────────────────────────────── */

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

#uyu-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 4px 0 12px;
  font-family: var(--font-mono);
  font-size: clamp(44px, 14vw, 64px);
  font-weight: 700;
  color: var(--text);
  outline: none;
  transition: border-bottom-color 180ms ease;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
  letter-spacing: -1.5px;
}

#uyu-input::placeholder { color: rgba(13, 31, 25, 0.2); }

#uyu-input:focus { border-bottom-color: var(--accent); }

.currency-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: -4px;
}

/* ─── RESULTS ───────────────────────────────────────────────── */

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  row-gap: 6px;
  column-gap: 12px;
  transition: border-color 250ms ease, box-shadow 250ms ease;
  position: relative;
  overflow: hidden;
}

/* Left accent stripe */
.result-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 250ms ease;
}

.result-card.has-value {
  border-color: rgba(23, 165, 137, 0.25);
  box-shadow: 0 2px 12px rgba(23, 165, 137, 0.08);
}

.result-card.has-value::before { opacity: 1; }

.result-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}

.result-value {
  font-family: var(--font-mono);
  font-size: clamp(32px, 10vw, 44px);
  font-weight: 700;
  color: rgba(13, 31, 25, 0.18);
  grid-column: 1;
  grid-row: 2;
  line-height: 1;
  letter-spacing: -1px;
  transition: color 250ms ease;
}

.result-card.has-value .result-value {
  color: var(--accent);
}

.result-currency {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  padding-bottom: 5px;
}
