:root {
  --bg: #0D1117; /* Fondo un poco más profundo */
  --card: #161B22;
  --field: #21262D;
  --border: #30363D;
  --text: #F0F6FC;
  --muted: #8B949E;

  --gold: #E7B24C;
  --blue: #58A6FF;
  --mint: #3FB950;
  --accent-current: var(--gold);
  --accent-ink: #0D1117;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;

  /* --- ASPECTO DE TELÉFONO --- */
  --phone-w: 380px; /* Ancho estándar de iPhone */
  --phone-h: 720px; /* Alto alargado */
  
  --card-pad: 32px;
  --card-radius: 40px; /* Esquinas más redondas como teléfonos modernos */
  --field-radius: 16px;
  --gap: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center; /* Centrado en desktop */
  justify-content: center;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  padding: 20px;
}

.card {
  position: relative;
  width: 100%;
  max-width: var(--phone-w);
  min-height: var(--phone-h);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  /* Para que se sienta como una app que flota */
}

/* Línea decorativa superior estilo "Notch" */
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--gold), var(--blue), var(--mint));
  z-index: 10;
}

/* --- SECCIONES REPARTIDAS --- */

.head {
  margin-top: 10px;
  margin-bottom: 40px;
}

.brand {
  display: flex;
  flex-direction: column; /* Apilado para más elegancia */
  gap: 16px;
  align-items: center;
  text-align: center;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--accent-current);
  color: var(--accent-ink);
  font-size: 24px;
  font-weight: 800;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-current) 30%, transparent);
  padding-top: 5%;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.head h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.update-line {
  justify-content: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

/* TABS */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--field);
  border-radius: 20px;
  padding: 6px;
  margin-bottom: 32px;
}

.tab {
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 14px 0;
  cursor: pointer;
  font-size: 14px;
}

.tab.is-active { color: var(--accent-ink); }

.tab-indicator {
  position: absolute;
  top: 6px; bottom: 6px;
  background: var(--accent-current);
  border-radius: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* INPUT AREA */
.row {
  display: flex;
  flex-direction: column; /* Apilado en vertical */
  gap: 12px;
  margin-bottom: auto; /* Empuja el resultado hacia abajo */
}

.input-shell {
  background: var(--field);
  border: 2px solid transparent;
  border-radius: var(--field-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.input-shell:focus-within {
  border-color: var(--accent-current);
  background: transparent;
}

#amount {
   background: transparent;
  border: 0;
  color: white;
  /* Tamaño responsivo también para el input */
  font-size: clamp(20px, 8cqw, 32px); 
  font-family: var(--mono);
  font-weight: 700;
  width: 100%;
  outline: none;
  padding: 0;
}

#swap {
  align-self: center;
  background: var(--field);
  border: 1px solid var(--border);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: var(--accent-current);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5%;
}

/* RESULT AREA (Fondo de pantalla) */
.result {
 margin-top: auto;
  padding: 30px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 1px dashed var(--border);
  width: 100%;
  box-sizing: border-box;
  /* Definimos el contenedor para que el número sepa cuánto mide */
  container-type: inline-size;
  container-name: result-area;
}

#resultCurrency {
  font-size: 16px;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--accent-current);
  margin-bottom: 4px;
  text-transform: uppercase;
}

#resultNumber {
   font-family: var(--mono);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  display: block;
  width: 100%;
  
  /* --- AJUSTE DINÁMICO --- */
  /* 13cqi significa "13% del ancho del contenedor". 
     Si el contenedor mide 380px, la fuente será ~49px.
     Si el número es muy largo, bajará de tamaño automáticamente. */
  font-size: 13cqi; 
  
  /* Limites para que no se vea minúsculo ni gigante */
  min-height: 1.2em;
  overflow: hidden;
  white-space: nowrap; /* Mantiene el número en una sola línea */
  text-overflow: clip;
  
  background: linear-gradient(to bottom, #fff 30%, var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: font-size 0.2s ease; /* Suaviza el cambio de tamaño */
}

.rate-line {
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
  background: var(--field);
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
}

/* Adaptación para que en móviles reales ocupe toda la pantalla */
@media (max-width: 480px) {
  body { padding: 0; }
  .card {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: 0;
  }
}

#symbol{
  font-size: 22px;
}

@container result-area (width > 0) {
  #resultNumber {
    /* Si ves que se sigue saliendo, baja el 13 a 11 */
    font-size: 12.5cqi; 
  }
}